From 50cdab5936fd1c1a53d01688b5ba45acb751c24d Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 21 Jun 2019 22:21:01 +0000 Subject: [PATCH] Generated from d71a2ccd53f1e0e1d7bdfd8971390fbd650c7f6d Ouuups, fix broken Readme --- .../azure/mgmt/monitor/__init__.py | 7 +- .../azure/mgmt/monitor/_configuration.py | 48 + .../monitor/_monitor_management_client.py | 526 +++++++ .../azure/mgmt/monitor/models.py | 20 + .../mgmt/monitor/v2015_04_01/__init__.py | 19 + .../monitor/v2015_04_01/_configuration.py | 48 + .../v2015_04_01/_monitor_management_client.py | 69 + .../monitor/v2015_04_01/models/__init__.py | 104 ++ .../monitor/v2015_04_01/models/_models.py | 1033 ++++++++++++++ .../monitor/v2015_04_01/models/_models_py3.py | 1033 ++++++++++++++ .../_monitor_management_client_enums.py | 75 + .../v2015_04_01/models/_paged_models.py | 53 + .../v2015_04_01/operations/__init__.py | 24 + .../operations/_activity_logs_operations.py | 136 ++ .../_autoscale_settings_operations.py | 425 ++++++ .../_event_categories_operations.py | 102 ++ .../v2015_04_01/operations/_operations.py | 91 ++ .../_tenant_activity_logs_operations.py | 138 ++ .../azure/mgmt/monitor/v2015_04_01/version.py | 13 + .../mgmt/monitor/v2015_07_01/__init__.py | 19 + .../monitor/v2015_07_01/_configuration.py | 43 + .../monitor/v2015_07_01/_monitor_client.py | 47 + .../monitor/v2015_07_01/models/__init__.py | 34 + .../monitor/v2015_07_01/models/_models.py | 262 ++++ .../monitor/v2015_07_01/models/_models_py3.py | 262 ++++ .../v2015_07_01/operations/__init__.py | 16 + ..._service_diagnostic_settings_operations.py | 164 +++ .../azure/mgmt/monitor/v2015_07_01/version.py | 13 + .../mgmt/monitor/v2016_03_01/__init__.py | 19 + .../monitor/v2016_03_01/_configuration.py | 48 + .../v2016_03_01/_monitor_management_client.py | 64 + .../monitor/v2016_03_01/models/__init__.py | 103 ++ .../monitor/v2016_03_01/models/_models.py | 952 +++++++++++++ .../monitor/v2016_03_01/models/_models_py3.py | 952 +++++++++++++ .../_monitor_management_client_enums.py | 50 + .../v2016_03_01/models/_paged_models.py | 66 + .../v2016_03_01/operations/__init__.py | 22 + .../_alert_rule_incidents_operations.py | 175 +++ .../operations/_alert_rules_operations.py | 428 ++++++ .../operations/_log_profiles_operations.py | 343 +++++ .../_metric_definitions_operations.py | 116 ++ .../azure/mgmt/monitor/v2016_03_01/version.py | 13 + .../mgmt/monitor/v2016_09_01/__init__.py | 19 + .../monitor/v2016_09_01/_configuration.py | 43 + .../monitor/v2016_09_01/_monitor_client.py | 52 + .../monitor/v2016_09_01/models/__init__.py | 52 + .../monitor/v2016_09_01/models/_models.py | 429 ++++++ .../monitor/v2016_09_01/models/_models_py3.py | 429 ++++++ .../models/_monitor_client_enums.py | 23 + .../v2016_09_01/models/_paged_models.py | 27 + .../v2016_09_01/operations/__init__.py | 18 + .../operations/_metrics_operations.py | 131 ++ ..._service_diagnostic_settings_operations.py | 234 ++++ .../azure/mgmt/monitor/v2016_09_01/version.py | 13 + .../monitor/v2017_03_01_preview/__init__.py | 19 + .../v2017_03_01_preview/_configuration.py | 48 + .../_monitor_management_client.py | 49 + .../v2017_03_01_preview/models/__init__.py | 42 + .../v2017_03_01_preview/models/_models.py | 315 +++++ .../v2017_03_01_preview/models/_models_py3.py | 315 +++++ .../models/_paged_models.py | 27 + .../operations/__init__.py | 16 + .../_activity_log_alerts_operations.py | 425 ++++++ .../monitor/v2017_03_01_preview/version.py | 13 + .../mgmt/monitor/v2017_04_01/__init__.py | 19 + .../monitor/v2017_04_01/_configuration.py | 48 + .../v2017_04_01/_monitor_management_client.py | 54 + .../monitor/v2017_04_01/models/__init__.py | 75 + .../monitor/v2017_04_01/models/_models.py | 657 +++++++++ .../monitor/v2017_04_01/models/_models_py3.py | 657 +++++++++ .../_monitor_management_client_enums.py | 19 + .../v2017_04_01/models/_paged_models.py | 40 + .../v2017_04_01/operations/__init__.py | 18 + .../operations/_action_groups_operations.py | 487 +++++++ .../_activity_log_alerts_operations.py | 430 ++++++ .../azure/mgmt/monitor/v2017_04_01/version.py | 13 + .../monitor/v2017_05_01_preview/__init__.py | 19 + .../v2017_05_01_preview/_configuration.py | 43 + .../_monitor_management_client.py | 62 + .../v2017_05_01_preview/models/__init__.py | 79 ++ .../v2017_05_01_preview/models/_models.py | 614 +++++++++ .../v2017_05_01_preview/models/_models_py3.py | 614 +++++++++ .../_monitor_management_client_enums.py | 47 + .../models/_paged_models.py | 27 + .../operations/__init__.py | 22 + ...diagnostic_settings_category_operations.py | 158 +++ .../_diagnostic_settings_operations.py | 275 ++++ .../_metric_definitions_operations.py | 106 ++ .../operations/_metrics_operations.py | 146 ++ .../monitor/v2017_05_01_preview/version.py | 13 + .../monitor/v2017_11_01_preview/__init__.py | 19 + .../v2017_11_01_preview/_configuration.py | 43 + .../_monitor_management_client.py | 47 + .../v2017_11_01_preview/models/__init__.py | 43 + .../v2017_11_01_preview/models/_models.py | 265 ++++ .../v2017_11_01_preview/models/_models_py3.py | 265 ++++ .../_monitor_management_client_enums.py | 25 + .../operations/__init__.py | 16 + .../operations/_metric_baseline_operations.py | 199 +++ .../monitor/v2017_11_01_preview/version.py | 13 + .../monitor/v2017_12_01_preview/__init__.py | 19 + .../v2017_12_01_preview/_configuration.py | 43 + .../_monitor_management_client.py | 47 + .../v2017_12_01_preview/models/__init__.py | 27 + .../v2017_12_01_preview/models/_models.py | 99 ++ .../v2017_12_01_preview/models/_models_py3.py | 99 ++ .../models/_paged_models.py | 27 + .../operations/__init__.py | 16 + .../_metric_namespaces_operations.py | 111 ++ .../monitor/v2017_12_01_preview/version.py | 13 + .../mgmt/monitor/v2018_01_01/__init__.py | 19 + .../monitor/v2018_01_01/_configuration.py | 43 + .../v2018_01_01/_monitor_management_client.py | 52 + .../monitor/v2018_01_01/models/__init__.py | 53 + .../monitor/v2018_01_01/models/_models.py | 355 +++++ .../monitor/v2018_01_01/models/_models_py3.py | 355 +++++ .../_monitor_management_client_enums.py | 41 + .../v2018_01_01/models/_paged_models.py | 27 + .../v2018_01_01/operations/__init__.py | 18 + .../_metric_definitions_operations.py | 111 ++ .../operations/_metrics_operations.py | 152 ++ .../azure/mgmt/monitor/v2018_01_01/version.py | 13 + .../mgmt/monitor/v2018_03_01/__init__.py | 19 + .../monitor/v2018_03_01/_configuration.py | 48 + .../v2018_03_01/_monitor_management_client.py | 59 + .../monitor/v2018_03_01/models/__init__.py | 108 ++ .../monitor/v2018_03_01/models/_models.py | 1227 +++++++++++++++++ .../monitor/v2018_03_01/models/_models_py3.py | 1227 +++++++++++++++++ .../_monitor_management_client_enums.py | 19 + .../v2018_03_01/models/_paged_models.py | 40 + .../v2018_03_01/operations/__init__.py | 20 + .../operations/_action_groups_operations.py | 488 +++++++ .../operations/_metric_alerts_operations.py | 420 ++++++ .../_metric_alerts_status_operations.py | 164 +++ .../azure/mgmt/monitor/v2018_03_01/version.py | 13 + .../mgmt/monitor/v2018_04_16/__init__.py | 19 + .../monitor/v2018_04_16/_configuration.py | 48 + .../monitor/v2018_04_16/_monitor_client.py | 49 + .../monitor/v2018_04_16/models/__init__.py | 74 + .../monitor/v2018_04_16/models/_models.py | 519 +++++++ .../monitor/v2018_04_16/models/_models_py3.py | 519 +++++++ .../models/_monitor_client_enums.py | 53 + .../v2018_04_16/models/_paged_models.py | 27 + .../v2018_04_16/operations/__init__.py | 16 + .../_scheduled_query_rules_operations.py | 437 ++++++ .../azure/mgmt/monitor/v2018_04_16/version.py | 13 + .../monitor/v2018_06_01_preview/__init__.py | 19 + .../v2018_06_01_preview/_configuration.py | 48 + .../_monitor_management_client.py | 54 + .../v2018_06_01_preview/models/__init__.py | 59 + .../v2018_06_01_preview/models/_models.py | 456 ++++++ .../v2018_06_01_preview/models/_models_py3.py | 456 ++++++ .../models/_paged_models.py | 40 + .../operations/__init__.py | 18 + ...nostics_settings_association_operations.py | 440 ++++++ .../_guest_diagnostics_settings_operations.py | 428 ++++++ .../monitor/v2018_06_01_preview/version.py | 13 + .../mgmt/monitor/v2018_09_01/__init__.py | 19 + .../monitor/v2018_09_01/_configuration.py | 48 + .../v2018_09_01/_monitor_management_client.py | 59 + .../monitor/v2018_09_01/models/__init__.py | 89 ++ .../monitor/v2018_09_01/models/_models.py | 831 +++++++++++ .../monitor/v2018_09_01/models/_models_py3.py | 831 +++++++++++ .../_monitor_management_client_enums.py | 32 + .../v2018_09_01/models/_paged_models.py | 27 + .../v2018_09_01/operations/__init__.py | 20 + .../operations/_action_groups_operations.py | 488 +++++++ .../operations/_baseline_operations.py | 141 ++ .../operations/_metric_baseline_operations.py | 209 +++ .../azure/mgmt/monitor/v2018_09_01/version.py | 13 + .../monitor/v2018_11_27_preview/__init__.py | 19 + .../v2018_11_27_preview/_configuration.py | 43 + .../_monitor_management_client.py | 47 + .../v2018_11_27_preview/models/__init__.py | 40 + .../v2018_11_27_preview/models/_models.py | 232 ++++ .../v2018_11_27_preview/models/_models_py3.py | 232 ++++ .../_monitor_management_client_enums.py | 25 + .../operations/__init__.py | 16 + .../operations/_vm_insights_operations.py | 98 ++ .../monitor/v2018_11_27_preview/version.py | 13 + .../mgmt/monitor/v2019_03_01/__init__.py | 19 + .../monitor/v2019_03_01/_configuration.py | 48 + .../v2019_03_01/_monitor_management_client.py | 54 + .../monitor/v2019_03_01/models/__init__.py | 88 ++ .../monitor/v2019_03_01/models/_models.py | 849 ++++++++++++ .../monitor/v2019_03_01/models/_models_py3.py | 849 ++++++++++++ .../_monitor_management_client_enums.py | 32 + .../v2019_03_01/models/_paged_models.py | 40 + .../v2019_03_01/operations/__init__.py | 18 + .../operations/_action_groups_operations.py | 488 +++++++ .../operations/_baselines_operations.py | 155 +++ .../azure/mgmt/monitor/v2019_03_01/version.py | 13 + .../mgmt/monitor/v2019_06_01/__init__.py | 19 + .../monitor/v2019_06_01/_configuration.py | 48 + .../v2019_06_01/_monitor_management_client.py | 49 + .../monitor/v2019_06_01/models/__init__.py | 67 + .../monitor/v2019_06_01/models/_models.py | 676 +++++++++ .../monitor/v2019_06_01/models/_models_py3.py | 676 +++++++++ .../_monitor_management_client_enums.py | 19 + .../v2019_06_01/models/_paged_models.py | 27 + .../v2019_06_01/operations/__init__.py | 16 + .../operations/_action_groups_operations.py | 488 +++++++ .../azure/mgmt/monitor/v2019_06_01/version.py | 13 + 203 files changed, 34308 insertions(+), 3 deletions(-) create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_configuration.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_management_client.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_configuration.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_monitor_management_client.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_models_py3.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_monitor_management_client_enums.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_paged_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_activity_logs_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_autoscale_settings_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_event_categories_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_tenant_activity_logs_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/version.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_configuration.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_monitor_client.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/_models_py3.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_service_diagnostic_settings_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/version.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_configuration.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_monitor_management_client.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_models_py3.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_monitor_management_client_enums.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_paged_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_alert_rule_incidents_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_alert_rules_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_log_profiles_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_metric_definitions_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/version.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_configuration.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_monitor_client.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_models_py3.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_monitor_client_enums.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_paged_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/operations/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/operations/_metrics_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/operations/_service_diagnostic_settings_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/version.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_configuration.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_monitor_management_client.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/models/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/models/_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/models/_models_py3.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/models/_paged_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/operations/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/operations/_activity_log_alerts_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/version.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_configuration.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_monitor_management_client.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/_models_py3.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/_monitor_management_client_enums.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/_paged_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/_action_groups_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/_activity_log_alerts_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/version.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_configuration.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_monitor_management_client.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_models_py3.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_monitor_management_client_enums.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_paged_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_diagnostic_settings_category_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_diagnostic_settings_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_metric_definitions_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_metrics_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/version.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_configuration.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_monitor_management_client.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_models_py3.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_monitor_management_client_enums.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/operations/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/operations/_metric_baseline_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/version.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_configuration.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_monitor_management_client.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/_models_py3.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/_paged_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/operations/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/operations/_metric_namespaces_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/version.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_configuration.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_monitor_management_client.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_models_py3.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_monitor_management_client_enums.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_paged_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/operations/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/operations/_metric_definitions_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/operations/_metrics_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/version.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_configuration.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_monitor_management_client.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models_py3.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_monitor_management_client_enums.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_paged_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_action_groups_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_metric_alerts_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_metric_alerts_status_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/version.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_configuration.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_monitor_client.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_models_py3.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_monitor_client_enums.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_paged_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/operations/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/operations/_scheduled_query_rules_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/version.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_configuration.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_monitor_management_client.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/_models_py3.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/_paged_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/operations/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/operations/_guest_diagnostics_settings_association_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/operations/_guest_diagnostics_settings_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/version.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_configuration.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_monitor_management_client.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_models_py3.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_monitor_management_client_enums.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_paged_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_action_groups_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_baseline_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_metric_baseline_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/version.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_configuration.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_monitor_management_client.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/_models_py3.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/_monitor_management_client_enums.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/operations/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/operations/_vm_insights_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/version.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_configuration.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_monitor_management_client.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/_models_py3.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/_monitor_management_client_enums.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/_paged_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/_action_groups_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/_baselines_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/version.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_configuration.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_monitor_management_client.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/_models_py3.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/_monitor_management_client_enums.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/_paged_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/operations/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/operations/_action_groups_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/version.py diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/__init__.py index d45e80c75a79..8e97360e5ffb 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/__init__.py @@ -9,10 +9,11 @@ # regenerated. # -------------------------------------------------------------------------- -from .monitor_management_client import MonitorManagementClient -from .version import VERSION +from ._configuration import MonitorManagementClientConfiguration +from ._monitor_management_client import MonitorManagementClient +__all__ = ['MonitorManagementClient', 'MonitorManagementClientConfiguration'] -__all__ = ['MonitorManagementClient'] +from .version import VERSION __version__ = VERSION diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_configuration.py new file mode 100644 index 000000000000..88436f6b4a33 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_configuration.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 msrestazure import AzureConfiguration + +from .version import VERSION + + +class MonitorManagementClientConfiguration(AzureConfiguration): + """Configuration for MonitorManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription Id. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(MonitorManagementClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-monitor/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_management_client.py new file mode 100644 index 000000000000..8e1de7be8c7f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_management_client.py @@ -0,0 +1,526 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from azure.profiles import KnownProfiles, ProfileDefinition +from azure.profiles.multiapiclient import MultiApiClientMixin +from ._configuration import MonitorManagementClientConfiguration + + + +class MonitorManagementClient(MultiApiClientMixin, SDKClient): + """Monitor Management Client + + This ready contains multiple API versions, to help you deal with all Azure clouds + (Azure Stack, Azure Government, Azure China, etc.). + By default, uses latest API version available on public Azure. + For production, you should stick a particular api-version and/or profile. + The profile sets a mapping between the operation group and an API version. + The api-version parameter sets the default API version if the operation + group is not described in the profile. + + :ivar config: Configuration for client. + :vartype config: MonitorManagementClientConfiguration + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Subscription credentials which uniquely identify + Microsoft Azure subscription. The subscription ID forms part of the URI + for every service call. + :type subscription_id: str + :param str api_version: API version to use if no profile is provided, or if + missing in profile. + :param str base_url: Service URL + :param profile: A profile definition, from KnownProfiles to dict. + :type profile: azure.profiles.KnownProfiles + """ + + DEFAULT_API_VERSION = '2019-06-01' + _PROFILE_TAG = "azure.mgmt.monitor.MonitorManagementClient" + LATEST_PROFILE = ProfileDefinition({ + _PROFILE_TAG: { + None: DEFAULT_API_VERSION, + 'activity_log_alerts': '2017-04-01', + 'activity_logs': '2015-04-01', + 'alert_rule_incidents': '2016-03-01', + 'alert_rules': '2016-03-01', + 'autoscale_settings': '2015-04-01', + 'baseline': '2018-09-01', + 'baselines': '2019-03-01', + 'diagnostic_settings': '2017-05-01-preview', + 'diagnostic_settings_category': '2017-05-01-preview', + 'event_categories': '2015-04-01', + 'guest_diagnostics_settings': '2018-06-01-preview', + 'guest_diagnostics_settings_association': '2018-06-01-preview', + 'log_profiles': '2016-03-01', + 'metric_alerts': '2018-03-01', + 'metric_alerts_status': '2018-03-01', + 'metric_baseline': '2018-09-01', + 'metric_definitions': '2018-01-01', + 'metric_namespaces': '2017-12-01-preview', + 'metrics': '2018-01-01', + 'operations': '2015-04-01', + 'scheduled_query_rules': '2018-04-16', + 'service_diagnostic_settings': '2016-09-01', + 'tenant_activity_logs': '2015-04-01', + 'vm_insights': '2018-11-27-preview', + }}, + _PROFILE_TAG + " latest" + ) + + def __init__(self, credentials, subscription_id, api_version=None, base_url=None, profile=KnownProfiles.default): + self.config = MonitorManagementClientConfiguration(credentials, subscription_id, base_url) + super(MonitorManagementClient, self).__init__( + credentials, + self.config, + api_version=api_version, + profile=profile + ) + + @classmethod + def _models_dict(cls, api_version): + return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)} + + @classmethod + def models(cls, api_version=DEFAULT_API_VERSION): + """Module depends on the API version: + + * 2015-04-01: :mod:`v2015_04_01.models` + * 2015-07-01: :mod:`v2015_07_01.models` + * 2016-03-01: :mod:`v2016_03_01.models` + * 2016-09-01: :mod:`v2016_09_01.models` + * 2017-03-01-preview: :mod:`v2017_03_01_preview.models` + * 2017-04-01: :mod:`v2017_04_01.models` + * 2017-05-01-preview: :mod:`v2017_05_01_preview.models` + * 2017-11-01-preview: :mod:`v2017_11_01_preview.models` + * 2017-12-01-preview: :mod:`v2017_12_01_preview.models` + * 2018-01-01: :mod:`v2018_01_01.models` + * 2018-03-01: :mod:`v2018_03_01.models` + * 2018-04-16: :mod:`v2018_04_16.models` + * 2018-06-01-preview: :mod:`v2018_06_01_preview.models` + * 2018-09-01: :mod:`v2018_09_01.models` + * 2018-11-27-preview: :mod:`v2018_11_27_preview.models` + * 2019-03-01: :mod:`v2019_03_01.models` + * 2019-06-01: :mod:`v2019_06_01.models` + """ + if api_version == '2015-04-01': + from .v2015_04_01 import models + return models + elif api_version == '2015-07-01': + from .v2015_07_01 import models + return models + elif api_version == '2016-03-01': + from .v2016_03_01 import models + return models + elif api_version == '2016-09-01': + from .v2016_09_01 import models + return models + elif api_version == '2017-03-01-preview': + from .v2017_03_01_preview import models + return models + elif api_version == '2017-04-01': + from .v2017_04_01 import models + return models + elif api_version == '2017-05-01-preview': + from .v2017_05_01_preview import models + return models + elif api_version == '2017-11-01-preview': + from .v2017_11_01_preview import models + return models + elif api_version == '2017-12-01-preview': + from .v2017_12_01_preview import models + return models + elif api_version == '2018-01-01': + from .v2018_01_01 import models + return models + elif api_version == '2018-03-01': + from .v2018_03_01 import models + return models + elif api_version == '2018-04-16': + from .v2018_04_16 import models + return models + elif api_version == '2018-06-01-preview': + from .v2018_06_01_preview import models + return models + elif api_version == '2018-09-01': + from .v2018_09_01 import models + return models + elif api_version == '2018-11-27-preview': + from .v2018_11_27_preview import models + return models + elif api_version == '2019-03-01': + from .v2019_03_01 import models + return models + elif api_version == '2019-06-01': + from .v2019_06_01 import models + return models + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + + @property + def action_groups(self): + """Instance depends on the API version: + + * 2017-04-01: :class:`ActionGroupsOperations` + * 2018-03-01: :class:`ActionGroupsOperations` + * 2018-09-01: :class:`ActionGroupsOperations` + * 2019-03-01: :class:`ActionGroupsOperations` + * 2019-06-01: :class:`ActionGroupsOperations` + """ + api_version = self._get_api_version('action_groups') + if api_version == '2017-04-01': + from .v2017_04_01.operations import ActionGroupsOperations as OperationClass + elif api_version == '2018-03-01': + from .v2018_03_01.operations import ActionGroupsOperations as OperationClass + elif api_version == '2018-09-01': + from .v2018_09_01.operations import ActionGroupsOperations as OperationClass + elif api_version == '2019-03-01': + from .v2019_03_01.operations import ActionGroupsOperations as OperationClass + elif api_version == '2019-06-01': + from .v2019_06_01.operations import ActionGroupsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def activity_log_alerts(self): + """Instance depends on the API version: + + * 2017-03-01-preview: :class:`ActivityLogAlertsOperations` + * 2017-04-01: :class:`ActivityLogAlertsOperations` + """ + api_version = self._get_api_version('activity_log_alerts') + if api_version == '2017-03-01-preview': + from .v2017_03_01_preview.operations import ActivityLogAlertsOperations as OperationClass + elif api_version == '2017-04-01': + from .v2017_04_01.operations import ActivityLogAlertsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def activity_logs(self): + """Instance depends on the API version: + + * 2015-04-01: :class:`ActivityLogsOperations` + """ + api_version = self._get_api_version('activity_logs') + if api_version == '2015-04-01': + from .v2015_04_01.operations import ActivityLogsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def alert_rule_incidents(self): + """Instance depends on the API version: + + * 2016-03-01: :class:`AlertRuleIncidentsOperations` + """ + api_version = self._get_api_version('alert_rule_incidents') + if api_version == '2016-03-01': + from .v2016_03_01.operations import AlertRuleIncidentsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def alert_rules(self): + """Instance depends on the API version: + + * 2016-03-01: :class:`AlertRulesOperations` + """ + api_version = self._get_api_version('alert_rules') + if api_version == '2016-03-01': + from .v2016_03_01.operations import AlertRulesOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def autoscale_settings(self): + """Instance depends on the API version: + + * 2015-04-01: :class:`AutoscaleSettingsOperations` + """ + api_version = self._get_api_version('autoscale_settings') + if api_version == '2015-04-01': + from .v2015_04_01.operations import AutoscaleSettingsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def baseline(self): + """Instance depends on the API version: + + * 2018-09-01: :class:`BaselineOperations` + """ + api_version = self._get_api_version('baseline') + if api_version == '2018-09-01': + from .v2018_09_01.operations import BaselineOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def baselines(self): + """Instance depends on the API version: + + * 2019-03-01: :class:`BaselinesOperations` + """ + api_version = self._get_api_version('baselines') + if api_version == '2019-03-01': + from .v2019_03_01.operations import BaselinesOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def diagnostic_settings(self): + """Instance depends on the API version: + + * 2017-05-01-preview: :class:`DiagnosticSettingsOperations` + """ + api_version = self._get_api_version('diagnostic_settings') + if api_version == '2017-05-01-preview': + from .v2017_05_01_preview.operations import DiagnosticSettingsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def diagnostic_settings_category(self): + """Instance depends on the API version: + + * 2017-05-01-preview: :class:`DiagnosticSettingsCategoryOperations` + """ + api_version = self._get_api_version('diagnostic_settings_category') + if api_version == '2017-05-01-preview': + from .v2017_05_01_preview.operations import DiagnosticSettingsCategoryOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def event_categories(self): + """Instance depends on the API version: + + * 2015-04-01: :class:`EventCategoriesOperations` + """ + api_version = self._get_api_version('event_categories') + if api_version == '2015-04-01': + from .v2015_04_01.operations import EventCategoriesOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def guest_diagnostics_settings(self): + """Instance depends on the API version: + + * 2018-06-01-preview: :class:`GuestDiagnosticsSettingsOperations` + """ + api_version = self._get_api_version('guest_diagnostics_settings') + if api_version == '2018-06-01-preview': + from .v2018_06_01_preview.operations import GuestDiagnosticsSettingsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def guest_diagnostics_settings_association(self): + """Instance depends on the API version: + + * 2018-06-01-preview: :class:`GuestDiagnosticsSettingsAssociationOperations` + """ + api_version = self._get_api_version('guest_diagnostics_settings_association') + if api_version == '2018-06-01-preview': + from .v2018_06_01_preview.operations import GuestDiagnosticsSettingsAssociationOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def log_profiles(self): + """Instance depends on the API version: + + * 2016-03-01: :class:`LogProfilesOperations` + """ + api_version = self._get_api_version('log_profiles') + if api_version == '2016-03-01': + from .v2016_03_01.operations import LogProfilesOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def metric_alerts(self): + """Instance depends on the API version: + + * 2018-03-01: :class:`MetricAlertsOperations` + """ + api_version = self._get_api_version('metric_alerts') + if api_version == '2018-03-01': + from .v2018_03_01.operations import MetricAlertsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def metric_alerts_status(self): + """Instance depends on the API version: + + * 2018-03-01: :class:`MetricAlertsStatusOperations` + """ + api_version = self._get_api_version('metric_alerts_status') + if api_version == '2018-03-01': + from .v2018_03_01.operations import MetricAlertsStatusOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def metric_baseline(self): + """Instance depends on the API version: + + * 2017-11-01-preview: :class:`MetricBaselineOperations` + * 2018-09-01: :class:`MetricBaselineOperations` + """ + api_version = self._get_api_version('metric_baseline') + if api_version == '2017-11-01-preview': + from .v2017_11_01_preview.operations import MetricBaselineOperations as OperationClass + elif api_version == '2018-09-01': + from .v2018_09_01.operations import MetricBaselineOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def metric_definitions(self): + """Instance depends on the API version: + + * 2016-03-01: :class:`MetricDefinitionsOperations` + * 2017-05-01-preview: :class:`MetricDefinitionsOperations` + * 2018-01-01: :class:`MetricDefinitionsOperations` + """ + api_version = self._get_api_version('metric_definitions') + if api_version == '2016-03-01': + from .v2016_03_01.operations import MetricDefinitionsOperations as OperationClass + elif api_version == '2017-05-01-preview': + from .v2017_05_01_preview.operations import MetricDefinitionsOperations as OperationClass + elif api_version == '2018-01-01': + from .v2018_01_01.operations import MetricDefinitionsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def metric_namespaces(self): + """Instance depends on the API version: + + * 2017-12-01-preview: :class:`MetricNamespacesOperations` + """ + api_version = self._get_api_version('metric_namespaces') + if api_version == '2017-12-01-preview': + from .v2017_12_01_preview.operations import MetricNamespacesOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def metrics(self): + """Instance depends on the API version: + + * 2016-09-01: :class:`MetricsOperations` + * 2017-05-01-preview: :class:`MetricsOperations` + * 2018-01-01: :class:`MetricsOperations` + """ + api_version = self._get_api_version('metrics') + if api_version == '2016-09-01': + from .v2016_09_01.operations import MetricsOperations as OperationClass + elif api_version == '2017-05-01-preview': + from .v2017_05_01_preview.operations import MetricsOperations as OperationClass + elif api_version == '2018-01-01': + from .v2018_01_01.operations import MetricsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def operations(self): + """Instance depends on the API version: + + * 2015-04-01: :class:`Operations` + """ + api_version = self._get_api_version('operations') + if api_version == '2015-04-01': + from .v2015_04_01.operations import Operations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def scheduled_query_rules(self): + """Instance depends on the API version: + + * 2018-04-16: :class:`ScheduledQueryRulesOperations` + """ + api_version = self._get_api_version('scheduled_query_rules') + if api_version == '2018-04-16': + from .v2018_04_16.operations import ScheduledQueryRulesOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def service_diagnostic_settings(self): + """Instance depends on the API version: + + * 2015-07-01: :class:`ServiceDiagnosticSettingsOperations` + * 2016-09-01: :class:`ServiceDiagnosticSettingsOperations` + """ + api_version = self._get_api_version('service_diagnostic_settings') + if api_version == '2015-07-01': + from .v2015_07_01.operations import ServiceDiagnosticSettingsOperations as OperationClass + elif api_version == '2016-09-01': + from .v2016_09_01.operations import ServiceDiagnosticSettingsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def tenant_activity_logs(self): + """Instance depends on the API version: + + * 2015-04-01: :class:`TenantActivityLogsOperations` + """ + api_version = self._get_api_version('tenant_activity_logs') + if api_version == '2015-04-01': + from .v2015_04_01.operations import TenantActivityLogsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def vm_insights(self): + """Instance depends on the API version: + + * 2018-11-27-preview: :class:`VMInsightsOperations` + """ + api_version = self._get_api_version('vm_insights') + if api_version == '2018-11-27-preview': + from .v2018_11_27_preview.operations import VMInsightsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models.py new file mode 100644 index 000000000000..078f7216425a --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models.py @@ -0,0 +1,20 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +from .v2015_04_01.models import * +from .v2016_03_01.models import * +from .v2016_09_01.models import * +from .v2017_04_01.models import * +from .v2017_05_01_preview.models import * +from .v2017_12_01_preview.models import * +from .v2018_01_01.models import * +from .v2018_03_01.models import * +from .v2018_04_16.models import * +from .v2018_06_01_preview.models import * +from .v2018_09_01.models import * +from .v2018_11_27_preview.models import * +from .v2019_03_01.models import * +from .v2019_06_01.models import * diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/__init__.py new file mode 100644 index 000000000000..8e97360e5ffb --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._configuration import MonitorManagementClientConfiguration +from ._monitor_management_client import MonitorManagementClient +__all__ = ['MonitorManagementClient', 'MonitorManagementClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_configuration.py new file mode 100644 index 000000000000..88436f6b4a33 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_configuration.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 msrestazure import AzureConfiguration + +from .version import VERSION + + +class MonitorManagementClientConfiguration(AzureConfiguration): + """Configuration for MonitorManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription Id. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(MonitorManagementClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-monitor/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_monitor_management_client.py new file mode 100644 index 000000000000..e0a4c78ae87a --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_monitor_management_client.py @@ -0,0 +1,69 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import MonitorManagementClientConfiguration +from .operations import ActivityLogsOperations +from .operations import AutoscaleSettingsOperations +from .operations import EventCategoriesOperations +from .operations import Operations +from .operations import TenantActivityLogsOperations +from . import models + + +class MonitorManagementClient(SDKClient): + """Monitor Management Client + + :ivar config: Configuration for client. + :vartype config: MonitorManagementClientConfiguration + + :ivar activity_logs: ActivityLogs operations + :vartype activity_logs: azure.mgmt.monitor.v2015_04_01.operations.ActivityLogsOperations + :ivar autoscale_settings: AutoscaleSettings operations + :vartype autoscale_settings: azure.mgmt.monitor.v2015_04_01.operations.AutoscaleSettingsOperations + :ivar event_categories: EventCategories operations + :vartype event_categories: azure.mgmt.monitor.v2015_04_01.operations.EventCategoriesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.monitor.v2015_04_01.operations.Operations + :ivar tenant_activity_logs: TenantActivityLogs operations + :vartype tenant_activity_logs: azure.mgmt.monitor.v2015_04_01.operations.TenantActivityLogsOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription Id. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = MonitorManagementClientConfiguration(credentials, subscription_id, base_url) + super(MonitorManagementClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2015-04-01' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.activity_logs = ActivityLogsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.autoscale_settings = AutoscaleSettingsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.event_categories = EventCategoriesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) + self.tenant_activity_logs = TenantActivityLogsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/__init__.py new file mode 100644 index 000000000000..702f8f003ca3 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/__init__.py @@ -0,0 +1,104 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AutoscaleNotification + from ._models_py3 import AutoscaleProfile + from ._models_py3 import AutoscaleSettingResource + from ._models_py3 import AutoscaleSettingResourcePatch + from ._models_py3 import EmailNotification + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import EventData + from ._models_py3 import HttpRequestInfo + from ._models_py3 import LocalizableString + from ._models_py3 import MetricTrigger + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult + from ._models_py3 import Recurrence + from ._models_py3 import RecurrentSchedule + from ._models_py3 import Resource + from ._models_py3 import ScaleAction + from ._models_py3 import ScaleCapacity + from ._models_py3 import ScaleRule + from ._models_py3 import SenderAuthorization + from ._models_py3 import TimeWindow + from ._models_py3 import WebhookNotification +except (SyntaxError, ImportError): + from ._models import AutoscaleNotification + from ._models import AutoscaleProfile + from ._models import AutoscaleSettingResource + from ._models import AutoscaleSettingResourcePatch + from ._models import EmailNotification + from ._models import ErrorResponse, ErrorResponseException + from ._models import EventData + from ._models import HttpRequestInfo + from ._models import LocalizableString + from ._models import MetricTrigger + from ._models import Operation + from ._models import OperationDisplay + from ._models import OperationListResult + from ._models import Recurrence + from ._models import RecurrentSchedule + from ._models import Resource + from ._models import ScaleAction + from ._models import ScaleCapacity + from ._models import ScaleRule + from ._models import SenderAuthorization + from ._models import TimeWindow + from ._models import WebhookNotification +from ._paged_models import AutoscaleSettingResourcePaged +from ._paged_models import EventDataPaged +from ._paged_models import LocalizableStringPaged +from ._monitor_management_client_enums import ( + EventLevel, + MetricStatisticType, + TimeAggregationType, + ComparisonOperationType, + ScaleDirection, + ScaleType, + RecurrenceFrequency, +) + +__all__ = [ + 'AutoscaleNotification', + 'AutoscaleProfile', + 'AutoscaleSettingResource', + 'AutoscaleSettingResourcePatch', + 'EmailNotification', + 'ErrorResponse', 'ErrorResponseException', + 'EventData', + 'HttpRequestInfo', + 'LocalizableString', + 'MetricTrigger', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'Recurrence', + 'RecurrentSchedule', + 'Resource', + 'ScaleAction', + 'ScaleCapacity', + 'ScaleRule', + 'SenderAuthorization', + 'TimeWindow', + 'WebhookNotification', + 'EventDataPaged', + 'AutoscaleSettingResourcePaged', + 'LocalizableStringPaged', + 'EventLevel', + 'MetricStatisticType', + 'TimeAggregationType', + 'ComparisonOperationType', + 'ScaleDirection', + 'ScaleType', + 'RecurrenceFrequency', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_models.py new file mode 100644 index 000000000000..a6afb8ed292a --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_models.py @@ -0,0 +1,1033 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class AutoscaleNotification(Model): + """Autoscale notification. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar operation: Required. the operation associated with the notification + and its value must be "scale". Default value: "Scale" . + :vartype operation: str + :param email: the email notification. + :type email: ~azure.mgmt.monitor.v2015_04_01.models.EmailNotification + :param webhooks: the collection of webhook notifications. + :type webhooks: + list[~azure.mgmt.monitor.v2015_04_01.models.WebhookNotification] + """ + + _validation = { + 'operation': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'operation': {'key': 'operation', 'type': 'str'}, + 'email': {'key': 'email', 'type': 'EmailNotification'}, + 'webhooks': {'key': 'webhooks', 'type': '[WebhookNotification]'}, + } + + operation = "Scale" + + def __init__(self, **kwargs): + super(AutoscaleNotification, self).__init__(**kwargs) + self.email = kwargs.get('email', None) + self.webhooks = kwargs.get('webhooks', None) + + +class AutoscaleProfile(Model): + """Autoscale profile. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. the name of the profile. + :type name: str + :param capacity: Required. the number of instances that can be used during + this profile. + :type capacity: ~azure.mgmt.monitor.v2015_04_01.models.ScaleCapacity + :param rules: Required. the collection of rules that provide the triggers + and parameters for the scaling action. A maximum of 10 rules can be + specified. + :type rules: list[~azure.mgmt.monitor.v2015_04_01.models.ScaleRule] + :param fixed_date: the specific date-time for the profile. This element is + not used if the Recurrence element is used. + :type fixed_date: ~azure.mgmt.monitor.v2015_04_01.models.TimeWindow + :param recurrence: the repeating times at which this profile begins. This + element is not used if the FixedDate element is used. + :type recurrence: ~azure.mgmt.monitor.v2015_04_01.models.Recurrence + """ + + _validation = { + 'name': {'required': True}, + 'capacity': {'required': True}, + 'rules': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'ScaleCapacity'}, + 'rules': {'key': 'rules', 'type': '[ScaleRule]'}, + 'fixed_date': {'key': 'fixedDate', 'type': 'TimeWindow'}, + 'recurrence': {'key': 'recurrence', 'type': 'Recurrence'}, + } + + def __init__(self, **kwargs): + super(AutoscaleProfile, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.capacity = kwargs.get('capacity', None) + self.rules = kwargs.get('rules', None) + self.fixed_date = kwargs.get('fixed_date', None) + self.recurrence = kwargs.get('recurrence', None) + + +class Resource(Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class AutoscaleSettingResource(Resource): + """The autoscale setting resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param profiles: Required. the collection of automatic scaling profiles + that specify different scaling parameters for different time periods. A + maximum of 20 profiles can be specified. + :type profiles: + list[~azure.mgmt.monitor.v2015_04_01.models.AutoscaleProfile] + :param notifications: the collection of notifications. + :type notifications: + list[~azure.mgmt.monitor.v2015_04_01.models.AutoscaleNotification] + :param enabled: the enabled flag. Specifies whether automatic scaling is + enabled for the resource. The default value is 'true'. Default value: True + . + :type enabled: bool + :param autoscale_setting_resource_name: the name of the autoscale setting. + :type autoscale_setting_resource_name: str + :param target_resource_uri: the resource identifier of the resource that + the autoscale setting should be added to. + :type target_resource_uri: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'profiles': {'required': True, 'max_items': 20}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'profiles': {'key': 'properties.profiles', 'type': '[AutoscaleProfile]'}, + 'notifications': {'key': 'properties.notifications', 'type': '[AutoscaleNotification]'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'autoscale_setting_resource_name': {'key': 'properties.name', 'type': 'str'}, + 'target_resource_uri': {'key': 'properties.targetResourceUri', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AutoscaleSettingResource, self).__init__(**kwargs) + self.profiles = kwargs.get('profiles', None) + self.notifications = kwargs.get('notifications', None) + self.enabled = kwargs.get('enabled', True) + self.autoscale_setting_resource_name = kwargs.get('autoscale_setting_resource_name', None) + self.target_resource_uri = kwargs.get('target_resource_uri', None) + + +class AutoscaleSettingResourcePatch(Model): + """The autoscale setting object for patch operations. + + All required parameters must be populated in order to send to Azure. + + :param tags: Resource tags + :type tags: dict[str, str] + :param profiles: Required. the collection of automatic scaling profiles + that specify different scaling parameters for different time periods. A + maximum of 20 profiles can be specified. + :type profiles: + list[~azure.mgmt.monitor.v2015_04_01.models.AutoscaleProfile] + :param notifications: the collection of notifications. + :type notifications: + list[~azure.mgmt.monitor.v2015_04_01.models.AutoscaleNotification] + :param enabled: the enabled flag. Specifies whether automatic scaling is + enabled for the resource. The default value is 'true'. Default value: True + . + :type enabled: bool + :param name: the name of the autoscale setting. + :type name: str + :param target_resource_uri: the resource identifier of the resource that + the autoscale setting should be added to. + :type target_resource_uri: str + """ + + _validation = { + 'profiles': {'required': True, 'max_items': 20}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'profiles': {'key': 'properties.profiles', 'type': '[AutoscaleProfile]'}, + 'notifications': {'key': 'properties.notifications', 'type': '[AutoscaleNotification]'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'name': {'key': 'properties.name', 'type': 'str'}, + 'target_resource_uri': {'key': 'properties.targetResourceUri', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AutoscaleSettingResourcePatch, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.profiles = kwargs.get('profiles', None) + self.notifications = kwargs.get('notifications', None) + self.enabled = kwargs.get('enabled', True) + self.name = kwargs.get('name', None) + self.target_resource_uri = kwargs.get('target_resource_uri', None) + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class EmailNotification(Model): + """Email notification of an autoscale event. + + :param send_to_subscription_administrator: a value indicating whether to + send email to subscription administrator. + :type send_to_subscription_administrator: bool + :param send_to_subscription_co_administrators: a value indicating whether + to send email to subscription co-administrators. + :type send_to_subscription_co_administrators: bool + :param custom_emails: the custom e-mails list. This value can be null or + empty, in which case this attribute will be ignored. + :type custom_emails: list[str] + """ + + _attribute_map = { + 'send_to_subscription_administrator': {'key': 'sendToSubscriptionAdministrator', 'type': 'bool'}, + 'send_to_subscription_co_administrators': {'key': 'sendToSubscriptionCoAdministrators', 'type': 'bool'}, + 'custom_emails': {'key': 'customEmails', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(EmailNotification, self).__init__(**kwargs) + self.send_to_subscription_administrator = kwargs.get('send_to_subscription_administrator', None) + self.send_to_subscription_co_administrators = kwargs.get('send_to_subscription_co_administrators', None) + self.custom_emails = kwargs.get('custom_emails', None) + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class EventData(Model): + """The Azure event log entries are of type EventData. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar authorization: The sender authorization information. + :vartype authorization: + ~azure.mgmt.monitor.v2015_04_01.models.SenderAuthorization + :ivar claims: key value pairs to identify ARM permissions. + :vartype claims: dict[str, str] + :ivar caller: the email address of the user who has performed the + operation, the UPN claim or SPN claim based on availability. + :vartype caller: str + :ivar description: the description of the event. + :vartype description: str + :ivar id: the Id of this event as required by ARM for RBAC. It contains + the EventDataID and a timestamp information. + :vartype id: str + :ivar event_data_id: the event data Id. This is a unique identifier for an + event. + :vartype event_data_id: str + :ivar correlation_id: the correlation Id, usually a GUID in the string + format. The correlation Id is shared among the events that belong to the + same uber operation. + :vartype correlation_id: str + :ivar event_name: the event name. This value should not be confused with + OperationName. For practical purposes, OperationName might be more + appealing to end users. + :vartype event_name: + ~azure.mgmt.monitor.v2015_04_01.models.LocalizableString + :ivar category: the event category. + :vartype category: + ~azure.mgmt.monitor.v2015_04_01.models.LocalizableString + :ivar http_request: the HTTP request info. Usually includes the + 'clientRequestId', 'clientIpAddress' (IP address of the user who initiated + the event) and 'method' (HTTP method e.g. PUT). + :vartype http_request: + ~azure.mgmt.monitor.v2015_04_01.models.HttpRequestInfo + :ivar level: the event level. Possible values include: 'Critical', + 'Error', 'Warning', 'Informational', 'Verbose' + :vartype level: str or ~azure.mgmt.monitor.v2015_04_01.models.EventLevel + :ivar resource_group_name: the resource group name of the impacted + resource. + :vartype resource_group_name: str + :ivar resource_provider_name: the resource provider name of the impacted + resource. + :vartype resource_provider_name: + ~azure.mgmt.monitor.v2015_04_01.models.LocalizableString + :ivar resource_id: the resource uri that uniquely identifies the resource + that caused this event. + :vartype resource_id: str + :ivar resource_type: the resource type + :vartype resource_type: + ~azure.mgmt.monitor.v2015_04_01.models.LocalizableString + :ivar operation_id: It is usually a GUID shared among the events + corresponding to single operation. This value should not be confused with + EventName. + :vartype operation_id: str + :ivar operation_name: the operation name. + :vartype operation_name: + ~azure.mgmt.monitor.v2015_04_01.models.LocalizableString + :ivar properties: the set of pairs (usually a + Dictionary) that includes details about the event. + :vartype properties: dict[str, str] + :ivar status: a string describing the status of the operation. Some + typical values are: Started, In progress, Succeeded, Failed, Resolved. + :vartype status: ~azure.mgmt.monitor.v2015_04_01.models.LocalizableString + :ivar sub_status: the event sub status. Most of the time, when included, + this captures the HTTP status code of the REST call. Common values are: OK + (HTTP Status Code: 200), Created (HTTP Status Code: 201), Accepted (HTTP + Status Code: 202), No Content (HTTP Status Code: 204), Bad Request(HTTP + Status Code: 400), Not Found (HTTP Status Code: 404), Conflict (HTTP + Status Code: 409), Internal Server Error (HTTP Status Code: 500), Service + Unavailable (HTTP Status Code:503), Gateway Timeout (HTTP Status Code: + 504) + :vartype sub_status: + ~azure.mgmt.monitor.v2015_04_01.models.LocalizableString + :ivar event_timestamp: the timestamp of when the event was generated by + the Azure service processing the request corresponding the event. It in + ISO 8601 format. + :vartype event_timestamp: datetime + :ivar submission_timestamp: the timestamp of when the event became + available for querying via this API. It is in ISO 8601 format. This value + should not be confused eventTimestamp. As there might be a delay between + the occurrence time of the event, and the time that the event is submitted + to the Azure logging infrastructure. + :vartype submission_timestamp: datetime + :ivar subscription_id: the Azure subscription Id usually a GUID. + :vartype subscription_id: str + :ivar tenant_id: the Azure tenant Id + :vartype tenant_id: str + """ + + _validation = { + 'authorization': {'readonly': True}, + 'claims': {'readonly': True}, + 'caller': {'readonly': True}, + 'description': {'readonly': True}, + 'id': {'readonly': True}, + 'event_data_id': {'readonly': True}, + 'correlation_id': {'readonly': True}, + 'event_name': {'readonly': True}, + 'category': {'readonly': True}, + 'http_request': {'readonly': True}, + 'level': {'readonly': True}, + 'resource_group_name': {'readonly': True}, + 'resource_provider_name': {'readonly': True}, + 'resource_id': {'readonly': True}, + 'resource_type': {'readonly': True}, + 'operation_id': {'readonly': True}, + 'operation_name': {'readonly': True}, + 'properties': {'readonly': True}, + 'status': {'readonly': True}, + 'sub_status': {'readonly': True}, + 'event_timestamp': {'readonly': True}, + 'submission_timestamp': {'readonly': True}, + 'subscription_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'authorization': {'key': 'authorization', 'type': 'SenderAuthorization'}, + 'claims': {'key': 'claims', 'type': '{str}'}, + 'caller': {'key': 'caller', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'event_data_id': {'key': 'eventDataId', 'type': 'str'}, + 'correlation_id': {'key': 'correlationId', 'type': 'str'}, + 'event_name': {'key': 'eventName', 'type': 'LocalizableString'}, + 'category': {'key': 'category', 'type': 'LocalizableString'}, + 'http_request': {'key': 'httpRequest', 'type': 'HttpRequestInfo'}, + 'level': {'key': 'level', 'type': 'EventLevel'}, + 'resource_group_name': {'key': 'resourceGroupName', 'type': 'str'}, + 'resource_provider_name': {'key': 'resourceProviderName', 'type': 'LocalizableString'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'LocalizableString'}, + 'operation_id': {'key': 'operationId', 'type': 'str'}, + 'operation_name': {'key': 'operationName', 'type': 'LocalizableString'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'status': {'key': 'status', 'type': 'LocalizableString'}, + 'sub_status': {'key': 'subStatus', 'type': 'LocalizableString'}, + 'event_timestamp': {'key': 'eventTimestamp', 'type': 'iso-8601'}, + 'submission_timestamp': {'key': 'submissionTimestamp', 'type': 'iso-8601'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(EventData, self).__init__(**kwargs) + self.authorization = None + self.claims = None + self.caller = None + self.description = None + self.id = None + self.event_data_id = None + self.correlation_id = None + self.event_name = None + self.category = None + self.http_request = None + self.level = None + self.resource_group_name = None + self.resource_provider_name = None + self.resource_id = None + self.resource_type = None + self.operation_id = None + self.operation_name = None + self.properties = None + self.status = None + self.sub_status = None + self.event_timestamp = None + self.submission_timestamp = None + self.subscription_id = None + self.tenant_id = None + + +class HttpRequestInfo(Model): + """The Http request info. + + :param client_request_id: the client request id. + :type client_request_id: str + :param client_ip_address: the client Ip Address + :type client_ip_address: str + :param method: the Http request method. + :type method: str + :param uri: the Uri. + :type uri: str + """ + + _attribute_map = { + 'client_request_id': {'key': 'clientRequestId', 'type': 'str'}, + 'client_ip_address': {'key': 'clientIpAddress', 'type': 'str'}, + 'method': {'key': 'method', 'type': 'str'}, + 'uri': {'key': 'uri', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(HttpRequestInfo, self).__init__(**kwargs) + self.client_request_id = kwargs.get('client_request_id', None) + self.client_ip_address = kwargs.get('client_ip_address', None) + self.method = kwargs.get('method', None) + self.uri = kwargs.get('uri', None) + + +class LocalizableString(Model): + """The localizable string class. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. the invariant value. + :type value: str + :param localized_value: the locale specific value. + :type localized_value: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(LocalizableString, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.localized_value = kwargs.get('localized_value', None) + + +class MetricTrigger(Model): + """The trigger that results in a scaling action. + + All required parameters must be populated in order to send to Azure. + + :param metric_name: Required. the name of the metric that defines what the + rule monitors. + :type metric_name: str + :param metric_resource_uri: Required. the resource identifier of the + resource the rule monitors. + :type metric_resource_uri: str + :param time_grain: Required. the granularity of metrics the rule monitors. + Must be one of the predefined values returned from metric definitions for + the metric. Must be between 12 hours and 1 minute. + :type time_grain: timedelta + :param statistic: Required. the metric statistic type. How the metrics + from multiple instances are combined. Possible values include: 'Average', + 'Min', 'Max', 'Sum' + :type statistic: str or + ~azure.mgmt.monitor.v2015_04_01.models.MetricStatisticType + :param time_window: Required. the range of time in which instance data is + collected. This value must be greater than the delay in metric collection, + which can vary from resource-to-resource. Must be between 12 hours and 5 + minutes. + :type time_window: timedelta + :param time_aggregation: Required. time aggregation type. How the data + that is collected should be combined over time. The default value is + Average. Possible values include: 'Average', 'Minimum', 'Maximum', + 'Total', 'Count', 'Last' + :type time_aggregation: str or + ~azure.mgmt.monitor.v2015_04_01.models.TimeAggregationType + :param operator: Required. the operator that is used to compare the metric + data and the threshold. Possible values include: 'Equals', 'NotEquals', + 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' + :type operator: str or + ~azure.mgmt.monitor.v2015_04_01.models.ComparisonOperationType + :param threshold: Required. the threshold of the metric that triggers the + scale action. + :type threshold: float + """ + + _validation = { + 'metric_name': {'required': True}, + 'metric_resource_uri': {'required': True}, + 'time_grain': {'required': True}, + 'statistic': {'required': True}, + 'time_window': {'required': True}, + 'time_aggregation': {'required': True}, + 'operator': {'required': True}, + 'threshold': {'required': True}, + } + + _attribute_map = { + 'metric_name': {'key': 'metricName', 'type': 'str'}, + 'metric_resource_uri': {'key': 'metricResourceUri', 'type': 'str'}, + 'time_grain': {'key': 'timeGrain', 'type': 'duration'}, + 'statistic': {'key': 'statistic', 'type': 'MetricStatisticType'}, + 'time_window': {'key': 'timeWindow', 'type': 'duration'}, + 'time_aggregation': {'key': 'timeAggregation', 'type': 'TimeAggregationType'}, + 'operator': {'key': 'operator', 'type': 'ComparisonOperationType'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + } + + def __init__(self, **kwargs): + super(MetricTrigger, self).__init__(**kwargs) + self.metric_name = kwargs.get('metric_name', None) + self.metric_resource_uri = kwargs.get('metric_resource_uri', None) + self.time_grain = kwargs.get('time_grain', None) + self.statistic = kwargs.get('statistic', None) + self.time_window = kwargs.get('time_window', None) + self.time_aggregation = kwargs.get('time_aggregation', None) + self.operator = kwargs.get('operator', None) + self.threshold = kwargs.get('threshold', None) + + +class Operation(Model): + """Microsoft Insights API operation definition. + + :param name: Operation name: {provider}/{resource}/{operation} + :type name: str + :param display: Display metadata associated with the operation. + :type display: ~azure.mgmt.monitor.v2015_04_01.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__(self, **kwargs): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + + +class OperationDisplay(Model): + """Display metadata associated with the operation. + + :param provider: Service provider: Microsoft.Insights + :type provider: str + :param resource: Resource on which the operation is performed: AlertRules, + Autoscale, etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + + +class OperationListResult(Model): + """Result of the request to list Microsoft.Insights operations. It contains a + list of operations and a URL link to get the next set of results. + + :param value: List of operations supported by the Microsoft.Insights + provider. + :type value: list[~azure.mgmt.monitor.v2015_04_01.models.Operation] + :param next_link: URL to get the next set of operation list results if + there are any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OperationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class Recurrence(Model): + """The repeating times at which this profile begins. This element is not used + if the FixedDate element is used. + + All required parameters must be populated in order to send to Azure. + + :param frequency: Required. the recurrence frequency. How often the + schedule profile should take effect. This value must be Week, meaning each + week will have the same set of profiles. For example, to set a daily + schedule, set **schedule** to every day of the week. The frequency + property specifies that the schedule is repeated weekly. Possible values + include: 'None', 'Second', 'Minute', 'Hour', 'Day', 'Week', 'Month', + 'Year' + :type frequency: str or + ~azure.mgmt.monitor.v2015_04_01.models.RecurrenceFrequency + :param schedule: Required. the scheduling constraints for when the profile + begins. + :type schedule: ~azure.mgmt.monitor.v2015_04_01.models.RecurrentSchedule + """ + + _validation = { + 'frequency': {'required': True}, + 'schedule': {'required': True}, + } + + _attribute_map = { + 'frequency': {'key': 'frequency', 'type': 'RecurrenceFrequency'}, + 'schedule': {'key': 'schedule', 'type': 'RecurrentSchedule'}, + } + + def __init__(self, **kwargs): + super(Recurrence, self).__init__(**kwargs) + self.frequency = kwargs.get('frequency', None) + self.schedule = kwargs.get('schedule', None) + + +class RecurrentSchedule(Model): + """The scheduling constraints for when the profile begins. + + All required parameters must be populated in order to send to Azure. + + :param time_zone: Required. the timezone for the hours of the profile. + Some examples of valid time zones are: Dateline Standard Time, UTC-11, + Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time + (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain + Standard Time (Mexico), Mountain Standard Time, Central America Standard + Time, Central Standard Time, Central Standard Time (Mexico), Canada + Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US + Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, + Atlantic Standard Time, Central Brazilian Standard Time, SA Western + Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. + South America Standard Time, Argentina Standard Time, SA Eastern Standard + Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard + Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde + Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich + Standard Time, W. Europe Standard Time, Central Europe Standard Time, + Romance Standard Time, Central European Standard Time, W. Central Africa + Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard + Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, + E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, + Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, + Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus + Standard Time, Russian Standard Time, E. Africa Standard Time, Iran + Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia + Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus + Standard Time, Afghanistan Standard Time, West Asia Standard Time, + Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, + Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, + Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard + Time, SE Asia Standard Time, North Asia Standard Time, China Standard + Time, North Asia East Standard Time, Singapore Standard Time, W. Australia + Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo + Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia + Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS + Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, + Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, + Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard + Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard + Time, Samoa Standard Time, Line Islands Standard Time + :type time_zone: str + :param days: Required. the collection of days that the profile takes + effect on. Possible values are Sunday through Saturday. + :type days: list[str] + :param hours: Required. A collection of hours that the profile takes + effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times + are not supported). + :type hours: list[int] + :param minutes: Required. A collection of minutes at which the profile + takes effect at. + :type minutes: list[int] + """ + + _validation = { + 'time_zone': {'required': True}, + 'days': {'required': True}, + 'hours': {'required': True}, + 'minutes': {'required': True}, + } + + _attribute_map = { + 'time_zone': {'key': 'timeZone', 'type': 'str'}, + 'days': {'key': 'days', 'type': '[str]'}, + 'hours': {'key': 'hours', 'type': '[int]'}, + 'minutes': {'key': 'minutes', 'type': '[int]'}, + } + + def __init__(self, **kwargs): + super(RecurrentSchedule, self).__init__(**kwargs) + self.time_zone = kwargs.get('time_zone', None) + self.days = kwargs.get('days', None) + self.hours = kwargs.get('hours', None) + self.minutes = kwargs.get('minutes', None) + + +class ScaleAction(Model): + """The parameters for the scaling action. + + All required parameters must be populated in order to send to Azure. + + :param direction: Required. the scale direction. Whether the scaling + action increases or decreases the number of instances. Possible values + include: 'None', 'Increase', 'Decrease' + :type direction: str or + ~azure.mgmt.monitor.v2015_04_01.models.ScaleDirection + :param type: Required. the type of action that should occur when the scale + rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', + 'ExactCount' + :type type: str or ~azure.mgmt.monitor.v2015_04_01.models.ScaleType + :param value: the number of instances that are involved in the scaling + action. This value must be 1 or greater. The default value is 1. Default + value: "1" . + :type value: str + :param cooldown: Required. the amount of time to wait since the last + scaling action before this action occurs. It must be between 1 week and 1 + minute in ISO 8601 format. + :type cooldown: timedelta + """ + + _validation = { + 'direction': {'required': True}, + 'type': {'required': True}, + 'cooldown': {'required': True}, + } + + _attribute_map = { + 'direction': {'key': 'direction', 'type': 'ScaleDirection'}, + 'type': {'key': 'type', 'type': 'ScaleType'}, + 'value': {'key': 'value', 'type': 'str'}, + 'cooldown': {'key': 'cooldown', 'type': 'duration'}, + } + + def __init__(self, **kwargs): + super(ScaleAction, self).__init__(**kwargs) + self.direction = kwargs.get('direction', None) + self.type = kwargs.get('type', None) + self.value = kwargs.get('value', "1") + self.cooldown = kwargs.get('cooldown', None) + + +class ScaleCapacity(Model): + """The number of instances that can be used during this profile. + + All required parameters must be populated in order to send to Azure. + + :param minimum: Required. the minimum number of instances for the + resource. + :type minimum: str + :param maximum: Required. the maximum number of instances for the + resource. The actual maximum number of instances is limited by the cores + that are available in the subscription. + :type maximum: str + :param default: Required. the number of instances that will be set if + metrics are not available for evaluation. The default is only used if the + current instance count is lower than the default. + :type default: str + """ + + _validation = { + 'minimum': {'required': True}, + 'maximum': {'required': True}, + 'default': {'required': True}, + } + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'str'}, + 'maximum': {'key': 'maximum', 'type': 'str'}, + 'default': {'key': 'default', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ScaleCapacity, self).__init__(**kwargs) + self.minimum = kwargs.get('minimum', None) + self.maximum = kwargs.get('maximum', None) + self.default = kwargs.get('default', None) + + +class ScaleRule(Model): + """A rule that provide the triggers and parameters for the scaling action. + + All required parameters must be populated in order to send to Azure. + + :param metric_trigger: Required. the trigger that results in a scaling + action. + :type metric_trigger: ~azure.mgmt.monitor.v2015_04_01.models.MetricTrigger + :param scale_action: Required. the parameters for the scaling action. + :type scale_action: ~azure.mgmt.monitor.v2015_04_01.models.ScaleAction + """ + + _validation = { + 'metric_trigger': {'required': True}, + 'scale_action': {'required': True}, + } + + _attribute_map = { + 'metric_trigger': {'key': 'metricTrigger', 'type': 'MetricTrigger'}, + 'scale_action': {'key': 'scaleAction', 'type': 'ScaleAction'}, + } + + def __init__(self, **kwargs): + super(ScaleRule, self).__init__(**kwargs) + self.metric_trigger = kwargs.get('metric_trigger', None) + self.scale_action = kwargs.get('scale_action', None) + + +class SenderAuthorization(Model): + """the authorization used by the user who has performed the operation that led + to this event. This captures the RBAC properties of the event. These + usually include the 'action', 'role' and the 'scope'. + + :param action: the permissible actions. For instance: + microsoft.support/supporttickets/write + :type action: str + :param role: the role of the user. For instance: Subscription Admin + :type role: str + :param scope: the scope. + :type scope: str + """ + + _attribute_map = { + 'action': {'key': 'action', 'type': 'str'}, + 'role': {'key': 'role', 'type': 'str'}, + 'scope': {'key': 'scope', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SenderAuthorization, self).__init__(**kwargs) + self.action = kwargs.get('action', None) + self.role = kwargs.get('role', None) + self.scope = kwargs.get('scope', None) + + +class TimeWindow(Model): + """A specific date-time for the profile. + + All required parameters must be populated in order to send to Azure. + + :param time_zone: the timezone of the start and end times for the profile. + Some examples of valid time zones are: Dateline Standard Time, UTC-11, + Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time + (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain + Standard Time (Mexico), Mountain Standard Time, Central America Standard + Time, Central Standard Time, Central Standard Time (Mexico), Canada + Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US + Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, + Atlantic Standard Time, Central Brazilian Standard Time, SA Western + Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. + South America Standard Time, Argentina Standard Time, SA Eastern Standard + Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard + Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde + Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich + Standard Time, W. Europe Standard Time, Central Europe Standard Time, + Romance Standard Time, Central European Standard Time, W. Central Africa + Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard + Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, + E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, + Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, + Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus + Standard Time, Russian Standard Time, E. Africa Standard Time, Iran + Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia + Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus + Standard Time, Afghanistan Standard Time, West Asia Standard Time, + Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, + Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, + Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard + Time, SE Asia Standard Time, North Asia Standard Time, China Standard + Time, North Asia East Standard Time, Singapore Standard Time, W. Australia + Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo + Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia + Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS + Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, + Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, + Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard + Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard + Time, Samoa Standard Time, Line Islands Standard Time + :type time_zone: str + :param start: Required. the start time for the profile in ISO 8601 format. + :type start: datetime + :param end: Required. the end time for the profile in ISO 8601 format. + :type end: datetime + """ + + _validation = { + 'start': {'required': True}, + 'end': {'required': True}, + } + + _attribute_map = { + 'time_zone': {'key': 'timeZone', 'type': 'str'}, + 'start': {'key': 'start', 'type': 'iso-8601'}, + 'end': {'key': 'end', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(TimeWindow, self).__init__(**kwargs) + self.time_zone = kwargs.get('time_zone', None) + self.start = kwargs.get('start', None) + self.end = kwargs.get('end', None) + + +class WebhookNotification(Model): + """Webhook notification of an autoscale event. + + :param service_uri: the service address to receive the notification. + :type service_uri: str + :param properties: a property bag of settings. This value can be empty. + :type properties: dict[str, str] + """ + + _attribute_map = { + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(WebhookNotification, self).__init__(**kwargs) + self.service_uri = kwargs.get('service_uri', None) + self.properties = kwargs.get('properties', None) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_models_py3.py new file mode 100644 index 000000000000..c6f6b6be2a53 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_models_py3.py @@ -0,0 +1,1033 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class AutoscaleNotification(Model): + """Autoscale notification. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar operation: Required. the operation associated with the notification + and its value must be "scale". Default value: "Scale" . + :vartype operation: str + :param email: the email notification. + :type email: ~azure.mgmt.monitor.v2015_04_01.models.EmailNotification + :param webhooks: the collection of webhook notifications. + :type webhooks: + list[~azure.mgmt.monitor.v2015_04_01.models.WebhookNotification] + """ + + _validation = { + 'operation': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'operation': {'key': 'operation', 'type': 'str'}, + 'email': {'key': 'email', 'type': 'EmailNotification'}, + 'webhooks': {'key': 'webhooks', 'type': '[WebhookNotification]'}, + } + + operation = "Scale" + + def __init__(self, *, email=None, webhooks=None, **kwargs) -> None: + super(AutoscaleNotification, self).__init__(**kwargs) + self.email = email + self.webhooks = webhooks + + +class AutoscaleProfile(Model): + """Autoscale profile. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. the name of the profile. + :type name: str + :param capacity: Required. the number of instances that can be used during + this profile. + :type capacity: ~azure.mgmt.monitor.v2015_04_01.models.ScaleCapacity + :param rules: Required. the collection of rules that provide the triggers + and parameters for the scaling action. A maximum of 10 rules can be + specified. + :type rules: list[~azure.mgmt.monitor.v2015_04_01.models.ScaleRule] + :param fixed_date: the specific date-time for the profile. This element is + not used if the Recurrence element is used. + :type fixed_date: ~azure.mgmt.monitor.v2015_04_01.models.TimeWindow + :param recurrence: the repeating times at which this profile begins. This + element is not used if the FixedDate element is used. + :type recurrence: ~azure.mgmt.monitor.v2015_04_01.models.Recurrence + """ + + _validation = { + 'name': {'required': True}, + 'capacity': {'required': True}, + 'rules': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'ScaleCapacity'}, + 'rules': {'key': 'rules', 'type': '[ScaleRule]'}, + 'fixed_date': {'key': 'fixedDate', 'type': 'TimeWindow'}, + 'recurrence': {'key': 'recurrence', 'type': 'Recurrence'}, + } + + def __init__(self, *, name: str, capacity, rules, fixed_date=None, recurrence=None, **kwargs) -> None: + super(AutoscaleProfile, self).__init__(**kwargs) + self.name = name + self.capacity = capacity + self.rules = rules + self.fixed_date = fixed_date + self.recurrence = recurrence + + +class Resource(Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, location: str, tags=None, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class AutoscaleSettingResource(Resource): + """The autoscale setting resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param profiles: Required. the collection of automatic scaling profiles + that specify different scaling parameters for different time periods. A + maximum of 20 profiles can be specified. + :type profiles: + list[~azure.mgmt.monitor.v2015_04_01.models.AutoscaleProfile] + :param notifications: the collection of notifications. + :type notifications: + list[~azure.mgmt.monitor.v2015_04_01.models.AutoscaleNotification] + :param enabled: the enabled flag. Specifies whether automatic scaling is + enabled for the resource. The default value is 'true'. Default value: True + . + :type enabled: bool + :param autoscale_setting_resource_name: the name of the autoscale setting. + :type autoscale_setting_resource_name: str + :param target_resource_uri: the resource identifier of the resource that + the autoscale setting should be added to. + :type target_resource_uri: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'profiles': {'required': True, 'max_items': 20}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'profiles': {'key': 'properties.profiles', 'type': '[AutoscaleProfile]'}, + 'notifications': {'key': 'properties.notifications', 'type': '[AutoscaleNotification]'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'autoscale_setting_resource_name': {'key': 'properties.name', 'type': 'str'}, + 'target_resource_uri': {'key': 'properties.targetResourceUri', 'type': 'str'}, + } + + def __init__(self, *, location: str, profiles, tags=None, notifications=None, enabled: bool=True, autoscale_setting_resource_name: str=None, target_resource_uri: str=None, **kwargs) -> None: + super(AutoscaleSettingResource, self).__init__(location=location, tags=tags, **kwargs) + self.profiles = profiles + self.notifications = notifications + self.enabled = enabled + self.autoscale_setting_resource_name = autoscale_setting_resource_name + self.target_resource_uri = target_resource_uri + + +class AutoscaleSettingResourcePatch(Model): + """The autoscale setting object for patch operations. + + All required parameters must be populated in order to send to Azure. + + :param tags: Resource tags + :type tags: dict[str, str] + :param profiles: Required. the collection of automatic scaling profiles + that specify different scaling parameters for different time periods. A + maximum of 20 profiles can be specified. + :type profiles: + list[~azure.mgmt.monitor.v2015_04_01.models.AutoscaleProfile] + :param notifications: the collection of notifications. + :type notifications: + list[~azure.mgmt.monitor.v2015_04_01.models.AutoscaleNotification] + :param enabled: the enabled flag. Specifies whether automatic scaling is + enabled for the resource. The default value is 'true'. Default value: True + . + :type enabled: bool + :param name: the name of the autoscale setting. + :type name: str + :param target_resource_uri: the resource identifier of the resource that + the autoscale setting should be added to. + :type target_resource_uri: str + """ + + _validation = { + 'profiles': {'required': True, 'max_items': 20}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'profiles': {'key': 'properties.profiles', 'type': '[AutoscaleProfile]'}, + 'notifications': {'key': 'properties.notifications', 'type': '[AutoscaleNotification]'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'name': {'key': 'properties.name', 'type': 'str'}, + 'target_resource_uri': {'key': 'properties.targetResourceUri', 'type': 'str'}, + } + + def __init__(self, *, profiles, tags=None, notifications=None, enabled: bool=True, name: str=None, target_resource_uri: str=None, **kwargs) -> None: + super(AutoscaleSettingResourcePatch, self).__init__(**kwargs) + self.tags = tags + self.profiles = profiles + self.notifications = notifications + self.enabled = enabled + self.name = name + self.target_resource_uri = target_resource_uri + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class EmailNotification(Model): + """Email notification of an autoscale event. + + :param send_to_subscription_administrator: a value indicating whether to + send email to subscription administrator. + :type send_to_subscription_administrator: bool + :param send_to_subscription_co_administrators: a value indicating whether + to send email to subscription co-administrators. + :type send_to_subscription_co_administrators: bool + :param custom_emails: the custom e-mails list. This value can be null or + empty, in which case this attribute will be ignored. + :type custom_emails: list[str] + """ + + _attribute_map = { + 'send_to_subscription_administrator': {'key': 'sendToSubscriptionAdministrator', 'type': 'bool'}, + 'send_to_subscription_co_administrators': {'key': 'sendToSubscriptionCoAdministrators', 'type': 'bool'}, + 'custom_emails': {'key': 'customEmails', 'type': '[str]'}, + } + + def __init__(self, *, send_to_subscription_administrator: bool=None, send_to_subscription_co_administrators: bool=None, custom_emails=None, **kwargs) -> None: + super(EmailNotification, self).__init__(**kwargs) + self.send_to_subscription_administrator = send_to_subscription_administrator + self.send_to_subscription_co_administrators = send_to_subscription_co_administrators + self.custom_emails = custom_emails + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class EventData(Model): + """The Azure event log entries are of type EventData. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar authorization: The sender authorization information. + :vartype authorization: + ~azure.mgmt.monitor.v2015_04_01.models.SenderAuthorization + :ivar claims: key value pairs to identify ARM permissions. + :vartype claims: dict[str, str] + :ivar caller: the email address of the user who has performed the + operation, the UPN claim or SPN claim based on availability. + :vartype caller: str + :ivar description: the description of the event. + :vartype description: str + :ivar id: the Id of this event as required by ARM for RBAC. It contains + the EventDataID and a timestamp information. + :vartype id: str + :ivar event_data_id: the event data Id. This is a unique identifier for an + event. + :vartype event_data_id: str + :ivar correlation_id: the correlation Id, usually a GUID in the string + format. The correlation Id is shared among the events that belong to the + same uber operation. + :vartype correlation_id: str + :ivar event_name: the event name. This value should not be confused with + OperationName. For practical purposes, OperationName might be more + appealing to end users. + :vartype event_name: + ~azure.mgmt.monitor.v2015_04_01.models.LocalizableString + :ivar category: the event category. + :vartype category: + ~azure.mgmt.monitor.v2015_04_01.models.LocalizableString + :ivar http_request: the HTTP request info. Usually includes the + 'clientRequestId', 'clientIpAddress' (IP address of the user who initiated + the event) and 'method' (HTTP method e.g. PUT). + :vartype http_request: + ~azure.mgmt.monitor.v2015_04_01.models.HttpRequestInfo + :ivar level: the event level. Possible values include: 'Critical', + 'Error', 'Warning', 'Informational', 'Verbose' + :vartype level: str or ~azure.mgmt.monitor.v2015_04_01.models.EventLevel + :ivar resource_group_name: the resource group name of the impacted + resource. + :vartype resource_group_name: str + :ivar resource_provider_name: the resource provider name of the impacted + resource. + :vartype resource_provider_name: + ~azure.mgmt.monitor.v2015_04_01.models.LocalizableString + :ivar resource_id: the resource uri that uniquely identifies the resource + that caused this event. + :vartype resource_id: str + :ivar resource_type: the resource type + :vartype resource_type: + ~azure.mgmt.monitor.v2015_04_01.models.LocalizableString + :ivar operation_id: It is usually a GUID shared among the events + corresponding to single operation. This value should not be confused with + EventName. + :vartype operation_id: str + :ivar operation_name: the operation name. + :vartype operation_name: + ~azure.mgmt.monitor.v2015_04_01.models.LocalizableString + :ivar properties: the set of pairs (usually a + Dictionary) that includes details about the event. + :vartype properties: dict[str, str] + :ivar status: a string describing the status of the operation. Some + typical values are: Started, In progress, Succeeded, Failed, Resolved. + :vartype status: ~azure.mgmt.monitor.v2015_04_01.models.LocalizableString + :ivar sub_status: the event sub status. Most of the time, when included, + this captures the HTTP status code of the REST call. Common values are: OK + (HTTP Status Code: 200), Created (HTTP Status Code: 201), Accepted (HTTP + Status Code: 202), No Content (HTTP Status Code: 204), Bad Request(HTTP + Status Code: 400), Not Found (HTTP Status Code: 404), Conflict (HTTP + Status Code: 409), Internal Server Error (HTTP Status Code: 500), Service + Unavailable (HTTP Status Code:503), Gateway Timeout (HTTP Status Code: + 504) + :vartype sub_status: + ~azure.mgmt.monitor.v2015_04_01.models.LocalizableString + :ivar event_timestamp: the timestamp of when the event was generated by + the Azure service processing the request corresponding the event. It in + ISO 8601 format. + :vartype event_timestamp: datetime + :ivar submission_timestamp: the timestamp of when the event became + available for querying via this API. It is in ISO 8601 format. This value + should not be confused eventTimestamp. As there might be a delay between + the occurrence time of the event, and the time that the event is submitted + to the Azure logging infrastructure. + :vartype submission_timestamp: datetime + :ivar subscription_id: the Azure subscription Id usually a GUID. + :vartype subscription_id: str + :ivar tenant_id: the Azure tenant Id + :vartype tenant_id: str + """ + + _validation = { + 'authorization': {'readonly': True}, + 'claims': {'readonly': True}, + 'caller': {'readonly': True}, + 'description': {'readonly': True}, + 'id': {'readonly': True}, + 'event_data_id': {'readonly': True}, + 'correlation_id': {'readonly': True}, + 'event_name': {'readonly': True}, + 'category': {'readonly': True}, + 'http_request': {'readonly': True}, + 'level': {'readonly': True}, + 'resource_group_name': {'readonly': True}, + 'resource_provider_name': {'readonly': True}, + 'resource_id': {'readonly': True}, + 'resource_type': {'readonly': True}, + 'operation_id': {'readonly': True}, + 'operation_name': {'readonly': True}, + 'properties': {'readonly': True}, + 'status': {'readonly': True}, + 'sub_status': {'readonly': True}, + 'event_timestamp': {'readonly': True}, + 'submission_timestamp': {'readonly': True}, + 'subscription_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'authorization': {'key': 'authorization', 'type': 'SenderAuthorization'}, + 'claims': {'key': 'claims', 'type': '{str}'}, + 'caller': {'key': 'caller', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'event_data_id': {'key': 'eventDataId', 'type': 'str'}, + 'correlation_id': {'key': 'correlationId', 'type': 'str'}, + 'event_name': {'key': 'eventName', 'type': 'LocalizableString'}, + 'category': {'key': 'category', 'type': 'LocalizableString'}, + 'http_request': {'key': 'httpRequest', 'type': 'HttpRequestInfo'}, + 'level': {'key': 'level', 'type': 'EventLevel'}, + 'resource_group_name': {'key': 'resourceGroupName', 'type': 'str'}, + 'resource_provider_name': {'key': 'resourceProviderName', 'type': 'LocalizableString'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'LocalizableString'}, + 'operation_id': {'key': 'operationId', 'type': 'str'}, + 'operation_name': {'key': 'operationName', 'type': 'LocalizableString'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'status': {'key': 'status', 'type': 'LocalizableString'}, + 'sub_status': {'key': 'subStatus', 'type': 'LocalizableString'}, + 'event_timestamp': {'key': 'eventTimestamp', 'type': 'iso-8601'}, + 'submission_timestamp': {'key': 'submissionTimestamp', 'type': 'iso-8601'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(EventData, self).__init__(**kwargs) + self.authorization = None + self.claims = None + self.caller = None + self.description = None + self.id = None + self.event_data_id = None + self.correlation_id = None + self.event_name = None + self.category = None + self.http_request = None + self.level = None + self.resource_group_name = None + self.resource_provider_name = None + self.resource_id = None + self.resource_type = None + self.operation_id = None + self.operation_name = None + self.properties = None + self.status = None + self.sub_status = None + self.event_timestamp = None + self.submission_timestamp = None + self.subscription_id = None + self.tenant_id = None + + +class HttpRequestInfo(Model): + """The Http request info. + + :param client_request_id: the client request id. + :type client_request_id: str + :param client_ip_address: the client Ip Address + :type client_ip_address: str + :param method: the Http request method. + :type method: str + :param uri: the Uri. + :type uri: str + """ + + _attribute_map = { + 'client_request_id': {'key': 'clientRequestId', 'type': 'str'}, + 'client_ip_address': {'key': 'clientIpAddress', 'type': 'str'}, + 'method': {'key': 'method', 'type': 'str'}, + 'uri': {'key': 'uri', 'type': 'str'}, + } + + def __init__(self, *, client_request_id: str=None, client_ip_address: str=None, method: str=None, uri: str=None, **kwargs) -> None: + super(HttpRequestInfo, self).__init__(**kwargs) + self.client_request_id = client_request_id + self.client_ip_address = client_ip_address + self.method = method + self.uri = uri + + +class LocalizableString(Model): + """The localizable string class. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. the invariant value. + :type value: str + :param localized_value: the locale specific value. + :type localized_value: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__(self, *, value: str, localized_value: str=None, **kwargs) -> None: + super(LocalizableString, self).__init__(**kwargs) + self.value = value + self.localized_value = localized_value + + +class MetricTrigger(Model): + """The trigger that results in a scaling action. + + All required parameters must be populated in order to send to Azure. + + :param metric_name: Required. the name of the metric that defines what the + rule monitors. + :type metric_name: str + :param metric_resource_uri: Required. the resource identifier of the + resource the rule monitors. + :type metric_resource_uri: str + :param time_grain: Required. the granularity of metrics the rule monitors. + Must be one of the predefined values returned from metric definitions for + the metric. Must be between 12 hours and 1 minute. + :type time_grain: timedelta + :param statistic: Required. the metric statistic type. How the metrics + from multiple instances are combined. Possible values include: 'Average', + 'Min', 'Max', 'Sum' + :type statistic: str or + ~azure.mgmt.monitor.v2015_04_01.models.MetricStatisticType + :param time_window: Required. the range of time in which instance data is + collected. This value must be greater than the delay in metric collection, + which can vary from resource-to-resource. Must be between 12 hours and 5 + minutes. + :type time_window: timedelta + :param time_aggregation: Required. time aggregation type. How the data + that is collected should be combined over time. The default value is + Average. Possible values include: 'Average', 'Minimum', 'Maximum', + 'Total', 'Count', 'Last' + :type time_aggregation: str or + ~azure.mgmt.monitor.v2015_04_01.models.TimeAggregationType + :param operator: Required. the operator that is used to compare the metric + data and the threshold. Possible values include: 'Equals', 'NotEquals', + 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' + :type operator: str or + ~azure.mgmt.monitor.v2015_04_01.models.ComparisonOperationType + :param threshold: Required. the threshold of the metric that triggers the + scale action. + :type threshold: float + """ + + _validation = { + 'metric_name': {'required': True}, + 'metric_resource_uri': {'required': True}, + 'time_grain': {'required': True}, + 'statistic': {'required': True}, + 'time_window': {'required': True}, + 'time_aggregation': {'required': True}, + 'operator': {'required': True}, + 'threshold': {'required': True}, + } + + _attribute_map = { + 'metric_name': {'key': 'metricName', 'type': 'str'}, + 'metric_resource_uri': {'key': 'metricResourceUri', 'type': 'str'}, + 'time_grain': {'key': 'timeGrain', 'type': 'duration'}, + 'statistic': {'key': 'statistic', 'type': 'MetricStatisticType'}, + 'time_window': {'key': 'timeWindow', 'type': 'duration'}, + 'time_aggregation': {'key': 'timeAggregation', 'type': 'TimeAggregationType'}, + 'operator': {'key': 'operator', 'type': 'ComparisonOperationType'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + } + + def __init__(self, *, metric_name: str, metric_resource_uri: str, time_grain, statistic, time_window, time_aggregation, operator, threshold: float, **kwargs) -> None: + super(MetricTrigger, self).__init__(**kwargs) + self.metric_name = metric_name + self.metric_resource_uri = metric_resource_uri + self.time_grain = time_grain + self.statistic = statistic + self.time_window = time_window + self.time_aggregation = time_aggregation + self.operator = operator + self.threshold = threshold + + +class Operation(Model): + """Microsoft Insights API operation definition. + + :param name: Operation name: {provider}/{resource}/{operation} + :type name: str + :param display: Display metadata associated with the operation. + :type display: ~azure.mgmt.monitor.v2015_04_01.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__(self, *, name: str=None, display=None, **kwargs) -> None: + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display + + +class OperationDisplay(Model): + """Display metadata associated with the operation. + + :param provider: Service provider: Microsoft.Insights + :type provider: str + :param resource: Resource on which the operation is performed: AlertRules, + Autoscale, etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, **kwargs) -> None: + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + + +class OperationListResult(Model): + """Result of the request to list Microsoft.Insights operations. It contains a + list of operations and a URL link to get the next set of results. + + :param value: List of operations supported by the Microsoft.Insights + provider. + :type value: list[~azure.mgmt.monitor.v2015_04_01.models.Operation] + :param next_link: URL to get the next set of operation list results if + there are any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, *, value=None, next_link: str=None, **kwargs) -> None: + super(OperationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class Recurrence(Model): + """The repeating times at which this profile begins. This element is not used + if the FixedDate element is used. + + All required parameters must be populated in order to send to Azure. + + :param frequency: Required. the recurrence frequency. How often the + schedule profile should take effect. This value must be Week, meaning each + week will have the same set of profiles. For example, to set a daily + schedule, set **schedule** to every day of the week. The frequency + property specifies that the schedule is repeated weekly. Possible values + include: 'None', 'Second', 'Minute', 'Hour', 'Day', 'Week', 'Month', + 'Year' + :type frequency: str or + ~azure.mgmt.monitor.v2015_04_01.models.RecurrenceFrequency + :param schedule: Required. the scheduling constraints for when the profile + begins. + :type schedule: ~azure.mgmt.monitor.v2015_04_01.models.RecurrentSchedule + """ + + _validation = { + 'frequency': {'required': True}, + 'schedule': {'required': True}, + } + + _attribute_map = { + 'frequency': {'key': 'frequency', 'type': 'RecurrenceFrequency'}, + 'schedule': {'key': 'schedule', 'type': 'RecurrentSchedule'}, + } + + def __init__(self, *, frequency, schedule, **kwargs) -> None: + super(Recurrence, self).__init__(**kwargs) + self.frequency = frequency + self.schedule = schedule + + +class RecurrentSchedule(Model): + """The scheduling constraints for when the profile begins. + + All required parameters must be populated in order to send to Azure. + + :param time_zone: Required. the timezone for the hours of the profile. + Some examples of valid time zones are: Dateline Standard Time, UTC-11, + Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time + (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain + Standard Time (Mexico), Mountain Standard Time, Central America Standard + Time, Central Standard Time, Central Standard Time (Mexico), Canada + Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US + Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, + Atlantic Standard Time, Central Brazilian Standard Time, SA Western + Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. + South America Standard Time, Argentina Standard Time, SA Eastern Standard + Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard + Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde + Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich + Standard Time, W. Europe Standard Time, Central Europe Standard Time, + Romance Standard Time, Central European Standard Time, W. Central Africa + Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard + Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, + E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, + Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, + Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus + Standard Time, Russian Standard Time, E. Africa Standard Time, Iran + Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia + Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus + Standard Time, Afghanistan Standard Time, West Asia Standard Time, + Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, + Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, + Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard + Time, SE Asia Standard Time, North Asia Standard Time, China Standard + Time, North Asia East Standard Time, Singapore Standard Time, W. Australia + Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo + Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia + Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS + Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, + Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, + Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard + Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard + Time, Samoa Standard Time, Line Islands Standard Time + :type time_zone: str + :param days: Required. the collection of days that the profile takes + effect on. Possible values are Sunday through Saturday. + :type days: list[str] + :param hours: Required. A collection of hours that the profile takes + effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times + are not supported). + :type hours: list[int] + :param minutes: Required. A collection of minutes at which the profile + takes effect at. + :type minutes: list[int] + """ + + _validation = { + 'time_zone': {'required': True}, + 'days': {'required': True}, + 'hours': {'required': True}, + 'minutes': {'required': True}, + } + + _attribute_map = { + 'time_zone': {'key': 'timeZone', 'type': 'str'}, + 'days': {'key': 'days', 'type': '[str]'}, + 'hours': {'key': 'hours', 'type': '[int]'}, + 'minutes': {'key': 'minutes', 'type': '[int]'}, + } + + def __init__(self, *, time_zone: str, days, hours, minutes, **kwargs) -> None: + super(RecurrentSchedule, self).__init__(**kwargs) + self.time_zone = time_zone + self.days = days + self.hours = hours + self.minutes = minutes + + +class ScaleAction(Model): + """The parameters for the scaling action. + + All required parameters must be populated in order to send to Azure. + + :param direction: Required. the scale direction. Whether the scaling + action increases or decreases the number of instances. Possible values + include: 'None', 'Increase', 'Decrease' + :type direction: str or + ~azure.mgmt.monitor.v2015_04_01.models.ScaleDirection + :param type: Required. the type of action that should occur when the scale + rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', + 'ExactCount' + :type type: str or ~azure.mgmt.monitor.v2015_04_01.models.ScaleType + :param value: the number of instances that are involved in the scaling + action. This value must be 1 or greater. The default value is 1. Default + value: "1" . + :type value: str + :param cooldown: Required. the amount of time to wait since the last + scaling action before this action occurs. It must be between 1 week and 1 + minute in ISO 8601 format. + :type cooldown: timedelta + """ + + _validation = { + 'direction': {'required': True}, + 'type': {'required': True}, + 'cooldown': {'required': True}, + } + + _attribute_map = { + 'direction': {'key': 'direction', 'type': 'ScaleDirection'}, + 'type': {'key': 'type', 'type': 'ScaleType'}, + 'value': {'key': 'value', 'type': 'str'}, + 'cooldown': {'key': 'cooldown', 'type': 'duration'}, + } + + def __init__(self, *, direction, type, cooldown, value: str="1", **kwargs) -> None: + super(ScaleAction, self).__init__(**kwargs) + self.direction = direction + self.type = type + self.value = value + self.cooldown = cooldown + + +class ScaleCapacity(Model): + """The number of instances that can be used during this profile. + + All required parameters must be populated in order to send to Azure. + + :param minimum: Required. the minimum number of instances for the + resource. + :type minimum: str + :param maximum: Required. the maximum number of instances for the + resource. The actual maximum number of instances is limited by the cores + that are available in the subscription. + :type maximum: str + :param default: Required. the number of instances that will be set if + metrics are not available for evaluation. The default is only used if the + current instance count is lower than the default. + :type default: str + """ + + _validation = { + 'minimum': {'required': True}, + 'maximum': {'required': True}, + 'default': {'required': True}, + } + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'str'}, + 'maximum': {'key': 'maximum', 'type': 'str'}, + 'default': {'key': 'default', 'type': 'str'}, + } + + def __init__(self, *, minimum: str, maximum: str, default: str, **kwargs) -> None: + super(ScaleCapacity, self).__init__(**kwargs) + self.minimum = minimum + self.maximum = maximum + self.default = default + + +class ScaleRule(Model): + """A rule that provide the triggers and parameters for the scaling action. + + All required parameters must be populated in order to send to Azure. + + :param metric_trigger: Required. the trigger that results in a scaling + action. + :type metric_trigger: ~azure.mgmt.monitor.v2015_04_01.models.MetricTrigger + :param scale_action: Required. the parameters for the scaling action. + :type scale_action: ~azure.mgmt.monitor.v2015_04_01.models.ScaleAction + """ + + _validation = { + 'metric_trigger': {'required': True}, + 'scale_action': {'required': True}, + } + + _attribute_map = { + 'metric_trigger': {'key': 'metricTrigger', 'type': 'MetricTrigger'}, + 'scale_action': {'key': 'scaleAction', 'type': 'ScaleAction'}, + } + + def __init__(self, *, metric_trigger, scale_action, **kwargs) -> None: + super(ScaleRule, self).__init__(**kwargs) + self.metric_trigger = metric_trigger + self.scale_action = scale_action + + +class SenderAuthorization(Model): + """the authorization used by the user who has performed the operation that led + to this event. This captures the RBAC properties of the event. These + usually include the 'action', 'role' and the 'scope'. + + :param action: the permissible actions. For instance: + microsoft.support/supporttickets/write + :type action: str + :param role: the role of the user. For instance: Subscription Admin + :type role: str + :param scope: the scope. + :type scope: str + """ + + _attribute_map = { + 'action': {'key': 'action', 'type': 'str'}, + 'role': {'key': 'role', 'type': 'str'}, + 'scope': {'key': 'scope', 'type': 'str'}, + } + + def __init__(self, *, action: str=None, role: str=None, scope: str=None, **kwargs) -> None: + super(SenderAuthorization, self).__init__(**kwargs) + self.action = action + self.role = role + self.scope = scope + + +class TimeWindow(Model): + """A specific date-time for the profile. + + All required parameters must be populated in order to send to Azure. + + :param time_zone: the timezone of the start and end times for the profile. + Some examples of valid time zones are: Dateline Standard Time, UTC-11, + Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time + (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain + Standard Time (Mexico), Mountain Standard Time, Central America Standard + Time, Central Standard Time, Central Standard Time (Mexico), Canada + Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US + Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, + Atlantic Standard Time, Central Brazilian Standard Time, SA Western + Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. + South America Standard Time, Argentina Standard Time, SA Eastern Standard + Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard + Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde + Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich + Standard Time, W. Europe Standard Time, Central Europe Standard Time, + Romance Standard Time, Central European Standard Time, W. Central Africa + Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard + Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, + E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, + Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, + Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus + Standard Time, Russian Standard Time, E. Africa Standard Time, Iran + Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia + Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus + Standard Time, Afghanistan Standard Time, West Asia Standard Time, + Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, + Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, + Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard + Time, SE Asia Standard Time, North Asia Standard Time, China Standard + Time, North Asia East Standard Time, Singapore Standard Time, W. Australia + Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo + Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia + Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS + Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, + Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, + Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard + Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard + Time, Samoa Standard Time, Line Islands Standard Time + :type time_zone: str + :param start: Required. the start time for the profile in ISO 8601 format. + :type start: datetime + :param end: Required. the end time for the profile in ISO 8601 format. + :type end: datetime + """ + + _validation = { + 'start': {'required': True}, + 'end': {'required': True}, + } + + _attribute_map = { + 'time_zone': {'key': 'timeZone', 'type': 'str'}, + 'start': {'key': 'start', 'type': 'iso-8601'}, + 'end': {'key': 'end', 'type': 'iso-8601'}, + } + + def __init__(self, *, start, end, time_zone: str=None, **kwargs) -> None: + super(TimeWindow, self).__init__(**kwargs) + self.time_zone = time_zone + self.start = start + self.end = end + + +class WebhookNotification(Model): + """Webhook notification of an autoscale event. + + :param service_uri: the service address to receive the notification. + :type service_uri: str + :param properties: a property bag of settings. This value can be empty. + :type properties: dict[str, str] + """ + + _attribute_map = { + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + } + + def __init__(self, *, service_uri: str=None, properties=None, **kwargs) -> None: + super(WebhookNotification, self).__init__(**kwargs) + self.service_uri = service_uri + self.properties = properties diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_monitor_management_client_enums.py new file mode 100644 index 000000000000..52c429290595 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_monitor_management_client_enums.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum + + +class EventLevel(str, Enum): + + critical = "Critical" + error = "Error" + warning = "Warning" + informational = "Informational" + verbose = "Verbose" + + +class MetricStatisticType(str, Enum): + + average = "Average" + min = "Min" + max = "Max" + sum = "Sum" + + +class TimeAggregationType(str, Enum): + + average = "Average" + minimum = "Minimum" + maximum = "Maximum" + total = "Total" + count = "Count" + last = "Last" + + +class ComparisonOperationType(str, Enum): + + equals = "Equals" + not_equals = "NotEquals" + greater_than = "GreaterThan" + greater_than_or_equal = "GreaterThanOrEqual" + less_than = "LessThan" + less_than_or_equal = "LessThanOrEqual" + + +class ScaleDirection(str, Enum): + + none = "None" + increase = "Increase" + decrease = "Decrease" + + +class ScaleType(str, Enum): + + change_count = "ChangeCount" + percent_change_count = "PercentChangeCount" + exact_count = "ExactCount" + + +class RecurrenceFrequency(str, Enum): + + none = "None" + second = "Second" + minute = "Minute" + hour = "Hour" + day = "Day" + week = "Week" + month = "Month" + year = "Year" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_paged_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_paged_models.py new file mode 100644 index 000000000000..683c9d470adc --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_paged_models.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 msrest.paging import Paged + + +class EventDataPaged(Paged): + """ + A paging container for iterating over a list of :class:`EventData ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[EventData]'} + } + + def __init__(self, *args, **kwargs): + + super(EventDataPaged, self).__init__(*args, **kwargs) +class AutoscaleSettingResourcePaged(Paged): + """ + A paging container for iterating over a list of :class:`AutoscaleSettingResource ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[AutoscaleSettingResource]'} + } + + def __init__(self, *args, **kwargs): + + super(AutoscaleSettingResourcePaged, self).__init__(*args, **kwargs) +class LocalizableStringPaged(Paged): + """ + A paging container for iterating over a list of :class:`LocalizableString ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[LocalizableString]'} + } + + def __init__(self, *args, **kwargs): + + super(LocalizableStringPaged, self).__init__(*args, **kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/__init__.py new file mode 100644 index 000000000000..ef7ca307155f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/__init__.py @@ -0,0 +1,24 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._activity_logs_operations import ActivityLogsOperations +from ._autoscale_settings_operations import AutoscaleSettingsOperations +from ._event_categories_operations import EventCategoriesOperations +from ._operations import Operations +from ._tenant_activity_logs_operations import TenantActivityLogsOperations + +__all__ = [ + 'ActivityLogsOperations', + 'AutoscaleSettingsOperations', + 'EventCategoriesOperations', + 'Operations', + 'TenantActivityLogsOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_activity_logs_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_activity_logs_operations.py new file mode 100644 index 000000000000..70e9f879d39f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_activity_logs_operations.py @@ -0,0 +1,136 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class ActivityLogsOperations(object): + """ActivityLogsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2015-04-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-04-01" + + self.config = config + + def list( + self, filter=None, select=None, custom_headers=None, raw=False, **operation_config): + """Provides the list of records from the activity logs. + + :param filter: Reduces the set of data collected.
The **$filter** + argument is very restricted and allows only the following + patterns.
- *List events for a resource group*: + $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and + eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName + eq 'resourceGroupName'.
- *List events for resource*: + $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and + eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceUri eq + 'resourceURI'.
- *List events for a subscription in a time range*: + $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and + eventTimestamp le '2014-07-20T04:36:37.6407898Z'.
- *List events + for a resource provider*: $filter=eventTimestamp ge + '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + '2014-07-20T04:36:37.6407898Z' and resourceProvider eq + 'resourceProviderName'.
- *List events for a correlation Id*: + $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and + eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq + 'correlationID'.

**NOTE**: No other syntax is allowed. + :type filter: str + :param select: Used to fetch events with only the given + properties.
The **$select** argument is a comma separated list of + property names to be returned. Possible values are: *authorization*, + *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, + *eventTimestamp*, *httpRequest*, *level*, *operationId*, + *operationName*, *properties*, *resourceGroupName*, + *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, + *subStatus*, *subscriptionId* + :type select: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of EventData + :rtype: + ~azure.mgmt.monitor.v2015_04_01.models.EventDataPaged[~azure.mgmt.monitor.v2015_04_01.models.EventData] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if select is not None: + query_parameters['$select'] = self._serialize.query("select", select, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.EventDataPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/eventtypes/management/values'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_autoscale_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_autoscale_settings_operations.py new file mode 100644 index 000000000000..ac14b6eb6c5b --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_autoscale_settings_operations.py @@ -0,0 +1,425 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class AutoscaleSettingsOperations(object): + """AutoscaleSettingsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2015-04-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-04-01" + + self.config = config + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Lists the autoscale settings for a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of AutoscaleSettingResource + :rtype: + ~azure.mgmt.monitor.v2015_04_01.models.AutoscaleSettingResourcePaged[~azure.mgmt.monitor.v2015_04_01.models.AutoscaleSettingResource] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.AutoscaleSettingResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings'} + + def create_or_update( + self, resource_group_name, autoscale_setting_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates an autoscale setting. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param autoscale_setting_name: The autoscale setting name. + :type autoscale_setting_name: str + :param parameters: Parameters supplied to the operation. + :type parameters: + ~azure.mgmt.monitor.v2015_04_01.models.AutoscaleSettingResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AutoscaleSettingResource or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.monitor.v2015_04_01.models.AutoscaleSettingResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'autoscaleSettingName': self._serialize.url("autoscale_setting_name", autoscale_setting_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'AutoscaleSettingResource') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AutoscaleSettingResource', response) + if response.status_code == 201: + deserialized = self._deserialize('AutoscaleSettingResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}'} + + def delete( + self, resource_group_name, autoscale_setting_name, custom_headers=None, raw=False, **operation_config): + """Deletes and autoscale setting. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param autoscale_setting_name: The autoscale setting name. + :type autoscale_setting_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'autoscaleSettingName': self._serialize.url("autoscale_setting_name", autoscale_setting_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}'} + + def get( + self, resource_group_name, autoscale_setting_name, custom_headers=None, raw=False, **operation_config): + """Gets an autoscale setting. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param autoscale_setting_name: The autoscale setting name. + :type autoscale_setting_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AutoscaleSettingResource or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.monitor.v2015_04_01.models.AutoscaleSettingResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'autoscaleSettingName': self._serialize.url("autoscale_setting_name", autoscale_setting_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AutoscaleSettingResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}'} + + def update( + self, resource_group_name, autoscale_setting_name, autoscale_setting_resource, custom_headers=None, raw=False, **operation_config): + """Updates an existing AutoscaleSettingsResource. To update other fields + use the CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param autoscale_setting_name: The autoscale setting name. + :type autoscale_setting_name: str + :param autoscale_setting_resource: Parameters supplied to the + operation. + :type autoscale_setting_resource: + ~azure.mgmt.monitor.v2015_04_01.models.AutoscaleSettingResourcePatch + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AutoscaleSettingResource or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.monitor.v2015_04_01.models.AutoscaleSettingResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'autoscaleSettingName': self._serialize.url("autoscale_setting_name", autoscale_setting_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(autoscale_setting_resource, 'AutoscaleSettingResourcePatch') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AutoscaleSettingResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}'} + + def list_by_subscription( + self, custom_headers=None, raw=False, **operation_config): + """Lists the autoscale settings for a subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of AutoscaleSettingResource + :rtype: + ~azure.mgmt.monitor.v2015_04_01.models.AutoscaleSettingResourcePaged[~azure.mgmt.monitor.v2015_04_01.models.AutoscaleSettingResource] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.AutoscaleSettingResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/autoscalesettings'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_event_categories_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_event_categories_operations.py new file mode 100644 index 000000000000..3c5bcc17cd18 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_event_categories_operations.py @@ -0,0 +1,102 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class EventCategoriesOperations(object): + """EventCategoriesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2015-04-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-04-01" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Get the list of available event categories supported in the Activity + Logs Service.
The current list includes the following: + Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of LocalizableString + :rtype: + ~azure.mgmt.monitor.v2015_04_01.models.LocalizableStringPaged[~azure.mgmt.monitor.v2015_04_01.models.LocalizableString] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.LocalizableStringPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/microsoft.insights/eventcategories'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_operations.py new file mode 100644 index 000000000000..be36e736a79e --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_operations.py @@ -0,0 +1,91 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class Operations(object): + """Operations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2015-04-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-04-01" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all of the available operations from Microsoft.Insights provider. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: OperationListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2015_04_01.models.OperationListResult or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/providers/microsoft.insights/operations'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_tenant_activity_logs_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_tenant_activity_logs_operations.py new file mode 100644 index 000000000000..0cc7298b7854 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_tenant_activity_logs_operations.py @@ -0,0 +1,138 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class TenantActivityLogsOperations(object): + """TenantActivityLogsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2015-04-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-04-01" + + self.config = config + + def list( + self, filter=None, select=None, custom_headers=None, raw=False, **operation_config): + """Gets the Activity Logs for the Tenant.
Everything that is applicable + to the API to get the Activity Logs for the subscription is applicable + to this API (the parameters, $filter, etc.).
One thing to point out + here is that this API does *not* retrieve the logs at the individual + subscription of the tenant but only surfaces the logs that were + generated at the tenant level. + + :param filter: Reduces the set of data collected.
The **$filter** + is very restricted and allows only the following patterns.
- List + events for a resource group: $filter=eventTimestamp ge '' + and eventTimestamp le '' and eventChannels eq 'Admin, + Operation' and resourceGroupName eq ''.
- List + events for resource: $filter=eventTimestamp ge '' and + eventTimestamp le '' and eventChannels eq 'Admin, Operation' + and resourceUri eq ''.
- List events for a + subscription: $filter=eventTimestamp ge '' and + eventTimestamp le '' and eventChannels eq 'Admin, + Operation'.
- List events for a resource provider: + $filter=eventTimestamp ge '' and eventTimestamp le '' and eventChannels eq 'Admin, Operation' and resourceProvider eq + ''.
- List events for a correlation Id: + api-version=2014-04-01&$filter=eventTimestamp ge + '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' + and correlationId eq ''.
**NOTE**: No other syntax + is allowed. + :type filter: str + :param select: Used to fetch events with only the given + properties.
The **$select** argument is a comma separated list of + property names to be returned. Possible values are: *authorization*, + *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, + *eventTimestamp*, *httpRequest*, *level*, *operationId*, + *operationName*, *properties*, *resourceGroupName*, + *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, + *subStatus*, *subscriptionId* + :type select: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of EventData + :rtype: + ~azure.mgmt.monitor.v2015_04_01.models.EventDataPaged[~azure.mgmt.monitor.v2015_04_01.models.EventData] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if select is not None: + query_parameters['$select'] = self._serialize.query("select", select, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.EventDataPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/microsoft.insights/eventtypes/management/values'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/version.py new file mode 100644 index 000000000000..ae234a72324c --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2015-04-01" + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/__init__.py new file mode 100644 index 000000000000..940dc0469831 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._configuration import MonitorClientConfiguration +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient', 'MonitorClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_configuration.py new file mode 100644 index 000000000000..010b91186aef --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_configuration.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +from msrestazure import AzureConfiguration + +from .version import VERSION + + +class MonitorClientConfiguration(AzureConfiguration): + """Configuration for MonitorClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param str base_url: Service URL + """ + + def __init__( + self, credentials, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(MonitorClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-monitor/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_monitor_client.py new file mode 100644 index 000000000000..eaabe567bda7 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_monitor_client.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 msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import MonitorClientConfiguration +from .operations import ServiceDiagnosticSettingsOperations +from . import models + + +class MonitorClient(SDKClient): + """Monitor Management Client + + :ivar config: Configuration for client. + :vartype config: MonitorClientConfiguration + + :ivar service_diagnostic_settings: ServiceDiagnosticSettings operations + :vartype service_diagnostic_settings: azure.mgmt.monitor.v2015_07_01.operations.ServiceDiagnosticSettingsOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param str base_url: Service URL + """ + + def __init__( + self, credentials, base_url=None): + + self.config = MonitorClientConfiguration(credentials, base_url) + super(MonitorClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2015-07-01' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.service_diagnostic_settings = ServiceDiagnosticSettingsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/__init__.py new file mode 100644 index 000000000000..1d4ff73e418f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/__init__.py @@ -0,0 +1,34 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import LogSettings + from ._models_py3 import MetricSettings + from ._models_py3 import Resource + from ._models_py3 import RetentionPolicy + from ._models_py3 import ServiceDiagnosticSettingsResource +except (SyntaxError, ImportError): + from ._models import ErrorResponse, ErrorResponseException + from ._models import LogSettings + from ._models import MetricSettings + from ._models import Resource + from ._models import RetentionPolicy + from ._models import ServiceDiagnosticSettingsResource + +__all__ = [ + 'ErrorResponse', 'ErrorResponseException', + 'LogSettings', + 'MetricSettings', + 'Resource', + 'RetentionPolicy', + 'ServiceDiagnosticSettingsResource', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/_models.py new file mode 100644 index 000000000000..a4e95da8d5d6 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/_models.py @@ -0,0 +1,262 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class LogSettings(Model): + """Part of MultiTenantDiagnosticSettings. Specifies the settings for a + particular log. + + All required parameters must be populated in order to send to Azure. + + :param category: Name of a Diagnostic Log category for a resource type + this setting is applied to. To obtain the list of Diagnostic Log + categories for a resource, first perform a GET diagnostic settings + operation. + :type category: str + :param enabled: Required. a value indicating whether this log is enabled. + :type enabled: bool + :param retention_policy: the retention policy for this log. + :type retention_policy: + ~azure.mgmt.monitor.v2015_07_01.models.RetentionPolicy + """ + + _validation = { + 'enabled': {'required': True}, + } + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + } + + def __init__(self, **kwargs): + super(LogSettings, self).__init__(**kwargs) + self.category = kwargs.get('category', None) + self.enabled = kwargs.get('enabled', None) + self.retention_policy = kwargs.get('retention_policy', None) + + +class MetricSettings(Model): + """Part of MultiTenantDiagnosticSettings. Specifies the settings for a + particular metric. + + All required parameters must be populated in order to send to Azure. + + :param time_grain: Required. the timegrain of the metric in ISO8601 + format. + :type time_grain: timedelta + :param enabled: Required. a value indicating whether this timegrain is + enabled. + :type enabled: bool + :param retention_policy: the retention policy for this timegrain. + :type retention_policy: + ~azure.mgmt.monitor.v2015_07_01.models.RetentionPolicy + """ + + _validation = { + 'time_grain': {'required': True}, + 'enabled': {'required': True}, + } + + _attribute_map = { + 'time_grain': {'key': 'timeGrain', 'type': 'duration'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + } + + def __init__(self, **kwargs): + super(MetricSettings, self).__init__(**kwargs) + self.time_grain = kwargs.get('time_grain', None) + self.enabled = kwargs.get('enabled', None) + self.retention_policy = kwargs.get('retention_policy', None) + + +class Resource(Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class RetentionPolicy(Model): + """Specifies the retention policy for the log. + + All required parameters must be populated in order to send to Azure. + + :param enabled: Required. a value indicating whether the retention policy + is enabled. + :type enabled: bool + :param days: Required. the number of days for the retention in days. A + value of 0 will retain the events indefinitely. + :type days: int + """ + + _validation = { + 'enabled': {'required': True}, + 'days': {'required': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'days': {'key': 'days', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(RetentionPolicy, self).__init__(**kwargs) + self.enabled = kwargs.get('enabled', None) + self.days = kwargs.get('days', None) + + +class ServiceDiagnosticSettingsResource(Resource): + """Description of a service diagnostic setting. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param storage_account_id: The resource ID of the storage account to which + you would like to send Diagnostic Logs. + :type storage_account_id: str + :param service_bus_rule_id: The service bus rule ID of the service bus + namespace in which you would like to have Event Hubs created for streaming + Diagnostic Logs. The rule ID is of the format: '{service bus resource + ID}/authorizationrules/{key name}'. + :type service_bus_rule_id: str + :param metrics: the list of metric settings. + :type metrics: list[~azure.mgmt.monitor.v2015_07_01.models.MetricSettings] + :param logs: the list of logs settings. + :type logs: list[~azure.mgmt.monitor.v2015_07_01.models.LogSettings] + :param workspace_id: The workspace ID (resource ID of a Log Analytics + workspace) for a Log Analytics workspace to which you would like to send + Diagnostic Logs. Example: + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + :type workspace_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, + 'metrics': {'key': 'properties.metrics', 'type': '[MetricSettings]'}, + 'logs': {'key': 'properties.logs', 'type': '[LogSettings]'}, + 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ServiceDiagnosticSettingsResource, self).__init__(**kwargs) + self.storage_account_id = kwargs.get('storage_account_id', None) + self.service_bus_rule_id = kwargs.get('service_bus_rule_id', None) + self.metrics = kwargs.get('metrics', None) + self.logs = kwargs.get('logs', None) + self.workspace_id = kwargs.get('workspace_id', None) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/_models_py3.py new file mode 100644 index 000000000000..1bbd83e5c759 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/_models_py3.py @@ -0,0 +1,262 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class LogSettings(Model): + """Part of MultiTenantDiagnosticSettings. Specifies the settings for a + particular log. + + All required parameters must be populated in order to send to Azure. + + :param category: Name of a Diagnostic Log category for a resource type + this setting is applied to. To obtain the list of Diagnostic Log + categories for a resource, first perform a GET diagnostic settings + operation. + :type category: str + :param enabled: Required. a value indicating whether this log is enabled. + :type enabled: bool + :param retention_policy: the retention policy for this log. + :type retention_policy: + ~azure.mgmt.monitor.v2015_07_01.models.RetentionPolicy + """ + + _validation = { + 'enabled': {'required': True}, + } + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + } + + def __init__(self, *, enabled: bool, category: str=None, retention_policy=None, **kwargs) -> None: + super(LogSettings, self).__init__(**kwargs) + self.category = category + self.enabled = enabled + self.retention_policy = retention_policy + + +class MetricSettings(Model): + """Part of MultiTenantDiagnosticSettings. Specifies the settings for a + particular metric. + + All required parameters must be populated in order to send to Azure. + + :param time_grain: Required. the timegrain of the metric in ISO8601 + format. + :type time_grain: timedelta + :param enabled: Required. a value indicating whether this timegrain is + enabled. + :type enabled: bool + :param retention_policy: the retention policy for this timegrain. + :type retention_policy: + ~azure.mgmt.monitor.v2015_07_01.models.RetentionPolicy + """ + + _validation = { + 'time_grain': {'required': True}, + 'enabled': {'required': True}, + } + + _attribute_map = { + 'time_grain': {'key': 'timeGrain', 'type': 'duration'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + } + + def __init__(self, *, time_grain, enabled: bool, retention_policy=None, **kwargs) -> None: + super(MetricSettings, self).__init__(**kwargs) + self.time_grain = time_grain + self.enabled = enabled + self.retention_policy = retention_policy + + +class Resource(Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, location: str, tags=None, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class RetentionPolicy(Model): + """Specifies the retention policy for the log. + + All required parameters must be populated in order to send to Azure. + + :param enabled: Required. a value indicating whether the retention policy + is enabled. + :type enabled: bool + :param days: Required. the number of days for the retention in days. A + value of 0 will retain the events indefinitely. + :type days: int + """ + + _validation = { + 'enabled': {'required': True}, + 'days': {'required': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'days': {'key': 'days', 'type': 'int'}, + } + + def __init__(self, *, enabled: bool, days: int, **kwargs) -> None: + super(RetentionPolicy, self).__init__(**kwargs) + self.enabled = enabled + self.days = days + + +class ServiceDiagnosticSettingsResource(Resource): + """Description of a service diagnostic setting. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param storage_account_id: The resource ID of the storage account to which + you would like to send Diagnostic Logs. + :type storage_account_id: str + :param service_bus_rule_id: The service bus rule ID of the service bus + namespace in which you would like to have Event Hubs created for streaming + Diagnostic Logs. The rule ID is of the format: '{service bus resource + ID}/authorizationrules/{key name}'. + :type service_bus_rule_id: str + :param metrics: the list of metric settings. + :type metrics: list[~azure.mgmt.monitor.v2015_07_01.models.MetricSettings] + :param logs: the list of logs settings. + :type logs: list[~azure.mgmt.monitor.v2015_07_01.models.LogSettings] + :param workspace_id: The workspace ID (resource ID of a Log Analytics + workspace) for a Log Analytics workspace to which you would like to send + Diagnostic Logs. Example: + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + :type workspace_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, + 'metrics': {'key': 'properties.metrics', 'type': '[MetricSettings]'}, + 'logs': {'key': 'properties.logs', 'type': '[LogSettings]'}, + 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, + } + + def __init__(self, *, location: str, tags=None, storage_account_id: str=None, service_bus_rule_id: str=None, metrics=None, logs=None, workspace_id: str=None, **kwargs) -> None: + super(ServiceDiagnosticSettingsResource, self).__init__(location=location, tags=tags, **kwargs) + self.storage_account_id = storage_account_id + self.service_bus_rule_id = service_bus_rule_id + self.metrics = metrics + self.logs = logs + self.workspace_id = workspace_id diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/__init__.py new file mode 100644 index 000000000000..01e0c08438ca --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/__init__.py @@ -0,0 +1,16 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._service_diagnostic_settings_operations import ServiceDiagnosticSettingsOperations + +__all__ = [ + 'ServiceDiagnosticSettingsOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_service_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_service_diagnostic_settings_operations.py new file mode 100644 index 000000000000..f0512956e47c --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_service_diagnostic_settings_operations.py @@ -0,0 +1,164 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class ServiceDiagnosticSettingsOperations(object): + """ServiceDiagnosticSettingsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2015-07-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-07-01" + + self.config = config + + def get( + self, resource_uri, custom_headers=None, raw=False, **operation_config): + """Gets the active diagnostic settings for the specified resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ServiceDiagnosticSettingsResource or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.monitor.v2015_07_01.models.ServiceDiagnosticSettingsResource + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ServiceDiagnosticSettingsResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service'} + + def create_or_update( + self, resource_uri, parameters, custom_headers=None, raw=False, **operation_config): + """Create or update new diagnostic settings for the specified resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param parameters: Parameters supplied to the operation. + :type parameters: + ~azure.mgmt.monitor.v2015_07_01.models.ServiceDiagnosticSettingsResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ServiceDiagnosticSettingsResource or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.monitor.v2015_07_01.models.ServiceDiagnosticSettingsResource + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ServiceDiagnosticSettingsResource') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ServiceDiagnosticSettingsResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/version.py new file mode 100644 index 000000000000..ccd03e108044 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2015-07-01" + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/__init__.py new file mode 100644 index 000000000000..8e97360e5ffb --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._configuration import MonitorManagementClientConfiguration +from ._monitor_management_client import MonitorManagementClient +__all__ = ['MonitorManagementClient', 'MonitorManagementClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_configuration.py new file mode 100644 index 000000000000..88436f6b4a33 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_configuration.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 msrestazure import AzureConfiguration + +from .version import VERSION + + +class MonitorManagementClientConfiguration(AzureConfiguration): + """Configuration for MonitorManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription Id. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(MonitorManagementClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-monitor/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_monitor_management_client.py new file mode 100644 index 000000000000..0d2080248034 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_monitor_management_client.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 msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import MonitorManagementClientConfiguration +from .operations import AlertRuleIncidentsOperations +from .operations import AlertRulesOperations +from .operations import LogProfilesOperations +from .operations import MetricDefinitionsOperations +from . import models + + +class MonitorManagementClient(SDKClient): + """Monitor Management Client + + :ivar config: Configuration for client. + :vartype config: MonitorManagementClientConfiguration + + :ivar alert_rule_incidents: AlertRuleIncidents operations + :vartype alert_rule_incidents: azure.mgmt.monitor.v2016_03_01.operations.AlertRuleIncidentsOperations + :ivar alert_rules: AlertRules operations + :vartype alert_rules: azure.mgmt.monitor.v2016_03_01.operations.AlertRulesOperations + :ivar log_profiles: LogProfiles operations + :vartype log_profiles: azure.mgmt.monitor.v2016_03_01.operations.LogProfilesOperations + :ivar metric_definitions: MetricDefinitions operations + :vartype metric_definitions: azure.mgmt.monitor.v2016_03_01.operations.MetricDefinitionsOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription Id. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = MonitorManagementClientConfiguration(credentials, subscription_id, base_url) + super(MonitorManagementClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2016-03-01' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.alert_rule_incidents = AlertRuleIncidentsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.alert_rules = AlertRulesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.log_profiles = LogProfilesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.metric_definitions = MetricDefinitionsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/__init__.py new file mode 100644 index 000000000000..8a69ad3e79ad --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/__init__.py @@ -0,0 +1,103 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AlertRuleResource + from ._models_py3 import AlertRuleResourcePatch + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import Incident + from ._models_py3 import LocalizableString + from ._models_py3 import LocationThresholdRuleCondition + from ._models_py3 import LogProfileResource + from ._models_py3 import LogProfileResourcePatch + from ._models_py3 import ManagementEventAggregationCondition + from ._models_py3 import ManagementEventRuleCondition + from ._models_py3 import MetricAvailability + from ._models_py3 import MetricDefinition + from ._models_py3 import Resource + from ._models_py3 import RetentionPolicy + from ._models_py3 import RuleAction + from ._models_py3 import RuleCondition + from ._models_py3 import RuleDataSource + from ._models_py3 import RuleEmailAction + from ._models_py3 import RuleManagementEventClaimsDataSource + from ._models_py3 import RuleManagementEventDataSource + from ._models_py3 import RuleMetricDataSource + from ._models_py3 import RuleWebhookAction + from ._models_py3 import ThresholdRuleCondition +except (SyntaxError, ImportError): + from ._models import AlertRuleResource + from ._models import AlertRuleResourcePatch + from ._models import ErrorResponse, ErrorResponseException + from ._models import Incident + from ._models import LocalizableString + from ._models import LocationThresholdRuleCondition + from ._models import LogProfileResource + from ._models import LogProfileResourcePatch + from ._models import ManagementEventAggregationCondition + from ._models import ManagementEventRuleCondition + from ._models import MetricAvailability + from ._models import MetricDefinition + from ._models import Resource + from ._models import RetentionPolicy + from ._models import RuleAction + from ._models import RuleCondition + from ._models import RuleDataSource + from ._models import RuleEmailAction + from ._models import RuleManagementEventClaimsDataSource + from ._models import RuleManagementEventDataSource + from ._models import RuleMetricDataSource + from ._models import RuleWebhookAction + from ._models import ThresholdRuleCondition +from ._paged_models import AlertRuleResourcePaged +from ._paged_models import IncidentPaged +from ._paged_models import LogProfileResourcePaged +from ._paged_models import MetricDefinitionPaged +from ._monitor_management_client_enums import ( + ConditionOperator, + TimeAggregationOperator, + Unit, + AggregationType, +) + +__all__ = [ + 'AlertRuleResource', + 'AlertRuleResourcePatch', + 'ErrorResponse', 'ErrorResponseException', + 'Incident', + 'LocalizableString', + 'LocationThresholdRuleCondition', + 'LogProfileResource', + 'LogProfileResourcePatch', + 'ManagementEventAggregationCondition', + 'ManagementEventRuleCondition', + 'MetricAvailability', + 'MetricDefinition', + 'Resource', + 'RetentionPolicy', + 'RuleAction', + 'RuleCondition', + 'RuleDataSource', + 'RuleEmailAction', + 'RuleManagementEventClaimsDataSource', + 'RuleManagementEventDataSource', + 'RuleMetricDataSource', + 'RuleWebhookAction', + 'ThresholdRuleCondition', + 'IncidentPaged', + 'AlertRuleResourcePaged', + 'LogProfileResourcePaged', + 'MetricDefinitionPaged', + 'ConditionOperator', + 'TimeAggregationOperator', + 'Unit', + 'AggregationType', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_models.py new file mode 100644 index 000000000000..1d45ba2a8118 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_models.py @@ -0,0 +1,952 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class Resource(Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class AlertRuleResource(Resource): + """The alert rule resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param alert_rule_resource_name: Required. the name of the alert rule. + :type alert_rule_resource_name: str + :param description: the description of the alert rule that will be + included in the alert email. + :type description: str + :param is_enabled: Required. the flag that indicates whether the alert + rule is enabled. + :type is_enabled: bool + :param condition: Required. the condition that results in the alert rule + being activated. + :type condition: ~azure.mgmt.monitor.v2016_03_01.models.RuleCondition + :param actions: the array of actions that are performed when the alert + rule becomes active, and when an alert condition is resolved. + :type actions: list[~azure.mgmt.monitor.v2016_03_01.models.RuleAction] + :ivar last_updated_time: Last time the rule was updated in ISO8601 format. + :vartype last_updated_time: datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'alert_rule_resource_name': {'required': True}, + 'is_enabled': {'required': True}, + 'condition': {'required': True}, + 'last_updated_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'alert_rule_resource_name': {'key': 'properties.name', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, + 'condition': {'key': 'properties.condition', 'type': 'RuleCondition'}, + 'actions': {'key': 'properties.actions', 'type': '[RuleAction]'}, + 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(AlertRuleResource, self).__init__(**kwargs) + self.alert_rule_resource_name = kwargs.get('alert_rule_resource_name', None) + self.description = kwargs.get('description', None) + self.is_enabled = kwargs.get('is_enabled', None) + self.condition = kwargs.get('condition', None) + self.actions = kwargs.get('actions', None) + self.last_updated_time = None + + +class AlertRuleResourcePatch(Model): + """The alert rule object for patch operations. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param tags: Resource tags + :type tags: dict[str, str] + :param name: Required. the name of the alert rule. + :type name: str + :param description: the description of the alert rule that will be + included in the alert email. + :type description: str + :param is_enabled: Required. the flag that indicates whether the alert + rule is enabled. + :type is_enabled: bool + :param condition: Required. the condition that results in the alert rule + being activated. + :type condition: ~azure.mgmt.monitor.v2016_03_01.models.RuleCondition + :param actions: the array of actions that are performed when the alert + rule becomes active, and when an alert condition is resolved. + :type actions: list[~azure.mgmt.monitor.v2016_03_01.models.RuleAction] + :ivar last_updated_time: Last time the rule was updated in ISO8601 format. + :vartype last_updated_time: datetime + """ + + _validation = { + 'name': {'required': True}, + 'is_enabled': {'required': True}, + 'condition': {'required': True}, + 'last_updated_time': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'name': {'key': 'properties.name', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, + 'condition': {'key': 'properties.condition', 'type': 'RuleCondition'}, + 'actions': {'key': 'properties.actions', 'type': '[RuleAction]'}, + 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(AlertRuleResourcePatch, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.name = kwargs.get('name', None) + self.description = kwargs.get('description', None) + self.is_enabled = kwargs.get('is_enabled', None) + self.condition = kwargs.get('condition', None) + self.actions = kwargs.get('actions', None) + self.last_updated_time = None + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class Incident(Model): + """An alert incident indicates the activation status of an alert rule. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Incident name. + :vartype name: str + :ivar rule_name: Rule name that is associated with the incident. + :vartype rule_name: str + :ivar is_active: A boolean to indicate whether the incident is active or + resolved. + :vartype is_active: bool + :ivar activated_time: The time at which the incident was activated in + ISO8601 format. + :vartype activated_time: datetime + :ivar resolved_time: The time at which the incident was resolved in + ISO8601 format. If null, it means the incident is still active. + :vartype resolved_time: datetime + """ + + _validation = { + 'name': {'readonly': True}, + 'rule_name': {'readonly': True}, + 'is_active': {'readonly': True}, + 'activated_time': {'readonly': True}, + 'resolved_time': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'rule_name': {'key': 'ruleName', 'type': 'str'}, + 'is_active': {'key': 'isActive', 'type': 'bool'}, + 'activated_time': {'key': 'activatedTime', 'type': 'iso-8601'}, + 'resolved_time': {'key': 'resolvedTime', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(Incident, self).__init__(**kwargs) + self.name = None + self.rule_name = None + self.is_active = None + self.activated_time = None + self.resolved_time = None + + +class LocalizableString(Model): + """The localizable string class. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. the invariant value. + :type value: str + :param localized_value: the locale specific value. + :type localized_value: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(LocalizableString, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.localized_value = kwargs.get('localized_value', None) + + +class RuleCondition(Model): + """The condition that results in the alert rule being activated. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ThresholdRuleCondition, LocationThresholdRuleCondition, + ManagementEventRuleCondition + + All required parameters must be populated in order to send to Azure. + + :param data_source: the resource from which the rule collects its data. + For this type dataSource will always be of type RuleMetricDataSource. + :type data_source: ~azure.mgmt.monitor.v2016_03_01.models.RuleDataSource + :param odatatype: Required. Constant filled by server. + :type odatatype: str + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'data_source': {'key': 'dataSource', 'type': 'RuleDataSource'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + } + + _subtype_map = { + 'odatatype': {'Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition': 'ThresholdRuleCondition', 'Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition': 'LocationThresholdRuleCondition', 'Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition': 'ManagementEventRuleCondition'} + } + + def __init__(self, **kwargs): + super(RuleCondition, self).__init__(**kwargs) + self.data_source = kwargs.get('data_source', None) + self.odatatype = None + + +class LocationThresholdRuleCondition(RuleCondition): + """A rule condition based on a certain number of locations failing. + + All required parameters must be populated in order to send to Azure. + + :param data_source: the resource from which the rule collects its data. + For this type dataSource will always be of type RuleMetricDataSource. + :type data_source: ~azure.mgmt.monitor.v2016_03_01.models.RuleDataSource + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param window_size: the period of time (in ISO 8601 duration format) that + is used to monitor alert activity based on the threshold. If specified + then it must be between 5 minutes and 1 day. + :type window_size: timedelta + :param failed_location_count: Required. the number of locations that must + fail to activate the alert. + :type failed_location_count: int + """ + + _validation = { + 'odatatype': {'required': True}, + 'failed_location_count': {'required': True, 'minimum': 0}, + } + + _attribute_map = { + 'data_source': {'key': 'dataSource', 'type': 'RuleDataSource'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'window_size': {'key': 'windowSize', 'type': 'duration'}, + 'failed_location_count': {'key': 'failedLocationCount', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(LocationThresholdRuleCondition, self).__init__(**kwargs) + self.window_size = kwargs.get('window_size', None) + self.failed_location_count = kwargs.get('failed_location_count', None) + self.odatatype = 'Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition' + + +class LogProfileResource(Resource): + """The log profile resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param storage_account_id: the resource id of the storage account to which + you would like to send the Activity Log. + :type storage_account_id: str + :param service_bus_rule_id: The service bus rule ID of the service bus + namespace in which you would like to have Event Hubs created for streaming + the Activity Log. The rule ID is of the format: '{service bus resource + ID}/authorizationrules/{key name}'. + :type service_bus_rule_id: str + :param locations: Required. List of regions for which Activity Log events + should be stored or streamed. It is a comma separated list of valid ARM + locations including the 'global' location. + :type locations: list[str] + :param categories: Required. the categories of the logs. These categories + are created as is convenient to the user. Some values are: 'Write', + 'Delete', and/or 'Action.' + :type categories: list[str] + :param retention_policy: Required. the retention policy for the events in + the log. + :type retention_policy: + ~azure.mgmt.monitor.v2016_03_01.models.RetentionPolicy + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'locations': {'required': True}, + 'categories': {'required': True}, + 'retention_policy': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, + 'locations': {'key': 'properties.locations', 'type': '[str]'}, + 'categories': {'key': 'properties.categories', 'type': '[str]'}, + 'retention_policy': {'key': 'properties.retentionPolicy', 'type': 'RetentionPolicy'}, + } + + def __init__(self, **kwargs): + super(LogProfileResource, self).__init__(**kwargs) + self.storage_account_id = kwargs.get('storage_account_id', None) + self.service_bus_rule_id = kwargs.get('service_bus_rule_id', None) + self.locations = kwargs.get('locations', None) + self.categories = kwargs.get('categories', None) + self.retention_policy = kwargs.get('retention_policy', None) + + +class LogProfileResourcePatch(Model): + """The log profile resource for patch operations. + + All required parameters must be populated in order to send to Azure. + + :param tags: Resource tags + :type tags: dict[str, str] + :param storage_account_id: the resource id of the storage account to which + you would like to send the Activity Log. + :type storage_account_id: str + :param service_bus_rule_id: The service bus rule ID of the service bus + namespace in which you would like to have Event Hubs created for streaming + the Activity Log. The rule ID is of the format: '{service bus resource + ID}/authorizationrules/{key name}'. + :type service_bus_rule_id: str + :param locations: Required. List of regions for which Activity Log events + should be stored or streamed. It is a comma separated list of valid ARM + locations including the 'global' location. + :type locations: list[str] + :param categories: Required. the categories of the logs. These categories + are created as is convenient to the user. Some values are: 'Write', + 'Delete', and/or 'Action.' + :type categories: list[str] + :param retention_policy: Required. the retention policy for the events in + the log. + :type retention_policy: + ~azure.mgmt.monitor.v2016_03_01.models.RetentionPolicy + """ + + _validation = { + 'locations': {'required': True}, + 'categories': {'required': True}, + 'retention_policy': {'required': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, + 'locations': {'key': 'properties.locations', 'type': '[str]'}, + 'categories': {'key': 'properties.categories', 'type': '[str]'}, + 'retention_policy': {'key': 'properties.retentionPolicy', 'type': 'RetentionPolicy'}, + } + + def __init__(self, **kwargs): + super(LogProfileResourcePatch, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.storage_account_id = kwargs.get('storage_account_id', None) + self.service_bus_rule_id = kwargs.get('service_bus_rule_id', None) + self.locations = kwargs.get('locations', None) + self.categories = kwargs.get('categories', None) + self.retention_policy = kwargs.get('retention_policy', None) + + +class ManagementEventAggregationCondition(Model): + """How the data that is collected should be combined over time. + + :param operator: the condition operator. Possible values include: + 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' + :type operator: str or + ~azure.mgmt.monitor.v2016_03_01.models.ConditionOperator + :param threshold: The threshold value that activates the alert. + :type threshold: float + :param window_size: the period of time (in ISO 8601 duration format) that + is used to monitor alert activity based on the threshold. If specified + then it must be between 5 minutes and 1 day. + :type window_size: timedelta + """ + + _attribute_map = { + 'operator': {'key': 'operator', 'type': 'ConditionOperator'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + 'window_size': {'key': 'windowSize', 'type': 'duration'}, + } + + def __init__(self, **kwargs): + super(ManagementEventAggregationCondition, self).__init__(**kwargs) + self.operator = kwargs.get('operator', None) + self.threshold = kwargs.get('threshold', None) + self.window_size = kwargs.get('window_size', None) + + +class ManagementEventRuleCondition(RuleCondition): + """A management event rule condition. + + All required parameters must be populated in order to send to Azure. + + :param data_source: the resource from which the rule collects its data. + For this type dataSource will always be of type RuleMetricDataSource. + :type data_source: ~azure.mgmt.monitor.v2016_03_01.models.RuleDataSource + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param aggregation: How the data that is collected should be combined over + time and when the alert is activated. Note that for management event + alerts aggregation is optional – if it is not provided then any event will + cause the alert to activate. + :type aggregation: + ~azure.mgmt.monitor.v2016_03_01.models.ManagementEventAggregationCondition + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'data_source': {'key': 'dataSource', 'type': 'RuleDataSource'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'aggregation': {'key': 'aggregation', 'type': 'ManagementEventAggregationCondition'}, + } + + def __init__(self, **kwargs): + super(ManagementEventRuleCondition, self).__init__(**kwargs) + self.aggregation = kwargs.get('aggregation', None) + self.odatatype = 'Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition' + + +class MetricAvailability(Model): + """Metric availability specifies the time grain (aggregation interval or + frequency) and the retention period for that time grain. + + :param time_grain: the time grain specifies the aggregation interval for + the metric. Expressed as a duration 'PT1M', 'P1D', etc. + :type time_grain: timedelta + :param retention: the retention period for the metric at the specified + timegrain. Expressed as a duration 'PT1M', 'P1D', etc. + :type retention: timedelta + """ + + _attribute_map = { + 'time_grain': {'key': 'timeGrain', 'type': 'duration'}, + 'retention': {'key': 'retention', 'type': 'duration'}, + } + + def __init__(self, **kwargs): + super(MetricAvailability, self).__init__(**kwargs) + self.time_grain = kwargs.get('time_grain', None) + self.retention = kwargs.get('retention', None) + + +class MetricDefinition(Model): + """Metric definition class specifies the metadata for a metric. + + :param resource_id: the resource identifier of the resource that emitted + the metric. + :type resource_id: str + :param name: the name and the display name of the metric, i.e. it is a + localizable string. + :type name: ~azure.mgmt.monitor.v2016_03_01.models.LocalizableString + :param unit: the unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', + 'MilliSeconds' + :type unit: str or ~azure.mgmt.monitor.v2016_03_01.models.Unit + :param primary_aggregation_type: the primary aggregation type value + defining how to use the values for display. Possible values include: + 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' + :type primary_aggregation_type: str or + ~azure.mgmt.monitor.v2016_03_01.models.AggregationType + :param metric_availabilities: the collection of what aggregation intervals + are available to be queried. + :type metric_availabilities: + list[~azure.mgmt.monitor.v2016_03_01.models.MetricAvailability] + :param id: the resource identifier of the metric definition. + :type id: str + """ + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'unit': {'key': 'unit', 'type': 'Unit'}, + 'primary_aggregation_type': {'key': 'primaryAggregationType', 'type': 'AggregationType'}, + 'metric_availabilities': {'key': 'metricAvailabilities', 'type': '[MetricAvailability]'}, + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MetricDefinition, self).__init__(**kwargs) + self.resource_id = kwargs.get('resource_id', None) + self.name = kwargs.get('name', None) + self.unit = kwargs.get('unit', None) + self.primary_aggregation_type = kwargs.get('primary_aggregation_type', None) + self.metric_availabilities = kwargs.get('metric_availabilities', None) + self.id = kwargs.get('id', None) + + +class RetentionPolicy(Model): + """Specifies the retention policy for the log. + + All required parameters must be populated in order to send to Azure. + + :param enabled: Required. a value indicating whether the retention policy + is enabled. + :type enabled: bool + :param days: Required. the number of days for the retention in days. A + value of 0 will retain the events indefinitely. + :type days: int + """ + + _validation = { + 'enabled': {'required': True}, + 'days': {'required': True, 'minimum': 0}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'days': {'key': 'days', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(RetentionPolicy, self).__init__(**kwargs) + self.enabled = kwargs.get('enabled', None) + self.days = kwargs.get('days', None) + + +class RuleAction(Model): + """The action that is performed when the alert rule becomes active, and when + an alert condition is resolved. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: RuleEmailAction, RuleWebhookAction + + All required parameters must be populated in order to send to Azure. + + :param odatatype: Required. Constant filled by server. + :type odatatype: str + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + } + + _subtype_map = { + 'odatatype': {'Microsoft.Azure.Management.Insights.Models.RuleEmailAction': 'RuleEmailAction', 'Microsoft.Azure.Management.Insights.Models.RuleWebhookAction': 'RuleWebhookAction'} + } + + def __init__(self, **kwargs): + super(RuleAction, self).__init__(**kwargs) + self.odatatype = None + + +class RuleDataSource(Model): + """The resource from which the rule collects its data. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: RuleMetricDataSource, RuleManagementEventDataSource + + All required parameters must be populated in order to send to Azure. + + :param resource_uri: the resource identifier of the resource the rule + monitors. **NOTE**: this property cannot be updated for an existing rule. + :type resource_uri: str + :param odatatype: Required. Constant filled by server. + :type odatatype: str + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + } + + _subtype_map = { + 'odatatype': {'Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource': 'RuleMetricDataSource', 'Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource': 'RuleManagementEventDataSource'} + } + + def __init__(self, **kwargs): + super(RuleDataSource, self).__init__(**kwargs) + self.resource_uri = kwargs.get('resource_uri', None) + self.odatatype = None + + +class RuleEmailAction(RuleAction): + """Specifies the action to send email when the rule condition is evaluated. + The discriminator is always RuleEmailAction in this case. + + All required parameters must be populated in order to send to Azure. + + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param send_to_service_owners: Whether the administrators (service and + co-administrators) of the service should be notified when the alert is + activated. + :type send_to_service_owners: bool + :param custom_emails: the list of administrator's custom email addresses + to notify of the activation of the alert. + :type custom_emails: list[str] + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'send_to_service_owners': {'key': 'sendToServiceOwners', 'type': 'bool'}, + 'custom_emails': {'key': 'customEmails', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(RuleEmailAction, self).__init__(**kwargs) + self.send_to_service_owners = kwargs.get('send_to_service_owners', None) + self.custom_emails = kwargs.get('custom_emails', None) + self.odatatype = 'Microsoft.Azure.Management.Insights.Models.RuleEmailAction' + + +class RuleManagementEventClaimsDataSource(Model): + """The claims for a rule management event data source. + + :param email_address: the email address. + :type email_address: str + """ + + _attribute_map = { + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(RuleManagementEventClaimsDataSource, self).__init__(**kwargs) + self.email_address = kwargs.get('email_address', None) + + +class RuleManagementEventDataSource(RuleDataSource): + """A rule management event data source. The discriminator fields is always + RuleManagementEventDataSource in this case. + + All required parameters must be populated in order to send to Azure. + + :param resource_uri: the resource identifier of the resource the rule + monitors. **NOTE**: this property cannot be updated for an existing rule. + :type resource_uri: str + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param event_name: the event name. + :type event_name: str + :param event_source: the event source. + :type event_source: str + :param level: the level. + :type level: str + :param operation_name: The name of the operation that should be checked + for. If no name is provided, any operation will match. + :type operation_name: str + :param resource_group_name: the resource group name. + :type resource_group_name: str + :param resource_provider_name: the resource provider name. + :type resource_provider_name: str + :param status: The status of the operation that should be checked for. If + no status is provided, any status will match. + :type status: str + :param sub_status: the substatus. + :type sub_status: str + :param claims: the claims. + :type claims: + ~azure.mgmt.monitor.v2016_03_01.models.RuleManagementEventClaimsDataSource + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'event_name': {'key': 'eventName', 'type': 'str'}, + 'event_source': {'key': 'eventSource', 'type': 'str'}, + 'level': {'key': 'level', 'type': 'str'}, + 'operation_name': {'key': 'operationName', 'type': 'str'}, + 'resource_group_name': {'key': 'resourceGroupName', 'type': 'str'}, + 'resource_provider_name': {'key': 'resourceProviderName', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'sub_status': {'key': 'subStatus', 'type': 'str'}, + 'claims': {'key': 'claims', 'type': 'RuleManagementEventClaimsDataSource'}, + } + + def __init__(self, **kwargs): + super(RuleManagementEventDataSource, self).__init__(**kwargs) + self.event_name = kwargs.get('event_name', None) + self.event_source = kwargs.get('event_source', None) + self.level = kwargs.get('level', None) + self.operation_name = kwargs.get('operation_name', None) + self.resource_group_name = kwargs.get('resource_group_name', None) + self.resource_provider_name = kwargs.get('resource_provider_name', None) + self.status = kwargs.get('status', None) + self.sub_status = kwargs.get('sub_status', None) + self.claims = kwargs.get('claims', None) + self.odatatype = 'Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource' + + +class RuleMetricDataSource(RuleDataSource): + """A rule metric data source. The discriminator value is always + RuleMetricDataSource in this case. + + All required parameters must be populated in order to send to Azure. + + :param resource_uri: the resource identifier of the resource the rule + monitors. **NOTE**: this property cannot be updated for an existing rule. + :type resource_uri: str + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param metric_name: the name of the metric that defines what the rule + monitors. + :type metric_name: str + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'metric_name': {'key': 'metricName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(RuleMetricDataSource, self).__init__(**kwargs) + self.metric_name = kwargs.get('metric_name', None) + self.odatatype = 'Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource' + + +class RuleWebhookAction(RuleAction): + """Specifies the action to post to service when the rule condition is + evaluated. The discriminator is always RuleWebhookAction in this case. + + All required parameters must be populated in order to send to Azure. + + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param service_uri: the service uri to Post the notification when the + alert activates or resolves. + :type service_uri: str + :param properties: the dictionary of custom properties to include with the + post operation. These data are appended to the webhook payload. + :type properties: dict[str, str] + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(RuleWebhookAction, self).__init__(**kwargs) + self.service_uri = kwargs.get('service_uri', None) + self.properties = kwargs.get('properties', None) + self.odatatype = 'Microsoft.Azure.Management.Insights.Models.RuleWebhookAction' + + +class ThresholdRuleCondition(RuleCondition): + """A rule condition based on a metric crossing a threshold. + + All required parameters must be populated in order to send to Azure. + + :param data_source: the resource from which the rule collects its data. + For this type dataSource will always be of type RuleMetricDataSource. + :type data_source: ~azure.mgmt.monitor.v2016_03_01.models.RuleDataSource + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param operator: Required. the operator used to compare the data and the + threshold. Possible values include: 'GreaterThan', 'GreaterThanOrEqual', + 'LessThan', 'LessThanOrEqual' + :type operator: str or + ~azure.mgmt.monitor.v2016_03_01.models.ConditionOperator + :param threshold: Required. the threshold value that activates the alert. + :type threshold: float + :param window_size: the period of time (in ISO 8601 duration format) that + is used to monitor alert activity based on the threshold. If specified + then it must be between 5 minutes and 1 day. + :type window_size: timedelta + :param time_aggregation: the time aggregation operator. How the data that + are collected should be combined over time. The default value is the + PrimaryAggregationType of the Metric. Possible values include: 'Average', + 'Minimum', 'Maximum', 'Total', 'Last' + :type time_aggregation: str or + ~azure.mgmt.monitor.v2016_03_01.models.TimeAggregationOperator + """ + + _validation = { + 'odatatype': {'required': True}, + 'operator': {'required': True}, + 'threshold': {'required': True}, + } + + _attribute_map = { + 'data_source': {'key': 'dataSource', 'type': 'RuleDataSource'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'ConditionOperator'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + 'window_size': {'key': 'windowSize', 'type': 'duration'}, + 'time_aggregation': {'key': 'timeAggregation', 'type': 'TimeAggregationOperator'}, + } + + def __init__(self, **kwargs): + super(ThresholdRuleCondition, self).__init__(**kwargs) + self.operator = kwargs.get('operator', None) + self.threshold = kwargs.get('threshold', None) + self.window_size = kwargs.get('window_size', None) + self.time_aggregation = kwargs.get('time_aggregation', None) + self.odatatype = 'Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition' diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_models_py3.py new file mode 100644 index 000000000000..df6e31f7e275 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_models_py3.py @@ -0,0 +1,952 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class Resource(Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, location: str, tags=None, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class AlertRuleResource(Resource): + """The alert rule resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param alert_rule_resource_name: Required. the name of the alert rule. + :type alert_rule_resource_name: str + :param description: the description of the alert rule that will be + included in the alert email. + :type description: str + :param is_enabled: Required. the flag that indicates whether the alert + rule is enabled. + :type is_enabled: bool + :param condition: Required. the condition that results in the alert rule + being activated. + :type condition: ~azure.mgmt.monitor.v2016_03_01.models.RuleCondition + :param actions: the array of actions that are performed when the alert + rule becomes active, and when an alert condition is resolved. + :type actions: list[~azure.mgmt.monitor.v2016_03_01.models.RuleAction] + :ivar last_updated_time: Last time the rule was updated in ISO8601 format. + :vartype last_updated_time: datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'alert_rule_resource_name': {'required': True}, + 'is_enabled': {'required': True}, + 'condition': {'required': True}, + 'last_updated_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'alert_rule_resource_name': {'key': 'properties.name', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, + 'condition': {'key': 'properties.condition', 'type': 'RuleCondition'}, + 'actions': {'key': 'properties.actions', 'type': '[RuleAction]'}, + 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + } + + def __init__(self, *, location: str, alert_rule_resource_name: str, is_enabled: bool, condition, tags=None, description: str=None, actions=None, **kwargs) -> None: + super(AlertRuleResource, self).__init__(location=location, tags=tags, **kwargs) + self.alert_rule_resource_name = alert_rule_resource_name + self.description = description + self.is_enabled = is_enabled + self.condition = condition + self.actions = actions + self.last_updated_time = None + + +class AlertRuleResourcePatch(Model): + """The alert rule object for patch operations. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param tags: Resource tags + :type tags: dict[str, str] + :param name: Required. the name of the alert rule. + :type name: str + :param description: the description of the alert rule that will be + included in the alert email. + :type description: str + :param is_enabled: Required. the flag that indicates whether the alert + rule is enabled. + :type is_enabled: bool + :param condition: Required. the condition that results in the alert rule + being activated. + :type condition: ~azure.mgmt.monitor.v2016_03_01.models.RuleCondition + :param actions: the array of actions that are performed when the alert + rule becomes active, and when an alert condition is resolved. + :type actions: list[~azure.mgmt.monitor.v2016_03_01.models.RuleAction] + :ivar last_updated_time: Last time the rule was updated in ISO8601 format. + :vartype last_updated_time: datetime + """ + + _validation = { + 'name': {'required': True}, + 'is_enabled': {'required': True}, + 'condition': {'required': True}, + 'last_updated_time': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'name': {'key': 'properties.name', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, + 'condition': {'key': 'properties.condition', 'type': 'RuleCondition'}, + 'actions': {'key': 'properties.actions', 'type': '[RuleAction]'}, + 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + } + + def __init__(self, *, name: str, is_enabled: bool, condition, tags=None, description: str=None, actions=None, **kwargs) -> None: + super(AlertRuleResourcePatch, self).__init__(**kwargs) + self.tags = tags + self.name = name + self.description = description + self.is_enabled = is_enabled + self.condition = condition + self.actions = actions + self.last_updated_time = None + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class Incident(Model): + """An alert incident indicates the activation status of an alert rule. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Incident name. + :vartype name: str + :ivar rule_name: Rule name that is associated with the incident. + :vartype rule_name: str + :ivar is_active: A boolean to indicate whether the incident is active or + resolved. + :vartype is_active: bool + :ivar activated_time: The time at which the incident was activated in + ISO8601 format. + :vartype activated_time: datetime + :ivar resolved_time: The time at which the incident was resolved in + ISO8601 format. If null, it means the incident is still active. + :vartype resolved_time: datetime + """ + + _validation = { + 'name': {'readonly': True}, + 'rule_name': {'readonly': True}, + 'is_active': {'readonly': True}, + 'activated_time': {'readonly': True}, + 'resolved_time': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'rule_name': {'key': 'ruleName', 'type': 'str'}, + 'is_active': {'key': 'isActive', 'type': 'bool'}, + 'activated_time': {'key': 'activatedTime', 'type': 'iso-8601'}, + 'resolved_time': {'key': 'resolvedTime', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs) -> None: + super(Incident, self).__init__(**kwargs) + self.name = None + self.rule_name = None + self.is_active = None + self.activated_time = None + self.resolved_time = None + + +class LocalizableString(Model): + """The localizable string class. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. the invariant value. + :type value: str + :param localized_value: the locale specific value. + :type localized_value: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__(self, *, value: str, localized_value: str=None, **kwargs) -> None: + super(LocalizableString, self).__init__(**kwargs) + self.value = value + self.localized_value = localized_value + + +class RuleCondition(Model): + """The condition that results in the alert rule being activated. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ThresholdRuleCondition, LocationThresholdRuleCondition, + ManagementEventRuleCondition + + All required parameters must be populated in order to send to Azure. + + :param data_source: the resource from which the rule collects its data. + For this type dataSource will always be of type RuleMetricDataSource. + :type data_source: ~azure.mgmt.monitor.v2016_03_01.models.RuleDataSource + :param odatatype: Required. Constant filled by server. + :type odatatype: str + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'data_source': {'key': 'dataSource', 'type': 'RuleDataSource'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + } + + _subtype_map = { + 'odatatype': {'Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition': 'ThresholdRuleCondition', 'Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition': 'LocationThresholdRuleCondition', 'Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition': 'ManagementEventRuleCondition'} + } + + def __init__(self, *, data_source=None, **kwargs) -> None: + super(RuleCondition, self).__init__(**kwargs) + self.data_source = data_source + self.odatatype = None + + +class LocationThresholdRuleCondition(RuleCondition): + """A rule condition based on a certain number of locations failing. + + All required parameters must be populated in order to send to Azure. + + :param data_source: the resource from which the rule collects its data. + For this type dataSource will always be of type RuleMetricDataSource. + :type data_source: ~azure.mgmt.monitor.v2016_03_01.models.RuleDataSource + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param window_size: the period of time (in ISO 8601 duration format) that + is used to monitor alert activity based on the threshold. If specified + then it must be between 5 minutes and 1 day. + :type window_size: timedelta + :param failed_location_count: Required. the number of locations that must + fail to activate the alert. + :type failed_location_count: int + """ + + _validation = { + 'odatatype': {'required': True}, + 'failed_location_count': {'required': True, 'minimum': 0}, + } + + _attribute_map = { + 'data_source': {'key': 'dataSource', 'type': 'RuleDataSource'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'window_size': {'key': 'windowSize', 'type': 'duration'}, + 'failed_location_count': {'key': 'failedLocationCount', 'type': 'int'}, + } + + def __init__(self, *, failed_location_count: int, data_source=None, window_size=None, **kwargs) -> None: + super(LocationThresholdRuleCondition, self).__init__(data_source=data_source, **kwargs) + self.window_size = window_size + self.failed_location_count = failed_location_count + self.odatatype = 'Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition' + + +class LogProfileResource(Resource): + """The log profile resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param storage_account_id: the resource id of the storage account to which + you would like to send the Activity Log. + :type storage_account_id: str + :param service_bus_rule_id: The service bus rule ID of the service bus + namespace in which you would like to have Event Hubs created for streaming + the Activity Log. The rule ID is of the format: '{service bus resource + ID}/authorizationrules/{key name}'. + :type service_bus_rule_id: str + :param locations: Required. List of regions for which Activity Log events + should be stored or streamed. It is a comma separated list of valid ARM + locations including the 'global' location. + :type locations: list[str] + :param categories: Required. the categories of the logs. These categories + are created as is convenient to the user. Some values are: 'Write', + 'Delete', and/or 'Action.' + :type categories: list[str] + :param retention_policy: Required. the retention policy for the events in + the log. + :type retention_policy: + ~azure.mgmt.monitor.v2016_03_01.models.RetentionPolicy + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'locations': {'required': True}, + 'categories': {'required': True}, + 'retention_policy': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, + 'locations': {'key': 'properties.locations', 'type': '[str]'}, + 'categories': {'key': 'properties.categories', 'type': '[str]'}, + 'retention_policy': {'key': 'properties.retentionPolicy', 'type': 'RetentionPolicy'}, + } + + def __init__(self, *, location: str, locations, categories, retention_policy, tags=None, storage_account_id: str=None, service_bus_rule_id: str=None, **kwargs) -> None: + super(LogProfileResource, self).__init__(location=location, tags=tags, **kwargs) + self.storage_account_id = storage_account_id + self.service_bus_rule_id = service_bus_rule_id + self.locations = locations + self.categories = categories + self.retention_policy = retention_policy + + +class LogProfileResourcePatch(Model): + """The log profile resource for patch operations. + + All required parameters must be populated in order to send to Azure. + + :param tags: Resource tags + :type tags: dict[str, str] + :param storage_account_id: the resource id of the storage account to which + you would like to send the Activity Log. + :type storage_account_id: str + :param service_bus_rule_id: The service bus rule ID of the service bus + namespace in which you would like to have Event Hubs created for streaming + the Activity Log. The rule ID is of the format: '{service bus resource + ID}/authorizationrules/{key name}'. + :type service_bus_rule_id: str + :param locations: Required. List of regions for which Activity Log events + should be stored or streamed. It is a comma separated list of valid ARM + locations including the 'global' location. + :type locations: list[str] + :param categories: Required. the categories of the logs. These categories + are created as is convenient to the user. Some values are: 'Write', + 'Delete', and/or 'Action.' + :type categories: list[str] + :param retention_policy: Required. the retention policy for the events in + the log. + :type retention_policy: + ~azure.mgmt.monitor.v2016_03_01.models.RetentionPolicy + """ + + _validation = { + 'locations': {'required': True}, + 'categories': {'required': True}, + 'retention_policy': {'required': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, + 'locations': {'key': 'properties.locations', 'type': '[str]'}, + 'categories': {'key': 'properties.categories', 'type': '[str]'}, + 'retention_policy': {'key': 'properties.retentionPolicy', 'type': 'RetentionPolicy'}, + } + + def __init__(self, *, locations, categories, retention_policy, tags=None, storage_account_id: str=None, service_bus_rule_id: str=None, **kwargs) -> None: + super(LogProfileResourcePatch, self).__init__(**kwargs) + self.tags = tags + self.storage_account_id = storage_account_id + self.service_bus_rule_id = service_bus_rule_id + self.locations = locations + self.categories = categories + self.retention_policy = retention_policy + + +class ManagementEventAggregationCondition(Model): + """How the data that is collected should be combined over time. + + :param operator: the condition operator. Possible values include: + 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' + :type operator: str or + ~azure.mgmt.monitor.v2016_03_01.models.ConditionOperator + :param threshold: The threshold value that activates the alert. + :type threshold: float + :param window_size: the period of time (in ISO 8601 duration format) that + is used to monitor alert activity based on the threshold. If specified + then it must be between 5 minutes and 1 day. + :type window_size: timedelta + """ + + _attribute_map = { + 'operator': {'key': 'operator', 'type': 'ConditionOperator'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + 'window_size': {'key': 'windowSize', 'type': 'duration'}, + } + + def __init__(self, *, operator=None, threshold: float=None, window_size=None, **kwargs) -> None: + super(ManagementEventAggregationCondition, self).__init__(**kwargs) + self.operator = operator + self.threshold = threshold + self.window_size = window_size + + +class ManagementEventRuleCondition(RuleCondition): + """A management event rule condition. + + All required parameters must be populated in order to send to Azure. + + :param data_source: the resource from which the rule collects its data. + For this type dataSource will always be of type RuleMetricDataSource. + :type data_source: ~azure.mgmt.monitor.v2016_03_01.models.RuleDataSource + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param aggregation: How the data that is collected should be combined over + time and when the alert is activated. Note that for management event + alerts aggregation is optional – if it is not provided then any event will + cause the alert to activate. + :type aggregation: + ~azure.mgmt.monitor.v2016_03_01.models.ManagementEventAggregationCondition + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'data_source': {'key': 'dataSource', 'type': 'RuleDataSource'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'aggregation': {'key': 'aggregation', 'type': 'ManagementEventAggregationCondition'}, + } + + def __init__(self, *, data_source=None, aggregation=None, **kwargs) -> None: + super(ManagementEventRuleCondition, self).__init__(data_source=data_source, **kwargs) + self.aggregation = aggregation + self.odatatype = 'Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition' + + +class MetricAvailability(Model): + """Metric availability specifies the time grain (aggregation interval or + frequency) and the retention period for that time grain. + + :param time_grain: the time grain specifies the aggregation interval for + the metric. Expressed as a duration 'PT1M', 'P1D', etc. + :type time_grain: timedelta + :param retention: the retention period for the metric at the specified + timegrain. Expressed as a duration 'PT1M', 'P1D', etc. + :type retention: timedelta + """ + + _attribute_map = { + 'time_grain': {'key': 'timeGrain', 'type': 'duration'}, + 'retention': {'key': 'retention', 'type': 'duration'}, + } + + def __init__(self, *, time_grain=None, retention=None, **kwargs) -> None: + super(MetricAvailability, self).__init__(**kwargs) + self.time_grain = time_grain + self.retention = retention + + +class MetricDefinition(Model): + """Metric definition class specifies the metadata for a metric. + + :param resource_id: the resource identifier of the resource that emitted + the metric. + :type resource_id: str + :param name: the name and the display name of the metric, i.e. it is a + localizable string. + :type name: ~azure.mgmt.monitor.v2016_03_01.models.LocalizableString + :param unit: the unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', + 'MilliSeconds' + :type unit: str or ~azure.mgmt.monitor.v2016_03_01.models.Unit + :param primary_aggregation_type: the primary aggregation type value + defining how to use the values for display. Possible values include: + 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' + :type primary_aggregation_type: str or + ~azure.mgmt.monitor.v2016_03_01.models.AggregationType + :param metric_availabilities: the collection of what aggregation intervals + are available to be queried. + :type metric_availabilities: + list[~azure.mgmt.monitor.v2016_03_01.models.MetricAvailability] + :param id: the resource identifier of the metric definition. + :type id: str + """ + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'unit': {'key': 'unit', 'type': 'Unit'}, + 'primary_aggregation_type': {'key': 'primaryAggregationType', 'type': 'AggregationType'}, + 'metric_availabilities': {'key': 'metricAvailabilities', 'type': '[MetricAvailability]'}, + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, resource_id: str=None, name=None, unit=None, primary_aggregation_type=None, metric_availabilities=None, id: str=None, **kwargs) -> None: + super(MetricDefinition, self).__init__(**kwargs) + self.resource_id = resource_id + self.name = name + self.unit = unit + self.primary_aggregation_type = primary_aggregation_type + self.metric_availabilities = metric_availabilities + self.id = id + + +class RetentionPolicy(Model): + """Specifies the retention policy for the log. + + All required parameters must be populated in order to send to Azure. + + :param enabled: Required. a value indicating whether the retention policy + is enabled. + :type enabled: bool + :param days: Required. the number of days for the retention in days. A + value of 0 will retain the events indefinitely. + :type days: int + """ + + _validation = { + 'enabled': {'required': True}, + 'days': {'required': True, 'minimum': 0}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'days': {'key': 'days', 'type': 'int'}, + } + + def __init__(self, *, enabled: bool, days: int, **kwargs) -> None: + super(RetentionPolicy, self).__init__(**kwargs) + self.enabled = enabled + self.days = days + + +class RuleAction(Model): + """The action that is performed when the alert rule becomes active, and when + an alert condition is resolved. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: RuleEmailAction, RuleWebhookAction + + All required parameters must be populated in order to send to Azure. + + :param odatatype: Required. Constant filled by server. + :type odatatype: str + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + } + + _subtype_map = { + 'odatatype': {'Microsoft.Azure.Management.Insights.Models.RuleEmailAction': 'RuleEmailAction', 'Microsoft.Azure.Management.Insights.Models.RuleWebhookAction': 'RuleWebhookAction'} + } + + def __init__(self, **kwargs) -> None: + super(RuleAction, self).__init__(**kwargs) + self.odatatype = None + + +class RuleDataSource(Model): + """The resource from which the rule collects its data. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: RuleMetricDataSource, RuleManagementEventDataSource + + All required parameters must be populated in order to send to Azure. + + :param resource_uri: the resource identifier of the resource the rule + monitors. **NOTE**: this property cannot be updated for an existing rule. + :type resource_uri: str + :param odatatype: Required. Constant filled by server. + :type odatatype: str + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + } + + _subtype_map = { + 'odatatype': {'Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource': 'RuleMetricDataSource', 'Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource': 'RuleManagementEventDataSource'} + } + + def __init__(self, *, resource_uri: str=None, **kwargs) -> None: + super(RuleDataSource, self).__init__(**kwargs) + self.resource_uri = resource_uri + self.odatatype = None + + +class RuleEmailAction(RuleAction): + """Specifies the action to send email when the rule condition is evaluated. + The discriminator is always RuleEmailAction in this case. + + All required parameters must be populated in order to send to Azure. + + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param send_to_service_owners: Whether the administrators (service and + co-administrators) of the service should be notified when the alert is + activated. + :type send_to_service_owners: bool + :param custom_emails: the list of administrator's custom email addresses + to notify of the activation of the alert. + :type custom_emails: list[str] + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'send_to_service_owners': {'key': 'sendToServiceOwners', 'type': 'bool'}, + 'custom_emails': {'key': 'customEmails', 'type': '[str]'}, + } + + def __init__(self, *, send_to_service_owners: bool=None, custom_emails=None, **kwargs) -> None: + super(RuleEmailAction, self).__init__(**kwargs) + self.send_to_service_owners = send_to_service_owners + self.custom_emails = custom_emails + self.odatatype = 'Microsoft.Azure.Management.Insights.Models.RuleEmailAction' + + +class RuleManagementEventClaimsDataSource(Model): + """The claims for a rule management event data source. + + :param email_address: the email address. + :type email_address: str + """ + + _attribute_map = { + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + } + + def __init__(self, *, email_address: str=None, **kwargs) -> None: + super(RuleManagementEventClaimsDataSource, self).__init__(**kwargs) + self.email_address = email_address + + +class RuleManagementEventDataSource(RuleDataSource): + """A rule management event data source. The discriminator fields is always + RuleManagementEventDataSource in this case. + + All required parameters must be populated in order to send to Azure. + + :param resource_uri: the resource identifier of the resource the rule + monitors. **NOTE**: this property cannot be updated for an existing rule. + :type resource_uri: str + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param event_name: the event name. + :type event_name: str + :param event_source: the event source. + :type event_source: str + :param level: the level. + :type level: str + :param operation_name: The name of the operation that should be checked + for. If no name is provided, any operation will match. + :type operation_name: str + :param resource_group_name: the resource group name. + :type resource_group_name: str + :param resource_provider_name: the resource provider name. + :type resource_provider_name: str + :param status: The status of the operation that should be checked for. If + no status is provided, any status will match. + :type status: str + :param sub_status: the substatus. + :type sub_status: str + :param claims: the claims. + :type claims: + ~azure.mgmt.monitor.v2016_03_01.models.RuleManagementEventClaimsDataSource + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'event_name': {'key': 'eventName', 'type': 'str'}, + 'event_source': {'key': 'eventSource', 'type': 'str'}, + 'level': {'key': 'level', 'type': 'str'}, + 'operation_name': {'key': 'operationName', 'type': 'str'}, + 'resource_group_name': {'key': 'resourceGroupName', 'type': 'str'}, + 'resource_provider_name': {'key': 'resourceProviderName', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'sub_status': {'key': 'subStatus', 'type': 'str'}, + 'claims': {'key': 'claims', 'type': 'RuleManagementEventClaimsDataSource'}, + } + + def __init__(self, *, resource_uri: str=None, event_name: str=None, event_source: str=None, level: str=None, operation_name: str=None, resource_group_name: str=None, resource_provider_name: str=None, status: str=None, sub_status: str=None, claims=None, **kwargs) -> None: + super(RuleManagementEventDataSource, self).__init__(resource_uri=resource_uri, **kwargs) + self.event_name = event_name + self.event_source = event_source + self.level = level + self.operation_name = operation_name + self.resource_group_name = resource_group_name + self.resource_provider_name = resource_provider_name + self.status = status + self.sub_status = sub_status + self.claims = claims + self.odatatype = 'Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource' + + +class RuleMetricDataSource(RuleDataSource): + """A rule metric data source. The discriminator value is always + RuleMetricDataSource in this case. + + All required parameters must be populated in order to send to Azure. + + :param resource_uri: the resource identifier of the resource the rule + monitors. **NOTE**: this property cannot be updated for an existing rule. + :type resource_uri: str + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param metric_name: the name of the metric that defines what the rule + monitors. + :type metric_name: str + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'metric_name': {'key': 'metricName', 'type': 'str'}, + } + + def __init__(self, *, resource_uri: str=None, metric_name: str=None, **kwargs) -> None: + super(RuleMetricDataSource, self).__init__(resource_uri=resource_uri, **kwargs) + self.metric_name = metric_name + self.odatatype = 'Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource' + + +class RuleWebhookAction(RuleAction): + """Specifies the action to post to service when the rule condition is + evaluated. The discriminator is always RuleWebhookAction in this case. + + All required parameters must be populated in order to send to Azure. + + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param service_uri: the service uri to Post the notification when the + alert activates or resolves. + :type service_uri: str + :param properties: the dictionary of custom properties to include with the + post operation. These data are appended to the webhook payload. + :type properties: dict[str, str] + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + } + + def __init__(self, *, service_uri: str=None, properties=None, **kwargs) -> None: + super(RuleWebhookAction, self).__init__(**kwargs) + self.service_uri = service_uri + self.properties = properties + self.odatatype = 'Microsoft.Azure.Management.Insights.Models.RuleWebhookAction' + + +class ThresholdRuleCondition(RuleCondition): + """A rule condition based on a metric crossing a threshold. + + All required parameters must be populated in order to send to Azure. + + :param data_source: the resource from which the rule collects its data. + For this type dataSource will always be of type RuleMetricDataSource. + :type data_source: ~azure.mgmt.monitor.v2016_03_01.models.RuleDataSource + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param operator: Required. the operator used to compare the data and the + threshold. Possible values include: 'GreaterThan', 'GreaterThanOrEqual', + 'LessThan', 'LessThanOrEqual' + :type operator: str or + ~azure.mgmt.monitor.v2016_03_01.models.ConditionOperator + :param threshold: Required. the threshold value that activates the alert. + :type threshold: float + :param window_size: the period of time (in ISO 8601 duration format) that + is used to monitor alert activity based on the threshold. If specified + then it must be between 5 minutes and 1 day. + :type window_size: timedelta + :param time_aggregation: the time aggregation operator. How the data that + are collected should be combined over time. The default value is the + PrimaryAggregationType of the Metric. Possible values include: 'Average', + 'Minimum', 'Maximum', 'Total', 'Last' + :type time_aggregation: str or + ~azure.mgmt.monitor.v2016_03_01.models.TimeAggregationOperator + """ + + _validation = { + 'odatatype': {'required': True}, + 'operator': {'required': True}, + 'threshold': {'required': True}, + } + + _attribute_map = { + 'data_source': {'key': 'dataSource', 'type': 'RuleDataSource'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'ConditionOperator'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + 'window_size': {'key': 'windowSize', 'type': 'duration'}, + 'time_aggregation': {'key': 'timeAggregation', 'type': 'TimeAggregationOperator'}, + } + + def __init__(self, *, operator, threshold: float, data_source=None, window_size=None, time_aggregation=None, **kwargs) -> None: + super(ThresholdRuleCondition, self).__init__(data_source=data_source, **kwargs) + self.operator = operator + self.threshold = threshold + self.window_size = window_size + self.time_aggregation = time_aggregation + self.odatatype = 'Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition' diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_monitor_management_client_enums.py new file mode 100644 index 000000000000..a051ed81a74f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_monitor_management_client_enums.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 enum import Enum + + +class ConditionOperator(str, Enum): + + greater_than = "GreaterThan" + greater_than_or_equal = "GreaterThanOrEqual" + less_than = "LessThan" + less_than_or_equal = "LessThanOrEqual" + + +class TimeAggregationOperator(str, Enum): + + average = "Average" + minimum = "Minimum" + maximum = "Maximum" + total = "Total" + last = "Last" + + +class Unit(str, Enum): + + count = "Count" + bytes = "Bytes" + seconds = "Seconds" + count_per_second = "CountPerSecond" + bytes_per_second = "BytesPerSecond" + percent = "Percent" + milli_seconds = "MilliSeconds" + + +class AggregationType(str, Enum): + + none = "None" + average = "Average" + count = "Count" + minimum = "Minimum" + maximum = "Maximum" + total = "Total" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_paged_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_paged_models.py new file mode 100644 index 000000000000..c28f05dfe162 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_paged_models.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class IncidentPaged(Paged): + """ + A paging container for iterating over a list of :class:`Incident ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Incident]'} + } + + def __init__(self, *args, **kwargs): + + super(IncidentPaged, self).__init__(*args, **kwargs) +class AlertRuleResourcePaged(Paged): + """ + A paging container for iterating over a list of :class:`AlertRuleResource ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[AlertRuleResource]'} + } + + def __init__(self, *args, **kwargs): + + super(AlertRuleResourcePaged, self).__init__(*args, **kwargs) +class LogProfileResourcePaged(Paged): + """ + A paging container for iterating over a list of :class:`LogProfileResource ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[LogProfileResource]'} + } + + def __init__(self, *args, **kwargs): + + super(LogProfileResourcePaged, self).__init__(*args, **kwargs) +class MetricDefinitionPaged(Paged): + """ + A paging container for iterating over a list of :class:`MetricDefinition ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[MetricDefinition]'} + } + + def __init__(self, *args, **kwargs): + + super(MetricDefinitionPaged, self).__init__(*args, **kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/__init__.py new file mode 100644 index 000000000000..d0b33a205511 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._alert_rule_incidents_operations import AlertRuleIncidentsOperations +from ._alert_rules_operations import AlertRulesOperations +from ._log_profiles_operations import LogProfilesOperations +from ._metric_definitions_operations import MetricDefinitionsOperations + +__all__ = [ + 'AlertRuleIncidentsOperations', + 'AlertRulesOperations', + 'LogProfilesOperations', + 'MetricDefinitionsOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_alert_rule_incidents_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_alert_rule_incidents_operations.py new file mode 100644 index 000000000000..f95ca1e57214 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_alert_rule_incidents_operations.py @@ -0,0 +1,175 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class AlertRuleIncidentsOperations(object): + """AlertRuleIncidentsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2016-03-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2016-03-01" + + self.config = config + + def get( + self, resource_group_name, rule_name, incident_name, custom_headers=None, raw=False, **operation_config): + """Gets an incident associated to an alert rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param incident_name: The name of the incident to retrieve. + :type incident_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Incident or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2016_03_01.models.Incident or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + 'incidentName': self._serialize.url("incident_name", incident_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Incident', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents/{incidentName}'} + + def list_by_alert_rule( + self, resource_group_name, rule_name, custom_headers=None, raw=False, **operation_config): + """Gets a list of incidents associated to an alert rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Incident + :rtype: + ~azure.mgmt.monitor.v2016_03_01.models.IncidentPaged[~azure.mgmt.monitor.v2016_03_01.models.Incident] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_alert_rule.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.IncidentPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_alert_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_alert_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_alert_rules_operations.py new file mode 100644 index 000000000000..25edadff7828 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_alert_rules_operations.py @@ -0,0 +1,428 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class AlertRulesOperations(object): + """AlertRulesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2016-03-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2016-03-01" + + self.config = config + + def create_or_update( + self, resource_group_name, rule_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates an alert rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param parameters: The parameters of the rule to create or update. + :type parameters: + ~azure.mgmt.monitor.v2016_03_01.models.AlertRuleResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AlertRuleResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2016_03_01.models.AlertRuleResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'AlertRuleResource') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AlertRuleResource', response) + if response.status_code == 201: + deserialized = self._deserialize('AlertRuleResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}'} + + def delete( + self, resource_group_name, rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes an alert rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}'} + + def get( + self, resource_group_name, rule_name, custom_headers=None, raw=False, **operation_config): + """Gets an alert rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AlertRuleResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2016_03_01.models.AlertRuleResource or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AlertRuleResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}'} + + def update( + self, resource_group_name, rule_name, alert_rules_resource, custom_headers=None, raw=False, **operation_config): + """Updates an existing AlertRuleResource. To update other fields use the + CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param alert_rules_resource: Parameters supplied to the operation. + :type alert_rules_resource: + ~azure.mgmt.monitor.v2016_03_01.models.AlertRuleResourcePatch + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AlertRuleResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2016_03_01.models.AlertRuleResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(alert_rules_resource, 'AlertRuleResourcePatch') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AlertRuleResource', response) + if response.status_code == 201: + deserialized = self._deserialize('AlertRuleResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """List the alert rules within a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of AlertRuleResource + :rtype: + ~azure.mgmt.monitor.v2016_03_01.models.AlertRuleResourcePaged[~azure.mgmt.monitor.v2016_03_01.models.AlertRuleResource] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.AlertRuleResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules'} + + def list_by_subscription( + self, custom_headers=None, raw=False, **operation_config): + """List the alert rules within a subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of AlertRuleResource + :rtype: + ~azure.mgmt.monitor.v2016_03_01.models.AlertRuleResourcePaged[~azure.mgmt.monitor.v2016_03_01.models.AlertRuleResource] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.AlertRuleResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/alertrules'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_log_profiles_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_log_profiles_operations.py new file mode 100644 index 000000000000..edf2c59bdbf0 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_log_profiles_operations.py @@ -0,0 +1,343 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class LogProfilesOperations(object): + """LogProfilesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2016-03-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2016-03-01" + + self.config = config + + def delete( + self, log_profile_name, custom_headers=None, raw=False, **operation_config): + """Deletes the log profile. + + :param log_profile_name: The name of the log profile. + :type log_profile_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'logProfileName': self._serialize.url("log_profile_name", log_profile_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}'} + + def get( + self, log_profile_name, custom_headers=None, raw=False, **operation_config): + """Gets the log profile. + + :param log_profile_name: The name of the log profile. + :type log_profile_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: LogProfileResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2016_03_01.models.LogProfileResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'logProfileName': self._serialize.url("log_profile_name", log_profile_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('LogProfileResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}'} + + def create_or_update( + self, log_profile_name, parameters, custom_headers=None, raw=False, **operation_config): + """Create or update a log profile in Azure Monitoring REST API. + + :param log_profile_name: The name of the log profile. + :type log_profile_name: str + :param parameters: Parameters supplied to the operation. + :type parameters: + ~azure.mgmt.monitor.v2016_03_01.models.LogProfileResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: LogProfileResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2016_03_01.models.LogProfileResource or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'logProfileName': self._serialize.url("log_profile_name", log_profile_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'LogProfileResource') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('LogProfileResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}'} + + def update( + self, log_profile_name, log_profiles_resource, custom_headers=None, raw=False, **operation_config): + """Updates an existing LogProfilesResource. To update other fields use the + CreateOrUpdate method. + + :param log_profile_name: The name of the log profile. + :type log_profile_name: str + :param log_profiles_resource: Parameters supplied to the operation. + :type log_profiles_resource: + ~azure.mgmt.monitor.v2016_03_01.models.LogProfileResourcePatch + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: LogProfileResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2016_03_01.models.LogProfileResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'logProfileName': self._serialize.url("log_profile_name", log_profile_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(log_profiles_resource, 'LogProfileResourcePatch') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('LogProfileResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}'} + + def list( + self, custom_headers=None, raw=False, **operation_config): + """List the log profiles. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of LogProfileResource + :rtype: + ~azure.mgmt.monitor.v2016_03_01.models.LogProfileResourcePaged[~azure.mgmt.monitor.v2016_03_01.models.LogProfileResource] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.LogProfileResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_metric_definitions_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_metric_definitions_operations.py new file mode 100644 index 000000000000..3b5fc8703778 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_metric_definitions_operations.py @@ -0,0 +1,116 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class MetricDefinitionsOperations(object): + """MetricDefinitionsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2016-03-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2016-03-01" + + self.config = config + + def list( + self, resource_uri, filter=None, custom_headers=None, raw=False, **operation_config): + """Lists the metric definitions for the resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param filter: Reduces the set of data collected by retrieving + particular metric definitions from all the definitions available for + the resource.
For example, to get just the definition for the 'CPU + percentage' counter: $filter=name.value eq '\\Processor(_Total)\\% + Processor Time'.
Multiple metrics can be retrieved by joining + together *'name eq '* clauses separated by *or* logical + operators.
**NOTE**: No other syntax is allowed. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of MetricDefinition + :rtype: + ~azure.mgmt.monitor.v2016_03_01.models.MetricDefinitionPaged[~azure.mgmt.monitor.v2016_03_01.models.MetricDefinition] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metricDefinitions'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/version.py new file mode 100644 index 000000000000..8c52a31098fd --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2016-03-01" + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/__init__.py new file mode 100644 index 000000000000..940dc0469831 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._configuration import MonitorClientConfiguration +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient', 'MonitorClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_configuration.py new file mode 100644 index 000000000000..010b91186aef --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_configuration.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +from msrestazure import AzureConfiguration + +from .version import VERSION + + +class MonitorClientConfiguration(AzureConfiguration): + """Configuration for MonitorClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param str base_url: Service URL + """ + + def __init__( + self, credentials, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(MonitorClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-monitor/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_monitor_client.py new file mode 100644 index 000000000000..6a70538e8937 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_monitor_client.py @@ -0,0 +1,52 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import MonitorClientConfiguration +from .operations import MetricsOperations +from .operations import ServiceDiagnosticSettingsOperations +from . import models + + +class MonitorClient(SDKClient): + """Monitor Management Client + + :ivar config: Configuration for client. + :vartype config: MonitorClientConfiguration + + :ivar metrics: Metrics operations + :vartype metrics: azure.mgmt.monitor.v2016_09_01.operations.MetricsOperations + :ivar service_diagnostic_settings: ServiceDiagnosticSettings operations + :vartype service_diagnostic_settings: azure.mgmt.monitor.v2016_09_01.operations.ServiceDiagnosticSettingsOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param str base_url: Service URL + """ + + def __init__( + self, credentials, base_url=None): + + self.config = MonitorClientConfiguration(credentials, base_url) + super(MonitorClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2016-09-01' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.metrics = MetricsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.service_diagnostic_settings = ServiceDiagnosticSettingsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/__init__.py new file mode 100644 index 000000000000..7bc776c9fb06 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/__init__.py @@ -0,0 +1,52 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import LocalizableString + from ._models_py3 import LogSettings + from ._models_py3 import Metric + from ._models_py3 import MetricSettings + from ._models_py3 import MetricValue + from ._models_py3 import Resource + from ._models_py3 import RetentionPolicy + from ._models_py3 import ServiceDiagnosticSettingsResource + from ._models_py3 import ServiceDiagnosticSettingsResourcePatch +except (SyntaxError, ImportError): + from ._models import ErrorResponse, ErrorResponseException + from ._models import LocalizableString + from ._models import LogSettings + from ._models import Metric + from ._models import MetricSettings + from ._models import MetricValue + from ._models import Resource + from ._models import RetentionPolicy + from ._models import ServiceDiagnosticSettingsResource + from ._models import ServiceDiagnosticSettingsResourcePatch +from ._paged_models import MetricPaged +from ._monitor_client_enums import ( + Unit, +) + +__all__ = [ + 'ErrorResponse', 'ErrorResponseException', + 'LocalizableString', + 'LogSettings', + 'Metric', + 'MetricSettings', + 'MetricValue', + 'Resource', + 'RetentionPolicy', + 'ServiceDiagnosticSettingsResource', + 'ServiceDiagnosticSettingsResourcePatch', + 'MetricPaged', + 'Unit', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_models.py new file mode 100644 index 000000000000..3ef44c6434f7 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_models.py @@ -0,0 +1,429 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class LocalizableString(Model): + """The localizable string class. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. the invariant value. + :type value: str + :param localized_value: the locale specific value. + :type localized_value: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(LocalizableString, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.localized_value = kwargs.get('localized_value', None) + + +class LogSettings(Model): + """Part of MultiTenantDiagnosticSettings. Specifies the settings for a + particular log. + + All required parameters must be populated in order to send to Azure. + + :param category: Name of a Diagnostic Log category for a resource type + this setting is applied to. To obtain the list of Diagnostic Log + categories for a resource, first perform a GET diagnostic settings + operation. + :type category: str + :param enabled: Required. a value indicating whether this log is enabled. + :type enabled: bool + :param retention_policy: the retention policy for this log. + :type retention_policy: + ~azure.mgmt.monitor.v2016_09_01.models.RetentionPolicy + """ + + _validation = { + 'enabled': {'required': True}, + } + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + } + + def __init__(self, **kwargs): + super(LogSettings, self).__init__(**kwargs) + self.category = kwargs.get('category', None) + self.enabled = kwargs.get('enabled', None) + self.retention_policy = kwargs.get('retention_policy', None) + + +class Metric(Model): + """A set of metric values in a time range. + + All required parameters must be populated in order to send to Azure. + + :param id: the id, resourceId, of the metric. + :type id: str + :param type: the resource type of the metric resource. + :type type: str + :param name: Required. the name and the display name of the metric, i.e. + it is localizable string. + :type name: ~azure.mgmt.monitor.v2016_09_01.models.LocalizableString + :param unit: Required. the unit of the metric. Possible values include: + 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', + 'Percent', 'MilliSeconds' + :type unit: str or ~azure.mgmt.monitor.v2016_09_01.models.Unit + :param data: Required. Array of data points representing the metric + values. + :type data: list[~azure.mgmt.monitor.v2016_09_01.models.MetricValue] + """ + + _validation = { + 'name': {'required': True}, + 'unit': {'required': True}, + 'data': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'unit': {'key': 'unit', 'type': 'Unit'}, + 'data': {'key': 'data', 'type': '[MetricValue]'}, + } + + def __init__(self, **kwargs): + super(Metric, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.type = kwargs.get('type', None) + self.name = kwargs.get('name', None) + self.unit = kwargs.get('unit', None) + self.data = kwargs.get('data', None) + + +class MetricSettings(Model): + """Part of MultiTenantDiagnosticSettings. Specifies the settings for a + particular metric. + + All required parameters must be populated in order to send to Azure. + + :param time_grain: Required. the timegrain of the metric in ISO8601 + format. + :type time_grain: timedelta + :param enabled: Required. a value indicating whether this timegrain is + enabled. + :type enabled: bool + :param retention_policy: the retention policy for this timegrain. + :type retention_policy: + ~azure.mgmt.monitor.v2016_09_01.models.RetentionPolicy + """ + + _validation = { + 'time_grain': {'required': True}, + 'enabled': {'required': True}, + } + + _attribute_map = { + 'time_grain': {'key': 'timeGrain', 'type': 'duration'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + } + + def __init__(self, **kwargs): + super(MetricSettings, self).__init__(**kwargs) + self.time_grain = kwargs.get('time_grain', None) + self.enabled = kwargs.get('enabled', None) + self.retention_policy = kwargs.get('retention_policy', None) + + +class MetricValue(Model): + """Represents a metric value. + + All required parameters must be populated in order to send to Azure. + + :param time_stamp: Required. the timestamp for the metric value in ISO + 8601 format. + :type time_stamp: datetime + :param average: the average value in the time range. + :type average: float + :param minimum: the least value in the time range. + :type minimum: float + :param maximum: the greatest value in the time range. + :type maximum: float + :param total: the sum of all of the values in the time range. + :type total: float + :param count: the number of samples in the time range. Can be used to + determine the number of values that contributed to the average value. + :type count: long + """ + + _validation = { + 'time_stamp': {'required': True}, + } + + _attribute_map = { + 'time_stamp': {'key': 'timeStamp', 'type': 'iso-8601'}, + 'average': {'key': 'average', 'type': 'float'}, + 'minimum': {'key': 'minimum', 'type': 'float'}, + 'maximum': {'key': 'maximum', 'type': 'float'}, + 'total': {'key': 'total', 'type': 'float'}, + 'count': {'key': 'count', 'type': 'long'}, + } + + def __init__(self, **kwargs): + super(MetricValue, self).__init__(**kwargs) + self.time_stamp = kwargs.get('time_stamp', None) + self.average = kwargs.get('average', None) + self.minimum = kwargs.get('minimum', None) + self.maximum = kwargs.get('maximum', None) + self.total = kwargs.get('total', None) + self.count = kwargs.get('count', None) + + +class Resource(Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class RetentionPolicy(Model): + """Specifies the retention policy for the log. + + All required parameters must be populated in order to send to Azure. + + :param enabled: Required. a value indicating whether the retention policy + is enabled. + :type enabled: bool + :param days: Required. the number of days for the retention in days. A + value of 0 will retain the events indefinitely. + :type days: int + """ + + _validation = { + 'enabled': {'required': True}, + 'days': {'required': True, 'minimum': 0}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'days': {'key': 'days', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(RetentionPolicy, self).__init__(**kwargs) + self.enabled = kwargs.get('enabled', None) + self.days = kwargs.get('days', None) + + +class ServiceDiagnosticSettingsResource(Resource): + """Description of a service diagnostic setting. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param storage_account_id: The resource ID of the storage account to which + you would like to send Diagnostic Logs. + :type storage_account_id: str + :param service_bus_rule_id: The service bus rule ID of the service bus + namespace in which you would like to have Event Hubs created for streaming + Diagnostic Logs. The rule ID is of the format: '{service bus resource + ID}/authorizationrules/{key name}'. + :type service_bus_rule_id: str + :param event_hub_authorization_rule_id: The resource Id for the event hub + namespace authorization rule. + :type event_hub_authorization_rule_id: str + :param metrics: the list of metric settings. + :type metrics: list[~azure.mgmt.monitor.v2016_09_01.models.MetricSettings] + :param logs: the list of logs settings. + :type logs: list[~azure.mgmt.monitor.v2016_09_01.models.LogSettings] + :param workspace_id: The workspace ID (resource ID of a Log Analytics + workspace) for a Log Analytics workspace to which you would like to send + Diagnostic Logs. Example: + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + :type workspace_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, + 'event_hub_authorization_rule_id': {'key': 'properties.eventHubAuthorizationRuleId', 'type': 'str'}, + 'metrics': {'key': 'properties.metrics', 'type': '[MetricSettings]'}, + 'logs': {'key': 'properties.logs', 'type': '[LogSettings]'}, + 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ServiceDiagnosticSettingsResource, self).__init__(**kwargs) + self.storage_account_id = kwargs.get('storage_account_id', None) + self.service_bus_rule_id = kwargs.get('service_bus_rule_id', None) + self.event_hub_authorization_rule_id = kwargs.get('event_hub_authorization_rule_id', None) + self.metrics = kwargs.get('metrics', None) + self.logs = kwargs.get('logs', None) + self.workspace_id = kwargs.get('workspace_id', None) + + +class ServiceDiagnosticSettingsResourcePatch(Model): + """Service diagnostic setting resource for patch operations. + + :param tags: Resource tags + :type tags: dict[str, str] + :param storage_account_id: The resource ID of the storage account to which + you would like to send Diagnostic Logs. + :type storage_account_id: str + :param service_bus_rule_id: The service bus rule ID of the service bus + namespace in which you would like to have Event Hubs created for streaming + Diagnostic Logs. The rule ID is of the format: '{service bus resource + ID}/authorizationrules/{key name}'. + :type service_bus_rule_id: str + :param event_hub_authorization_rule_id: The resource Id for the event hub + namespace authorization rule. + :type event_hub_authorization_rule_id: str + :param metrics: the list of metric settings. + :type metrics: list[~azure.mgmt.monitor.v2016_09_01.models.MetricSettings] + :param logs: the list of logs settings. + :type logs: list[~azure.mgmt.monitor.v2016_09_01.models.LogSettings] + :param workspace_id: The workspace ID (resource ID of a Log Analytics + workspace) for a Log Analytics workspace to which you would like to send + Diagnostic Logs. Example: + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + :type workspace_id: str + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, + 'event_hub_authorization_rule_id': {'key': 'properties.eventHubAuthorizationRuleId', 'type': 'str'}, + 'metrics': {'key': 'properties.metrics', 'type': '[MetricSettings]'}, + 'logs': {'key': 'properties.logs', 'type': '[LogSettings]'}, + 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ServiceDiagnosticSettingsResourcePatch, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.storage_account_id = kwargs.get('storage_account_id', None) + self.service_bus_rule_id = kwargs.get('service_bus_rule_id', None) + self.event_hub_authorization_rule_id = kwargs.get('event_hub_authorization_rule_id', None) + self.metrics = kwargs.get('metrics', None) + self.logs = kwargs.get('logs', None) + self.workspace_id = kwargs.get('workspace_id', None) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_models_py3.py new file mode 100644 index 000000000000..9a32f2e7ccaa --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_models_py3.py @@ -0,0 +1,429 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class LocalizableString(Model): + """The localizable string class. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. the invariant value. + :type value: str + :param localized_value: the locale specific value. + :type localized_value: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__(self, *, value: str, localized_value: str=None, **kwargs) -> None: + super(LocalizableString, self).__init__(**kwargs) + self.value = value + self.localized_value = localized_value + + +class LogSettings(Model): + """Part of MultiTenantDiagnosticSettings. Specifies the settings for a + particular log. + + All required parameters must be populated in order to send to Azure. + + :param category: Name of a Diagnostic Log category for a resource type + this setting is applied to. To obtain the list of Diagnostic Log + categories for a resource, first perform a GET diagnostic settings + operation. + :type category: str + :param enabled: Required. a value indicating whether this log is enabled. + :type enabled: bool + :param retention_policy: the retention policy for this log. + :type retention_policy: + ~azure.mgmt.monitor.v2016_09_01.models.RetentionPolicy + """ + + _validation = { + 'enabled': {'required': True}, + } + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + } + + def __init__(self, *, enabled: bool, category: str=None, retention_policy=None, **kwargs) -> None: + super(LogSettings, self).__init__(**kwargs) + self.category = category + self.enabled = enabled + self.retention_policy = retention_policy + + +class Metric(Model): + """A set of metric values in a time range. + + All required parameters must be populated in order to send to Azure. + + :param id: the id, resourceId, of the metric. + :type id: str + :param type: the resource type of the metric resource. + :type type: str + :param name: Required. the name and the display name of the metric, i.e. + it is localizable string. + :type name: ~azure.mgmt.monitor.v2016_09_01.models.LocalizableString + :param unit: Required. the unit of the metric. Possible values include: + 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', + 'Percent', 'MilliSeconds' + :type unit: str or ~azure.mgmt.monitor.v2016_09_01.models.Unit + :param data: Required. Array of data points representing the metric + values. + :type data: list[~azure.mgmt.monitor.v2016_09_01.models.MetricValue] + """ + + _validation = { + 'name': {'required': True}, + 'unit': {'required': True}, + 'data': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'unit': {'key': 'unit', 'type': 'Unit'}, + 'data': {'key': 'data', 'type': '[MetricValue]'}, + } + + def __init__(self, *, name, unit, data, id: str=None, type: str=None, **kwargs) -> None: + super(Metric, self).__init__(**kwargs) + self.id = id + self.type = type + self.name = name + self.unit = unit + self.data = data + + +class MetricSettings(Model): + """Part of MultiTenantDiagnosticSettings. Specifies the settings for a + particular metric. + + All required parameters must be populated in order to send to Azure. + + :param time_grain: Required. the timegrain of the metric in ISO8601 + format. + :type time_grain: timedelta + :param enabled: Required. a value indicating whether this timegrain is + enabled. + :type enabled: bool + :param retention_policy: the retention policy for this timegrain. + :type retention_policy: + ~azure.mgmt.monitor.v2016_09_01.models.RetentionPolicy + """ + + _validation = { + 'time_grain': {'required': True}, + 'enabled': {'required': True}, + } + + _attribute_map = { + 'time_grain': {'key': 'timeGrain', 'type': 'duration'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + } + + def __init__(self, *, time_grain, enabled: bool, retention_policy=None, **kwargs) -> None: + super(MetricSettings, self).__init__(**kwargs) + self.time_grain = time_grain + self.enabled = enabled + self.retention_policy = retention_policy + + +class MetricValue(Model): + """Represents a metric value. + + All required parameters must be populated in order to send to Azure. + + :param time_stamp: Required. the timestamp for the metric value in ISO + 8601 format. + :type time_stamp: datetime + :param average: the average value in the time range. + :type average: float + :param minimum: the least value in the time range. + :type minimum: float + :param maximum: the greatest value in the time range. + :type maximum: float + :param total: the sum of all of the values in the time range. + :type total: float + :param count: the number of samples in the time range. Can be used to + determine the number of values that contributed to the average value. + :type count: long + """ + + _validation = { + 'time_stamp': {'required': True}, + } + + _attribute_map = { + 'time_stamp': {'key': 'timeStamp', 'type': 'iso-8601'}, + 'average': {'key': 'average', 'type': 'float'}, + 'minimum': {'key': 'minimum', 'type': 'float'}, + 'maximum': {'key': 'maximum', 'type': 'float'}, + 'total': {'key': 'total', 'type': 'float'}, + 'count': {'key': 'count', 'type': 'long'}, + } + + def __init__(self, *, time_stamp, average: float=None, minimum: float=None, maximum: float=None, total: float=None, count: int=None, **kwargs) -> None: + super(MetricValue, self).__init__(**kwargs) + self.time_stamp = time_stamp + self.average = average + self.minimum = minimum + self.maximum = maximum + self.total = total + self.count = count + + +class Resource(Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, location: str, tags=None, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class RetentionPolicy(Model): + """Specifies the retention policy for the log. + + All required parameters must be populated in order to send to Azure. + + :param enabled: Required. a value indicating whether the retention policy + is enabled. + :type enabled: bool + :param days: Required. the number of days for the retention in days. A + value of 0 will retain the events indefinitely. + :type days: int + """ + + _validation = { + 'enabled': {'required': True}, + 'days': {'required': True, 'minimum': 0}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'days': {'key': 'days', 'type': 'int'}, + } + + def __init__(self, *, enabled: bool, days: int, **kwargs) -> None: + super(RetentionPolicy, self).__init__(**kwargs) + self.enabled = enabled + self.days = days + + +class ServiceDiagnosticSettingsResource(Resource): + """Description of a service diagnostic setting. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param storage_account_id: The resource ID of the storage account to which + you would like to send Diagnostic Logs. + :type storage_account_id: str + :param service_bus_rule_id: The service bus rule ID of the service bus + namespace in which you would like to have Event Hubs created for streaming + Diagnostic Logs. The rule ID is of the format: '{service bus resource + ID}/authorizationrules/{key name}'. + :type service_bus_rule_id: str + :param event_hub_authorization_rule_id: The resource Id for the event hub + namespace authorization rule. + :type event_hub_authorization_rule_id: str + :param metrics: the list of metric settings. + :type metrics: list[~azure.mgmt.monitor.v2016_09_01.models.MetricSettings] + :param logs: the list of logs settings. + :type logs: list[~azure.mgmt.monitor.v2016_09_01.models.LogSettings] + :param workspace_id: The workspace ID (resource ID of a Log Analytics + workspace) for a Log Analytics workspace to which you would like to send + Diagnostic Logs. Example: + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + :type workspace_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, + 'event_hub_authorization_rule_id': {'key': 'properties.eventHubAuthorizationRuleId', 'type': 'str'}, + 'metrics': {'key': 'properties.metrics', 'type': '[MetricSettings]'}, + 'logs': {'key': 'properties.logs', 'type': '[LogSettings]'}, + 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, + } + + def __init__(self, *, location: str, tags=None, storage_account_id: str=None, service_bus_rule_id: str=None, event_hub_authorization_rule_id: str=None, metrics=None, logs=None, workspace_id: str=None, **kwargs) -> None: + super(ServiceDiagnosticSettingsResource, self).__init__(location=location, tags=tags, **kwargs) + self.storage_account_id = storage_account_id + self.service_bus_rule_id = service_bus_rule_id + self.event_hub_authorization_rule_id = event_hub_authorization_rule_id + self.metrics = metrics + self.logs = logs + self.workspace_id = workspace_id + + +class ServiceDiagnosticSettingsResourcePatch(Model): + """Service diagnostic setting resource for patch operations. + + :param tags: Resource tags + :type tags: dict[str, str] + :param storage_account_id: The resource ID of the storage account to which + you would like to send Diagnostic Logs. + :type storage_account_id: str + :param service_bus_rule_id: The service bus rule ID of the service bus + namespace in which you would like to have Event Hubs created for streaming + Diagnostic Logs. The rule ID is of the format: '{service bus resource + ID}/authorizationrules/{key name}'. + :type service_bus_rule_id: str + :param event_hub_authorization_rule_id: The resource Id for the event hub + namespace authorization rule. + :type event_hub_authorization_rule_id: str + :param metrics: the list of metric settings. + :type metrics: list[~azure.mgmt.monitor.v2016_09_01.models.MetricSettings] + :param logs: the list of logs settings. + :type logs: list[~azure.mgmt.monitor.v2016_09_01.models.LogSettings] + :param workspace_id: The workspace ID (resource ID of a Log Analytics + workspace) for a Log Analytics workspace to which you would like to send + Diagnostic Logs. Example: + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + :type workspace_id: str + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, + 'event_hub_authorization_rule_id': {'key': 'properties.eventHubAuthorizationRuleId', 'type': 'str'}, + 'metrics': {'key': 'properties.metrics', 'type': '[MetricSettings]'}, + 'logs': {'key': 'properties.logs', 'type': '[LogSettings]'}, + 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, + } + + def __init__(self, *, tags=None, storage_account_id: str=None, service_bus_rule_id: str=None, event_hub_authorization_rule_id: str=None, metrics=None, logs=None, workspace_id: str=None, **kwargs) -> None: + super(ServiceDiagnosticSettingsResourcePatch, self).__init__(**kwargs) + self.tags = tags + self.storage_account_id = storage_account_id + self.service_bus_rule_id = service_bus_rule_id + self.event_hub_authorization_rule_id = event_hub_authorization_rule_id + self.metrics = metrics + self.logs = logs + self.workspace_id = workspace_id diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_monitor_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_monitor_client_enums.py new file mode 100644 index 000000000000..dbddf6a2145f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_monitor_client_enums.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum + + +class Unit(str, Enum): + + count = "Count" + bytes = "Bytes" + seconds = "Seconds" + count_per_second = "CountPerSecond" + bytes_per_second = "BytesPerSecond" + percent = "Percent" + milli_seconds = "MilliSeconds" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_paged_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_paged_models.py new file mode 100644 index 000000000000..62e6ee519eac --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_paged_models.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class MetricPaged(Paged): + """ + A paging container for iterating over a list of :class:`Metric ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Metric]'} + } + + def __init__(self, *args, **kwargs): + + super(MetricPaged, self).__init__(*args, **kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/operations/__init__.py new file mode 100644 index 000000000000..e7a80f4d757b --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/operations/__init__.py @@ -0,0 +1,18 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._metrics_operations import MetricsOperations +from ._service_diagnostic_settings_operations import ServiceDiagnosticSettingsOperations + +__all__ = [ + 'MetricsOperations', + 'ServiceDiagnosticSettingsOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/operations/_metrics_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/operations/_metrics_operations.py new file mode 100644 index 000000000000..02fa4486f051 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/operations/_metrics_operations.py @@ -0,0 +1,131 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class MetricsOperations(object): + """MetricsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2016-09-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2016-09-01" + + self.config = config + + def list( + self, resource_uri, filter=None, custom_headers=None, raw=False, **operation_config): + """Lists the metric values for a resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param filter: Reduces the set of data collected.
The filter is + optional. If present it must contain a list of metric names to + retrieve of the form: *(name.value eq 'metricName' [or name.value eq + 'metricName' or ...])*. Optionally, the filter can contain conditions + for the following attributes *aggregationType*, *startTime*, + *endTime*, and *timeGrain* of the form *attributeName operator value*. + Where operator is one of *ne*, *eq*, *gt*, *lt*.
Several conditions + can be combined with parentheses and logical operators, e.g: *and*, + *or*.
Some example filter expressions are:
- $filter=(name.value + eq 'RunsSucceeded') and aggregationType eq 'Total' and startTime eq + 2016-02-20 and endTime eq 2016-02-21 and timeGrain eq + duration'PT1M',
- $filter=(name.value eq 'RunsSucceeded') and + (aggregationType eq 'Total' or aggregationType eq 'Average') and + startTime eq 2016-02-20 and endTime eq 2016-02-21 and timeGrain eq + duration'PT1H',
- $filter=(name.value eq 'ActionsCompleted' or + name.value eq 'RunsSucceeded') and (aggregationType eq 'Total' or + aggregationType eq 'Average') and startTime eq 2016-02-20 and endTime + eq 2016-02-21 and timeGrain eq duration'PT1M'.

**NOTE**: When a + metrics query comes in with multiple metrics, but with no aggregation + types defined, the service will pick the Primary aggregation type of + the first metrics to be used as the default aggregation type for all + the metrics. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Metric + :rtype: + ~azure.mgmt.monitor.v2016_09_01.models.MetricPaged[~azure.mgmt.monitor.v2016_09_01.models.Metric] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metrics'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/operations/_service_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/operations/_service_diagnostic_settings_operations.py new file mode 100644 index 000000000000..b2c164826d6a --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/operations/_service_diagnostic_settings_operations.py @@ -0,0 +1,234 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class ServiceDiagnosticSettingsOperations(object): + """ServiceDiagnosticSettingsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2016-09-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2016-09-01" + + self.config = config + + def get( + self, resource_uri, custom_headers=None, raw=False, **operation_config): + """Gets the active diagnostic settings for the specified resource. + **WARNING**: This method will be deprecated in future releases. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ServiceDiagnosticSettingsResource or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.monitor.v2016_09_01.models.ServiceDiagnosticSettingsResource + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ServiceDiagnosticSettingsResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service'} + + def create_or_update( + self, resource_uri, parameters, custom_headers=None, raw=False, **operation_config): + """Create or update new diagnostic settings for the specified resource. + **WARNING**: This method will be deprecated in future releases. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param parameters: Parameters supplied to the operation. + :type parameters: + ~azure.mgmt.monitor.v2016_09_01.models.ServiceDiagnosticSettingsResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ServiceDiagnosticSettingsResource or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.monitor.v2016_09_01.models.ServiceDiagnosticSettingsResource + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ServiceDiagnosticSettingsResource') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ServiceDiagnosticSettingsResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service'} + + def update( + self, resource_uri, service_diagnostic_settings_resource, custom_headers=None, raw=False, **operation_config): + """Updates an existing ServiceDiagnosticSettingsResource. To update other + fields use the CreateOrUpdate method. **WARNING**: This method will be + deprecated in future releases. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param service_diagnostic_settings_resource: Parameters supplied to + the operation. + :type service_diagnostic_settings_resource: + ~azure.mgmt.monitor.v2016_09_01.models.ServiceDiagnosticSettingsResourcePatch + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ServiceDiagnosticSettingsResource or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.monitor.v2016_09_01.models.ServiceDiagnosticSettingsResource + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(service_diagnostic_settings_resource, 'ServiceDiagnosticSettingsResourcePatch') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ServiceDiagnosticSettingsResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/version.py new file mode 100644 index 000000000000..e63d4addb017 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2016-09-01" + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/__init__.py new file mode 100644 index 000000000000..8e97360e5ffb --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._configuration import MonitorManagementClientConfiguration +from ._monitor_management_client import MonitorManagementClient +__all__ = ['MonitorManagementClient', 'MonitorManagementClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_configuration.py new file mode 100644 index 000000000000..88436f6b4a33 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_configuration.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 msrestazure import AzureConfiguration + +from .version import VERSION + + +class MonitorManagementClientConfiguration(AzureConfiguration): + """Configuration for MonitorManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription Id. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(MonitorManagementClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-monitor/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_monitor_management_client.py new file mode 100644 index 000000000000..68430c13738a --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_monitor_management_client.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 msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import MonitorManagementClientConfiguration +from .operations import ActivityLogAlertsOperations +from . import models + + +class MonitorManagementClient(SDKClient): + """Monitor Management Client + + :ivar config: Configuration for client. + :vartype config: MonitorManagementClientConfiguration + + :ivar activity_log_alerts: ActivityLogAlerts operations + :vartype activity_log_alerts: azure.mgmt.monitor.v2017_03_01_preview.operations.ActivityLogAlertsOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription Id. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = MonitorManagementClientConfiguration(credentials, subscription_id, base_url) + super(MonitorManagementClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2017-03-01-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.activity_log_alerts = ActivityLogAlertsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/models/__init__.py new file mode 100644 index 000000000000..8f6554ced19f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/models/__init__.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import ActivityLogAlertActionGroup + from ._models_py3 import ActivityLogAlertActionList + from ._models_py3 import ActivityLogAlertAllOfCondition + from ._models_py3 import ActivityLogAlertLeafCondition + from ._models_py3 import ActivityLogAlertResource + from ._models_py3 import ActivityLogAlertResourcePatch + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import Resource +except (SyntaxError, ImportError): + from ._models import ActivityLogAlertActionGroup + from ._models import ActivityLogAlertActionList + from ._models import ActivityLogAlertAllOfCondition + from ._models import ActivityLogAlertLeafCondition + from ._models import ActivityLogAlertResource + from ._models import ActivityLogAlertResourcePatch + from ._models import ErrorResponse, ErrorResponseException + from ._models import Resource +from ._paged_models import ActivityLogAlertResourcePaged + +__all__ = [ + 'ActivityLogAlertActionGroup', + 'ActivityLogAlertActionList', + 'ActivityLogAlertAllOfCondition', + 'ActivityLogAlertLeafCondition', + 'ActivityLogAlertResource', + 'ActivityLogAlertResourcePatch', + 'ErrorResponse', 'ErrorResponseException', + 'Resource', + 'ActivityLogAlertResourcePaged', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/models/_models.py new file mode 100644 index 000000000000..1726e24fc61c --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/models/_models.py @@ -0,0 +1,315 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ActivityLogAlertActionGroup(Model): + """A pointer to an Azure Action Group. + + All required parameters must be populated in order to send to Azure. + + :param action_group_id: Required. The resourceId of the action group. This + cannot be null or empty. + :type action_group_id: str + :param webhook_properties: The dictionary of custom properties to include + with the post operation. These data are appended to the webhook payload. + :type webhook_properties: dict[str, str] + """ + + _validation = { + 'action_group_id': {'required': True}, + } + + _attribute_map = { + 'action_group_id': {'key': 'actionGroupId', 'type': 'str'}, + 'webhook_properties': {'key': 'webhookProperties', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(ActivityLogAlertActionGroup, self).__init__(**kwargs) + self.action_group_id = kwargs.get('action_group_id', None) + self.webhook_properties = kwargs.get('webhook_properties', None) + + +class ActivityLogAlertActionList(Model): + """A list of activity log alert actions. + + :param action_groups: The list of activity log alerts. + :type action_groups: + list[~azure.mgmt.monitor.v2017_03_01_preview.models.ActivityLogAlertActionGroup] + """ + + _attribute_map = { + 'action_groups': {'key': 'actionGroups', 'type': '[ActivityLogAlertActionGroup]'}, + } + + def __init__(self, **kwargs): + super(ActivityLogAlertActionList, self).__init__(**kwargs) + self.action_groups = kwargs.get('action_groups', None) + + +class ActivityLogAlertAllOfCondition(Model): + """An Activity Log alert condition that is met when all its member conditions + are met. + + All required parameters must be populated in order to send to Azure. + + :param all_of: Required. The list of activity log alert conditions. + :type all_of: + list[~azure.mgmt.monitor.v2017_03_01_preview.models.ActivityLogAlertLeafCondition] + """ + + _validation = { + 'all_of': {'required': True}, + } + + _attribute_map = { + 'all_of': {'key': 'allOf', 'type': '[ActivityLogAlertLeafCondition]'}, + } + + def __init__(self, **kwargs): + super(ActivityLogAlertAllOfCondition, self).__init__(**kwargs) + self.all_of = kwargs.get('all_of', None) + + +class ActivityLogAlertLeafCondition(Model): + """An Activity Log alert condition that is met by comparing an activity log + field and value. + + All required parameters must be populated in order to send to Azure. + + :param field: Required. The name of the field that this condition will + examine. The possible values for this field are (case-insensitive): + 'resourceId', 'category', 'caller', 'level', 'operationName', + 'resourceGroup', 'resourceProvider', 'status', 'subStatus', + 'resourceType', or anything beginning with 'properties.'. + :type field: str + :param equals: Required. The field value will be compared to this value + (case-insensitive) to determine if the condition is met. + :type equals: str + """ + + _validation = { + 'field': {'required': True}, + 'equals': {'required': True}, + } + + _attribute_map = { + 'field': {'key': 'field', 'type': 'str'}, + 'equals': {'key': 'equals', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ActivityLogAlertLeafCondition, self).__init__(**kwargs) + self.field = kwargs.get('field', None) + self.equals = kwargs.get('equals', None) + + +class Resource(Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class ActivityLogAlertResource(Resource): + """An activity log alert resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param scopes: Required. A list of resourceIds that will be used as + prefixes. The alert will only apply to activityLogs with resourceIds that + fall under one of these prefixes. This list must include at least one + item. + :type scopes: list[str] + :param enabled: Indicates whether this activity log alert is enabled. If + an activity log alert is not enabled, then none of its actions will be + activated. Default value: True . + :type enabled: bool + :param condition: Required. The condition that will cause this alert to + activate. + :type condition: + ~azure.mgmt.monitor.v2017_03_01_preview.models.ActivityLogAlertAllOfCondition + :param actions: Required. The actions that will activate when the + condition is met. + :type actions: + ~azure.mgmt.monitor.v2017_03_01_preview.models.ActivityLogAlertActionList + :param description: A description of this activity log alert. + :type description: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'scopes': {'required': True}, + 'condition': {'required': True}, + 'actions': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'condition': {'key': 'properties.condition', 'type': 'ActivityLogAlertAllOfCondition'}, + 'actions': {'key': 'properties.actions', 'type': 'ActivityLogAlertActionList'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ActivityLogAlertResource, self).__init__(**kwargs) + self.scopes = kwargs.get('scopes', None) + self.enabled = kwargs.get('enabled', True) + self.condition = kwargs.get('condition', None) + self.actions = kwargs.get('actions', None) + self.description = kwargs.get('description', None) + + +class ActivityLogAlertResourcePatch(Resource): + """An activity log alert resource for patch operations. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param enabled: Indicates whether this activity log alert is enabled. If + an activity log alert is not enabled, then none of its actions will be + activated. Default value: True . + :type enabled: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(ActivityLogAlertResourcePatch, self).__init__(**kwargs) + self.enabled = kwargs.get('enabled', True) + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/models/_models_py3.py new file mode 100644 index 000000000000..df270a81fa64 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/models/_models_py3.py @@ -0,0 +1,315 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ActivityLogAlertActionGroup(Model): + """A pointer to an Azure Action Group. + + All required parameters must be populated in order to send to Azure. + + :param action_group_id: Required. The resourceId of the action group. This + cannot be null or empty. + :type action_group_id: str + :param webhook_properties: The dictionary of custom properties to include + with the post operation. These data are appended to the webhook payload. + :type webhook_properties: dict[str, str] + """ + + _validation = { + 'action_group_id': {'required': True}, + } + + _attribute_map = { + 'action_group_id': {'key': 'actionGroupId', 'type': 'str'}, + 'webhook_properties': {'key': 'webhookProperties', 'type': '{str}'}, + } + + def __init__(self, *, action_group_id: str, webhook_properties=None, **kwargs) -> None: + super(ActivityLogAlertActionGroup, self).__init__(**kwargs) + self.action_group_id = action_group_id + self.webhook_properties = webhook_properties + + +class ActivityLogAlertActionList(Model): + """A list of activity log alert actions. + + :param action_groups: The list of activity log alerts. + :type action_groups: + list[~azure.mgmt.monitor.v2017_03_01_preview.models.ActivityLogAlertActionGroup] + """ + + _attribute_map = { + 'action_groups': {'key': 'actionGroups', 'type': '[ActivityLogAlertActionGroup]'}, + } + + def __init__(self, *, action_groups=None, **kwargs) -> None: + super(ActivityLogAlertActionList, self).__init__(**kwargs) + self.action_groups = action_groups + + +class ActivityLogAlertAllOfCondition(Model): + """An Activity Log alert condition that is met when all its member conditions + are met. + + All required parameters must be populated in order to send to Azure. + + :param all_of: Required. The list of activity log alert conditions. + :type all_of: + list[~azure.mgmt.monitor.v2017_03_01_preview.models.ActivityLogAlertLeafCondition] + """ + + _validation = { + 'all_of': {'required': True}, + } + + _attribute_map = { + 'all_of': {'key': 'allOf', 'type': '[ActivityLogAlertLeafCondition]'}, + } + + def __init__(self, *, all_of, **kwargs) -> None: + super(ActivityLogAlertAllOfCondition, self).__init__(**kwargs) + self.all_of = all_of + + +class ActivityLogAlertLeafCondition(Model): + """An Activity Log alert condition that is met by comparing an activity log + field and value. + + All required parameters must be populated in order to send to Azure. + + :param field: Required. The name of the field that this condition will + examine. The possible values for this field are (case-insensitive): + 'resourceId', 'category', 'caller', 'level', 'operationName', + 'resourceGroup', 'resourceProvider', 'status', 'subStatus', + 'resourceType', or anything beginning with 'properties.'. + :type field: str + :param equals: Required. The field value will be compared to this value + (case-insensitive) to determine if the condition is met. + :type equals: str + """ + + _validation = { + 'field': {'required': True}, + 'equals': {'required': True}, + } + + _attribute_map = { + 'field': {'key': 'field', 'type': 'str'}, + 'equals': {'key': 'equals', 'type': 'str'}, + } + + def __init__(self, *, field: str, equals: str, **kwargs) -> None: + super(ActivityLogAlertLeafCondition, self).__init__(**kwargs) + self.field = field + self.equals = equals + + +class Resource(Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, location: str, tags=None, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class ActivityLogAlertResource(Resource): + """An activity log alert resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param scopes: Required. A list of resourceIds that will be used as + prefixes. The alert will only apply to activityLogs with resourceIds that + fall under one of these prefixes. This list must include at least one + item. + :type scopes: list[str] + :param enabled: Indicates whether this activity log alert is enabled. If + an activity log alert is not enabled, then none of its actions will be + activated. Default value: True . + :type enabled: bool + :param condition: Required. The condition that will cause this alert to + activate. + :type condition: + ~azure.mgmt.monitor.v2017_03_01_preview.models.ActivityLogAlertAllOfCondition + :param actions: Required. The actions that will activate when the + condition is met. + :type actions: + ~azure.mgmt.monitor.v2017_03_01_preview.models.ActivityLogAlertActionList + :param description: A description of this activity log alert. + :type description: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'scopes': {'required': True}, + 'condition': {'required': True}, + 'actions': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'condition': {'key': 'properties.condition', 'type': 'ActivityLogAlertAllOfCondition'}, + 'actions': {'key': 'properties.actions', 'type': 'ActivityLogAlertActionList'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + } + + def __init__(self, *, location: str, scopes, condition, actions, tags=None, enabled: bool=True, description: str=None, **kwargs) -> None: + super(ActivityLogAlertResource, self).__init__(location=location, tags=tags, **kwargs) + self.scopes = scopes + self.enabled = enabled + self.condition = condition + self.actions = actions + self.description = description + + +class ActivityLogAlertResourcePatch(Resource): + """An activity log alert resource for patch operations. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param enabled: Indicates whether this activity log alert is enabled. If + an activity log alert is not enabled, then none of its actions will be + activated. Default value: True . + :type enabled: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + } + + def __init__(self, *, location: str, tags=None, enabled: bool=True, **kwargs) -> None: + super(ActivityLogAlertResourcePatch, self).__init__(location=location, tags=tags, **kwargs) + self.enabled = enabled + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/models/_paged_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/models/_paged_models.py new file mode 100644 index 000000000000..4b4c9863cf24 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/models/_paged_models.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class ActivityLogAlertResourcePaged(Paged): + """ + A paging container for iterating over a list of :class:`ActivityLogAlertResource ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ActivityLogAlertResource]'} + } + + def __init__(self, *args, **kwargs): + + super(ActivityLogAlertResourcePaged, self).__init__(*args, **kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/operations/__init__.py new file mode 100644 index 000000000000..8074538b1a4a --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/operations/__init__.py @@ -0,0 +1,16 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._activity_log_alerts_operations import ActivityLogAlertsOperations + +__all__ = [ + 'ActivityLogAlertsOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/operations/_activity_log_alerts_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/operations/_activity_log_alerts_operations.py new file mode 100644 index 000000000000..e994052e90e1 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/operations/_activity_log_alerts_operations.py @@ -0,0 +1,425 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class ActivityLogAlertsOperations(object): + """ActivityLogAlertsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2017-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-03-01-preview" + + self.config = config + + def create_or_update( + self, resource_group_name, activity_log_alert_name, activity_log_alert, custom_headers=None, raw=False, **operation_config): + """Create a new activity log alert or update an existing one. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param activity_log_alert_name: The name of the activity log alert. + :type activity_log_alert_name: str + :param activity_log_alert: The activity log alert to create or use for + the update. + :type activity_log_alert: + ~azure.mgmt.monitor.v2017_03_01_preview.models.ActivityLogAlertResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ActivityLogAlertResource or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.monitor.v2017_03_01_preview.models.ActivityLogAlertResource + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(activity_log_alert, 'ActivityLogAlertResource') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ActivityLogAlertResource', response) + if response.status_code == 201: + deserialized = self._deserialize('ActivityLogAlertResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}'} + + def get( + self, resource_group_name, activity_log_alert_name, custom_headers=None, raw=False, **operation_config): + """Get an activity log alert. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param activity_log_alert_name: The name of the activity log alert. + :type activity_log_alert_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ActivityLogAlertResource or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.monitor.v2017_03_01_preview.models.ActivityLogAlertResource + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ActivityLogAlertResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}'} + + def delete( + self, resource_group_name, activity_log_alert_name, custom_headers=None, raw=False, **operation_config): + """Delete an activity log alert. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param activity_log_alert_name: The name of the activity log alert. + :type activity_log_alert_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}'} + + def update( + self, resource_group_name, activity_log_alert_name, activity_log_alert_patch, custom_headers=None, raw=False, **operation_config): + """Updates an existing ActivityLogAlertResource's tags. To update other + fields use the CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param activity_log_alert_name: The name of the activity log alert. + :type activity_log_alert_name: str + :param activity_log_alert_patch: Parameters supplied to the operation. + :type activity_log_alert_patch: + ~azure.mgmt.monitor.v2017_03_01_preview.models.ActivityLogAlertResourcePatch + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ActivityLogAlertResource or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.monitor.v2017_03_01_preview.models.ActivityLogAlertResource + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(activity_log_alert_patch, 'ActivityLogAlertResourcePatch') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ActivityLogAlertResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}'} + + def list_by_subscription_id( + self, custom_headers=None, raw=False, **operation_config): + """Get a list of all activity log alerts in a subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ActivityLogAlertResource + :rtype: + ~azure.mgmt.monitor.v2017_03_01_preview.models.ActivityLogAlertResourcePaged[~azure.mgmt.monitor.v2017_03_01_preview.models.ActivityLogAlertResource] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription_id.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ActivityLogAlertResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Get a list of all activity log alerts in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ActivityLogAlertResource + :rtype: + ~azure.mgmt.monitor.v2017_03_01_preview.models.ActivityLogAlertResourcePaged[~azure.mgmt.monitor.v2017_03_01_preview.models.ActivityLogAlertResource] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ActivityLogAlertResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/version.py new file mode 100644 index 000000000000..87acb1634c35 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2017-03-01-preview" + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/__init__.py new file mode 100644 index 000000000000..8e97360e5ffb --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._configuration import MonitorManagementClientConfiguration +from ._monitor_management_client import MonitorManagementClient +__all__ = ['MonitorManagementClient', 'MonitorManagementClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_configuration.py new file mode 100644 index 000000000000..88436f6b4a33 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_configuration.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 msrestazure import AzureConfiguration + +from .version import VERSION + + +class MonitorManagementClientConfiguration(AzureConfiguration): + """Configuration for MonitorManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription Id. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(MonitorManagementClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-monitor/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_monitor_management_client.py new file mode 100644 index 000000000000..79db6903303c --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_monitor_management_client.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 msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import MonitorManagementClientConfiguration +from .operations import ActionGroupsOperations +from .operations import ActivityLogAlertsOperations +from . import models + + +class MonitorManagementClient(SDKClient): + """Monitor Management Client + + :ivar config: Configuration for client. + :vartype config: MonitorManagementClientConfiguration + + :ivar action_groups: ActionGroups operations + :vartype action_groups: azure.mgmt.monitor.v2017_04_01.operations.ActionGroupsOperations + :ivar activity_log_alerts: ActivityLogAlerts operations + :vartype activity_log_alerts: azure.mgmt.monitor.v2017_04_01.operations.ActivityLogAlertsOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription Id. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = MonitorManagementClientConfiguration(credentials, subscription_id, base_url) + super(MonitorManagementClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2017-04-01' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.action_groups = ActionGroupsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.activity_log_alerts = ActivityLogAlertsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/__init__.py new file mode 100644 index 000000000000..535c2a9f741d --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/__init__.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import ActionGroupPatchBody + from ._models_py3 import ActionGroupResource + from ._models_py3 import ActivityLogAlertActionGroup + from ._models_py3 import ActivityLogAlertActionList + from ._models_py3 import ActivityLogAlertAllOfCondition + from ._models_py3 import ActivityLogAlertLeafCondition + from ._models_py3 import ActivityLogAlertPatchBody + from ._models_py3 import ActivityLogAlertResource + from ._models_py3 import AutomationRunbookReceiver + from ._models_py3 import AzureAppPushReceiver + from ._models_py3 import EmailReceiver + from ._models_py3 import EnableRequest + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import ItsmReceiver + from ._models_py3 import Resource + from ._models_py3 import SmsReceiver + from ._models_py3 import WebhookReceiver +except (SyntaxError, ImportError): + from ._models import ActionGroupPatchBody + from ._models import ActionGroupResource + from ._models import ActivityLogAlertActionGroup + from ._models import ActivityLogAlertActionList + from ._models import ActivityLogAlertAllOfCondition + from ._models import ActivityLogAlertLeafCondition + from ._models import ActivityLogAlertPatchBody + from ._models import ActivityLogAlertResource + from ._models import AutomationRunbookReceiver + from ._models import AzureAppPushReceiver + from ._models import EmailReceiver + from ._models import EnableRequest + from ._models import ErrorResponse, ErrorResponseException + from ._models import ItsmReceiver + from ._models import Resource + from ._models import SmsReceiver + from ._models import WebhookReceiver +from ._paged_models import ActionGroupResourcePaged +from ._paged_models import ActivityLogAlertResourcePaged +from ._monitor_management_client_enums import ( + ReceiverStatus, +) + +__all__ = [ + 'ActionGroupPatchBody', + 'ActionGroupResource', + 'ActivityLogAlertActionGroup', + 'ActivityLogAlertActionList', + 'ActivityLogAlertAllOfCondition', + 'ActivityLogAlertLeafCondition', + 'ActivityLogAlertPatchBody', + 'ActivityLogAlertResource', + 'AutomationRunbookReceiver', + 'AzureAppPushReceiver', + 'EmailReceiver', + 'EnableRequest', + 'ErrorResponse', 'ErrorResponseException', + 'ItsmReceiver', + 'Resource', + 'SmsReceiver', + 'WebhookReceiver', + 'ActionGroupResourcePaged', + 'ActivityLogAlertResourcePaged', + 'ReceiverStatus', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/_models.py new file mode 100644 index 000000000000..7e40b0b765de --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/_models.py @@ -0,0 +1,657 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ActionGroupPatchBody(Model): + """An action group object for the body of patch operations. + + :param tags: Resource tags + :type tags: dict[str, str] + :param enabled: Indicates whether this action group is enabled. If an + action group is not enabled, then none of its actions will be activated. + Default value: True . + :type enabled: bool + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(ActionGroupPatchBody, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.enabled = kwargs.get('enabled', True) + + +class Resource(Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class ActionGroupResource(Resource): + """An action group resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param group_short_name: Required. The short name of the action group. + This will be used in SMS messages. + :type group_short_name: str + :param enabled: Required. Indicates whether this action group is enabled. + If an action group is not enabled, then none of its receivers will receive + communications. Default value: True . + :type enabled: bool + :param email_receivers: The list of email receivers that are part of this + action group. + :type email_receivers: + list[~azure.mgmt.monitor.v2017_04_01.models.EmailReceiver] + :param sms_receivers: The list of SMS receivers that are part of this + action group. + :type sms_receivers: + list[~azure.mgmt.monitor.v2017_04_01.models.SmsReceiver] + :param webhook_receivers: The list of webhook receivers that are part of + this action group. + :type webhook_receivers: + list[~azure.mgmt.monitor.v2017_04_01.models.WebhookReceiver] + :param itsm_receivers: The list of ITSM receivers that are part of this + action group. + :type itsm_receivers: + list[~azure.mgmt.monitor.v2017_04_01.models.ItsmReceiver] + :param azure_app_push_receivers: The list of AzureAppPush receivers that + are part of this action group. + :type azure_app_push_receivers: + list[~azure.mgmt.monitor.v2017_04_01.models.AzureAppPushReceiver] + :param automation_runbook_receivers: The list of AutomationRunbook + receivers that are part of this action group. + :type automation_runbook_receivers: + list[~azure.mgmt.monitor.v2017_04_01.models.AutomationRunbookReceiver] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'group_short_name': {'required': True, 'max_length': 12}, + 'enabled': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'group_short_name': {'key': 'properties.groupShortName', 'type': 'str'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'email_receivers': {'key': 'properties.emailReceivers', 'type': '[EmailReceiver]'}, + 'sms_receivers': {'key': 'properties.smsReceivers', 'type': '[SmsReceiver]'}, + 'webhook_receivers': {'key': 'properties.webhookReceivers', 'type': '[WebhookReceiver]'}, + 'itsm_receivers': {'key': 'properties.itsmReceivers', 'type': '[ItsmReceiver]'}, + 'azure_app_push_receivers': {'key': 'properties.azureAppPushReceivers', 'type': '[AzureAppPushReceiver]'}, + 'automation_runbook_receivers': {'key': 'properties.automationRunbookReceivers', 'type': '[AutomationRunbookReceiver]'}, + } + + def __init__(self, **kwargs): + super(ActionGroupResource, self).__init__(**kwargs) + self.group_short_name = kwargs.get('group_short_name', None) + self.enabled = kwargs.get('enabled', True) + self.email_receivers = kwargs.get('email_receivers', None) + self.sms_receivers = kwargs.get('sms_receivers', None) + self.webhook_receivers = kwargs.get('webhook_receivers', None) + self.itsm_receivers = kwargs.get('itsm_receivers', None) + self.azure_app_push_receivers = kwargs.get('azure_app_push_receivers', None) + self.automation_runbook_receivers = kwargs.get('automation_runbook_receivers', None) + + +class ActivityLogAlertActionGroup(Model): + """A pointer to an Azure Action Group. + + All required parameters must be populated in order to send to Azure. + + :param action_group_id: Required. The resourceId of the action group. This + cannot be null or empty. + :type action_group_id: str + :param webhook_properties: the dictionary of custom properties to include + with the post operation. These data are appended to the webhook payload. + :type webhook_properties: dict[str, str] + """ + + _validation = { + 'action_group_id': {'required': True}, + } + + _attribute_map = { + 'action_group_id': {'key': 'actionGroupId', 'type': 'str'}, + 'webhook_properties': {'key': 'webhookProperties', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(ActivityLogAlertActionGroup, self).__init__(**kwargs) + self.action_group_id = kwargs.get('action_group_id', None) + self.webhook_properties = kwargs.get('webhook_properties', None) + + +class ActivityLogAlertActionList(Model): + """A list of activity log alert actions. + + :param action_groups: The list of activity log alerts. + :type action_groups: + list[~azure.mgmt.monitor.v2017_04_01.models.ActivityLogAlertActionGroup] + """ + + _attribute_map = { + 'action_groups': {'key': 'actionGroups', 'type': '[ActivityLogAlertActionGroup]'}, + } + + def __init__(self, **kwargs): + super(ActivityLogAlertActionList, self).__init__(**kwargs) + self.action_groups = kwargs.get('action_groups', None) + + +class ActivityLogAlertAllOfCondition(Model): + """An Activity Log alert condition that is met when all its member conditions + are met. + + All required parameters must be populated in order to send to Azure. + + :param all_of: Required. The list of activity log alert conditions. + :type all_of: + list[~azure.mgmt.monitor.v2017_04_01.models.ActivityLogAlertLeafCondition] + """ + + _validation = { + 'all_of': {'required': True}, + } + + _attribute_map = { + 'all_of': {'key': 'allOf', 'type': '[ActivityLogAlertLeafCondition]'}, + } + + def __init__(self, **kwargs): + super(ActivityLogAlertAllOfCondition, self).__init__(**kwargs) + self.all_of = kwargs.get('all_of', None) + + +class ActivityLogAlertLeafCondition(Model): + """An Activity Log alert condition that is met by comparing an activity log + field and value. + + All required parameters must be populated in order to send to Azure. + + :param field: Required. The name of the field that this condition will + examine. The possible values for this field are (case-insensitive): + 'resourceId', 'category', 'caller', 'level', 'operationName', + 'resourceGroup', 'resourceProvider', 'status', 'subStatus', + 'resourceType', or anything beginning with 'properties.'. + :type field: str + :param equals: Required. The field value will be compared to this value + (case-insensitive) to determine if the condition is met. + :type equals: str + """ + + _validation = { + 'field': {'required': True}, + 'equals': {'required': True}, + } + + _attribute_map = { + 'field': {'key': 'field', 'type': 'str'}, + 'equals': {'key': 'equals', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ActivityLogAlertLeafCondition, self).__init__(**kwargs) + self.field = kwargs.get('field', None) + self.equals = kwargs.get('equals', None) + + +class ActivityLogAlertPatchBody(Model): + """An activity log alert object for the body of patch operations. + + :param tags: Resource tags + :type tags: dict[str, str] + :param enabled: Indicates whether this activity log alert is enabled. If + an activity log alert is not enabled, then none of its actions will be + activated. Default value: True . + :type enabled: bool + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(ActivityLogAlertPatchBody, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.enabled = kwargs.get('enabled', True) + + +class ActivityLogAlertResource(Resource): + """An activity log alert resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param scopes: Required. A list of resourceIds that will be used as + prefixes. The alert will only apply to activityLogs with resourceIds that + fall under one of these prefixes. This list must include at least one + item. + :type scopes: list[str] + :param enabled: Indicates whether this activity log alert is enabled. If + an activity log alert is not enabled, then none of its actions will be + activated. Default value: True . + :type enabled: bool + :param condition: Required. The condition that will cause this alert to + activate. + :type condition: + ~azure.mgmt.monitor.v2017_04_01.models.ActivityLogAlertAllOfCondition + :param actions: Required. The actions that will activate when the + condition is met. + :type actions: + ~azure.mgmt.monitor.v2017_04_01.models.ActivityLogAlertActionList + :param description: A description of this activity log alert. + :type description: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'scopes': {'required': True}, + 'condition': {'required': True}, + 'actions': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'condition': {'key': 'properties.condition', 'type': 'ActivityLogAlertAllOfCondition'}, + 'actions': {'key': 'properties.actions', 'type': 'ActivityLogAlertActionList'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ActivityLogAlertResource, self).__init__(**kwargs) + self.scopes = kwargs.get('scopes', None) + self.enabled = kwargs.get('enabled', True) + self.condition = kwargs.get('condition', None) + self.actions = kwargs.get('actions', None) + self.description = kwargs.get('description', None) + + +class AutomationRunbookReceiver(Model): + """The Azure Automation Runbook notification receiver. + + All required parameters must be populated in order to send to Azure. + + :param automation_account_id: Required. The Azure automation account Id + which holds this runbook and authenticate to Azure resource. + :type automation_account_id: str + :param runbook_name: Required. The name for this runbook. + :type runbook_name: str + :param webhook_resource_id: Required. The resource id for webhook linked + to this runbook. + :type webhook_resource_id: str + :param is_global_runbook: Required. Indicates whether this instance is + global runbook. + :type is_global_runbook: bool + :param name: Indicates name of the webhook. + :type name: str + :param service_uri: The URI where webhooks should be sent. + :type service_uri: str + """ + + _validation = { + 'automation_account_id': {'required': True}, + 'runbook_name': {'required': True}, + 'webhook_resource_id': {'required': True}, + 'is_global_runbook': {'required': True}, + } + + _attribute_map = { + 'automation_account_id': {'key': 'automationAccountId', 'type': 'str'}, + 'runbook_name': {'key': 'runbookName', 'type': 'str'}, + 'webhook_resource_id': {'key': 'webhookResourceId', 'type': 'str'}, + 'is_global_runbook': {'key': 'isGlobalRunbook', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AutomationRunbookReceiver, self).__init__(**kwargs) + self.automation_account_id = kwargs.get('automation_account_id', None) + self.runbook_name = kwargs.get('runbook_name', None) + self.webhook_resource_id = kwargs.get('webhook_resource_id', None) + self.is_global_runbook = kwargs.get('is_global_runbook', None) + self.name = kwargs.get('name', None) + self.service_uri = kwargs.get('service_uri', None) + + +class AzureAppPushReceiver(Model): + """The Azure mobile App push notification receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the Azure mobile app push receiver. + Names must be unique across all receivers within an action group. + :type name: str + :param email_address: Required. The email address registered for the Azure + mobile app. + :type email_address: str + """ + + _validation = { + 'name': {'required': True}, + 'email_address': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AzureAppPushReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.email_address = kwargs.get('email_address', None) + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class EmailReceiver(Model): + """An email receiver. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the email receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param email_address: Required. The email address of this receiver. + :type email_address: str + :ivar status: The receiver status of the e-mail. Possible values include: + 'NotSpecified', 'Enabled', 'Disabled' + :vartype status: str or + ~azure.mgmt.monitor.v2017_04_01.models.ReceiverStatus + """ + + _validation = { + 'name': {'required': True}, + 'email_address': {'required': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'ReceiverStatus'}, + } + + def __init__(self, **kwargs): + super(EmailReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.email_address = kwargs.get('email_address', None) + self.status = None + + +class EnableRequest(Model): + """Describes a receiver that should be resubscribed. + + All required parameters must be populated in order to send to Azure. + + :param receiver_name: Required. The name of the receiver to resubscribe. + :type receiver_name: str + """ + + _validation = { + 'receiver_name': {'required': True}, + } + + _attribute_map = { + 'receiver_name': {'key': 'receiverName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(EnableRequest, self).__init__(**kwargs) + self.receiver_name = kwargs.get('receiver_name', None) + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class ItsmReceiver(Model): + """An Itsm receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the Itsm receiver. Names must be unique + across all receivers within an action group. + :type name: str + :param workspace_id: Required. OMS LA instance identifier. + :type workspace_id: str + :param connection_id: Required. Unique identification of ITSM connection + among multiple defined in above workspace. + :type connection_id: str + :param ticket_configuration: Required. JSON blob for the configurations of + the ITSM action. CreateMultipleWorkItems option will be part of this blob + as well. + :type ticket_configuration: str + :param region: Required. Region in which workspace resides. Supported + values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' + :type region: str + """ + + _validation = { + 'name': {'required': True}, + 'workspace_id': {'required': True}, + 'connection_id': {'required': True}, + 'ticket_configuration': {'required': True}, + 'region': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, + 'connection_id': {'key': 'connectionId', 'type': 'str'}, + 'ticket_configuration': {'key': 'ticketConfiguration', 'type': 'str'}, + 'region': {'key': 'region', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ItsmReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.workspace_id = kwargs.get('workspace_id', None) + self.connection_id = kwargs.get('connection_id', None) + self.ticket_configuration = kwargs.get('ticket_configuration', None) + self.region = kwargs.get('region', None) + + +class SmsReceiver(Model): + """An SMS receiver. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the SMS receiver. Names must be unique + across all receivers within an action group. + :type name: str + :param country_code: Required. The country code of the SMS receiver. + :type country_code: str + :param phone_number: Required. The phone number of the SMS receiver. + :type phone_number: str + :ivar status: The status of the receiver. Possible values include: + 'NotSpecified', 'Enabled', 'Disabled' + :vartype status: str or + ~azure.mgmt.monitor.v2017_04_01.models.ReceiverStatus + """ + + _validation = { + 'name': {'required': True}, + 'country_code': {'required': True}, + 'phone_number': {'required': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'phone_number': {'key': 'phoneNumber', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'ReceiverStatus'}, + } + + def __init__(self, **kwargs): + super(SmsReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.country_code = kwargs.get('country_code', None) + self.phone_number = kwargs.get('phone_number', None) + self.status = None + + +class WebhookReceiver(Model): + """A webhook receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the webhook receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param service_uri: Required. The URI where webhooks should be sent. + :type service_uri: str + """ + + _validation = { + 'name': {'required': True}, + 'service_uri': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(WebhookReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.service_uri = kwargs.get('service_uri', None) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/_models_py3.py new file mode 100644 index 000000000000..3294a87e3c73 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/_models_py3.py @@ -0,0 +1,657 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ActionGroupPatchBody(Model): + """An action group object for the body of patch operations. + + :param tags: Resource tags + :type tags: dict[str, str] + :param enabled: Indicates whether this action group is enabled. If an + action group is not enabled, then none of its actions will be activated. + Default value: True . + :type enabled: bool + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + } + + def __init__(self, *, tags=None, enabled: bool=True, **kwargs) -> None: + super(ActionGroupPatchBody, self).__init__(**kwargs) + self.tags = tags + self.enabled = enabled + + +class Resource(Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, location: str, tags=None, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class ActionGroupResource(Resource): + """An action group resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param group_short_name: Required. The short name of the action group. + This will be used in SMS messages. + :type group_short_name: str + :param enabled: Required. Indicates whether this action group is enabled. + If an action group is not enabled, then none of its receivers will receive + communications. Default value: True . + :type enabled: bool + :param email_receivers: The list of email receivers that are part of this + action group. + :type email_receivers: + list[~azure.mgmt.monitor.v2017_04_01.models.EmailReceiver] + :param sms_receivers: The list of SMS receivers that are part of this + action group. + :type sms_receivers: + list[~azure.mgmt.monitor.v2017_04_01.models.SmsReceiver] + :param webhook_receivers: The list of webhook receivers that are part of + this action group. + :type webhook_receivers: + list[~azure.mgmt.monitor.v2017_04_01.models.WebhookReceiver] + :param itsm_receivers: The list of ITSM receivers that are part of this + action group. + :type itsm_receivers: + list[~azure.mgmt.monitor.v2017_04_01.models.ItsmReceiver] + :param azure_app_push_receivers: The list of AzureAppPush receivers that + are part of this action group. + :type azure_app_push_receivers: + list[~azure.mgmt.monitor.v2017_04_01.models.AzureAppPushReceiver] + :param automation_runbook_receivers: The list of AutomationRunbook + receivers that are part of this action group. + :type automation_runbook_receivers: + list[~azure.mgmt.monitor.v2017_04_01.models.AutomationRunbookReceiver] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'group_short_name': {'required': True, 'max_length': 12}, + 'enabled': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'group_short_name': {'key': 'properties.groupShortName', 'type': 'str'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'email_receivers': {'key': 'properties.emailReceivers', 'type': '[EmailReceiver]'}, + 'sms_receivers': {'key': 'properties.smsReceivers', 'type': '[SmsReceiver]'}, + 'webhook_receivers': {'key': 'properties.webhookReceivers', 'type': '[WebhookReceiver]'}, + 'itsm_receivers': {'key': 'properties.itsmReceivers', 'type': '[ItsmReceiver]'}, + 'azure_app_push_receivers': {'key': 'properties.azureAppPushReceivers', 'type': '[AzureAppPushReceiver]'}, + 'automation_runbook_receivers': {'key': 'properties.automationRunbookReceivers', 'type': '[AutomationRunbookReceiver]'}, + } + + def __init__(self, *, location: str, group_short_name: str, tags=None, enabled: bool=True, email_receivers=None, sms_receivers=None, webhook_receivers=None, itsm_receivers=None, azure_app_push_receivers=None, automation_runbook_receivers=None, **kwargs) -> None: + super(ActionGroupResource, self).__init__(location=location, tags=tags, **kwargs) + self.group_short_name = group_short_name + self.enabled = enabled + self.email_receivers = email_receivers + self.sms_receivers = sms_receivers + self.webhook_receivers = webhook_receivers + self.itsm_receivers = itsm_receivers + self.azure_app_push_receivers = azure_app_push_receivers + self.automation_runbook_receivers = automation_runbook_receivers + + +class ActivityLogAlertActionGroup(Model): + """A pointer to an Azure Action Group. + + All required parameters must be populated in order to send to Azure. + + :param action_group_id: Required. The resourceId of the action group. This + cannot be null or empty. + :type action_group_id: str + :param webhook_properties: the dictionary of custom properties to include + with the post operation. These data are appended to the webhook payload. + :type webhook_properties: dict[str, str] + """ + + _validation = { + 'action_group_id': {'required': True}, + } + + _attribute_map = { + 'action_group_id': {'key': 'actionGroupId', 'type': 'str'}, + 'webhook_properties': {'key': 'webhookProperties', 'type': '{str}'}, + } + + def __init__(self, *, action_group_id: str, webhook_properties=None, **kwargs) -> None: + super(ActivityLogAlertActionGroup, self).__init__(**kwargs) + self.action_group_id = action_group_id + self.webhook_properties = webhook_properties + + +class ActivityLogAlertActionList(Model): + """A list of activity log alert actions. + + :param action_groups: The list of activity log alerts. + :type action_groups: + list[~azure.mgmt.monitor.v2017_04_01.models.ActivityLogAlertActionGroup] + """ + + _attribute_map = { + 'action_groups': {'key': 'actionGroups', 'type': '[ActivityLogAlertActionGroup]'}, + } + + def __init__(self, *, action_groups=None, **kwargs) -> None: + super(ActivityLogAlertActionList, self).__init__(**kwargs) + self.action_groups = action_groups + + +class ActivityLogAlertAllOfCondition(Model): + """An Activity Log alert condition that is met when all its member conditions + are met. + + All required parameters must be populated in order to send to Azure. + + :param all_of: Required. The list of activity log alert conditions. + :type all_of: + list[~azure.mgmt.monitor.v2017_04_01.models.ActivityLogAlertLeafCondition] + """ + + _validation = { + 'all_of': {'required': True}, + } + + _attribute_map = { + 'all_of': {'key': 'allOf', 'type': '[ActivityLogAlertLeafCondition]'}, + } + + def __init__(self, *, all_of, **kwargs) -> None: + super(ActivityLogAlertAllOfCondition, self).__init__(**kwargs) + self.all_of = all_of + + +class ActivityLogAlertLeafCondition(Model): + """An Activity Log alert condition that is met by comparing an activity log + field and value. + + All required parameters must be populated in order to send to Azure. + + :param field: Required. The name of the field that this condition will + examine. The possible values for this field are (case-insensitive): + 'resourceId', 'category', 'caller', 'level', 'operationName', + 'resourceGroup', 'resourceProvider', 'status', 'subStatus', + 'resourceType', or anything beginning with 'properties.'. + :type field: str + :param equals: Required. The field value will be compared to this value + (case-insensitive) to determine if the condition is met. + :type equals: str + """ + + _validation = { + 'field': {'required': True}, + 'equals': {'required': True}, + } + + _attribute_map = { + 'field': {'key': 'field', 'type': 'str'}, + 'equals': {'key': 'equals', 'type': 'str'}, + } + + def __init__(self, *, field: str, equals: str, **kwargs) -> None: + super(ActivityLogAlertLeafCondition, self).__init__(**kwargs) + self.field = field + self.equals = equals + + +class ActivityLogAlertPatchBody(Model): + """An activity log alert object for the body of patch operations. + + :param tags: Resource tags + :type tags: dict[str, str] + :param enabled: Indicates whether this activity log alert is enabled. If + an activity log alert is not enabled, then none of its actions will be + activated. Default value: True . + :type enabled: bool + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + } + + def __init__(self, *, tags=None, enabled: bool=True, **kwargs) -> None: + super(ActivityLogAlertPatchBody, self).__init__(**kwargs) + self.tags = tags + self.enabled = enabled + + +class ActivityLogAlertResource(Resource): + """An activity log alert resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param scopes: Required. A list of resourceIds that will be used as + prefixes. The alert will only apply to activityLogs with resourceIds that + fall under one of these prefixes. This list must include at least one + item. + :type scopes: list[str] + :param enabled: Indicates whether this activity log alert is enabled. If + an activity log alert is not enabled, then none of its actions will be + activated. Default value: True . + :type enabled: bool + :param condition: Required. The condition that will cause this alert to + activate. + :type condition: + ~azure.mgmt.monitor.v2017_04_01.models.ActivityLogAlertAllOfCondition + :param actions: Required. The actions that will activate when the + condition is met. + :type actions: + ~azure.mgmt.monitor.v2017_04_01.models.ActivityLogAlertActionList + :param description: A description of this activity log alert. + :type description: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'scopes': {'required': True}, + 'condition': {'required': True}, + 'actions': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'condition': {'key': 'properties.condition', 'type': 'ActivityLogAlertAllOfCondition'}, + 'actions': {'key': 'properties.actions', 'type': 'ActivityLogAlertActionList'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + } + + def __init__(self, *, location: str, scopes, condition, actions, tags=None, enabled: bool=True, description: str=None, **kwargs) -> None: + super(ActivityLogAlertResource, self).__init__(location=location, tags=tags, **kwargs) + self.scopes = scopes + self.enabled = enabled + self.condition = condition + self.actions = actions + self.description = description + + +class AutomationRunbookReceiver(Model): + """The Azure Automation Runbook notification receiver. + + All required parameters must be populated in order to send to Azure. + + :param automation_account_id: Required. The Azure automation account Id + which holds this runbook and authenticate to Azure resource. + :type automation_account_id: str + :param runbook_name: Required. The name for this runbook. + :type runbook_name: str + :param webhook_resource_id: Required. The resource id for webhook linked + to this runbook. + :type webhook_resource_id: str + :param is_global_runbook: Required. Indicates whether this instance is + global runbook. + :type is_global_runbook: bool + :param name: Indicates name of the webhook. + :type name: str + :param service_uri: The URI where webhooks should be sent. + :type service_uri: str + """ + + _validation = { + 'automation_account_id': {'required': True}, + 'runbook_name': {'required': True}, + 'webhook_resource_id': {'required': True}, + 'is_global_runbook': {'required': True}, + } + + _attribute_map = { + 'automation_account_id': {'key': 'automationAccountId', 'type': 'str'}, + 'runbook_name': {'key': 'runbookName', 'type': 'str'}, + 'webhook_resource_id': {'key': 'webhookResourceId', 'type': 'str'}, + 'is_global_runbook': {'key': 'isGlobalRunbook', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + } + + def __init__(self, *, automation_account_id: str, runbook_name: str, webhook_resource_id: str, is_global_runbook: bool, name: str=None, service_uri: str=None, **kwargs) -> None: + super(AutomationRunbookReceiver, self).__init__(**kwargs) + self.automation_account_id = automation_account_id + self.runbook_name = runbook_name + self.webhook_resource_id = webhook_resource_id + self.is_global_runbook = is_global_runbook + self.name = name + self.service_uri = service_uri + + +class AzureAppPushReceiver(Model): + """The Azure mobile App push notification receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the Azure mobile app push receiver. + Names must be unique across all receivers within an action group. + :type name: str + :param email_address: Required. The email address registered for the Azure + mobile app. + :type email_address: str + """ + + _validation = { + 'name': {'required': True}, + 'email_address': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + } + + def __init__(self, *, name: str, email_address: str, **kwargs) -> None: + super(AzureAppPushReceiver, self).__init__(**kwargs) + self.name = name + self.email_address = email_address + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class EmailReceiver(Model): + """An email receiver. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the email receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param email_address: Required. The email address of this receiver. + :type email_address: str + :ivar status: The receiver status of the e-mail. Possible values include: + 'NotSpecified', 'Enabled', 'Disabled' + :vartype status: str or + ~azure.mgmt.monitor.v2017_04_01.models.ReceiverStatus + """ + + _validation = { + 'name': {'required': True}, + 'email_address': {'required': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'ReceiverStatus'}, + } + + def __init__(self, *, name: str, email_address: str, **kwargs) -> None: + super(EmailReceiver, self).__init__(**kwargs) + self.name = name + self.email_address = email_address + self.status = None + + +class EnableRequest(Model): + """Describes a receiver that should be resubscribed. + + All required parameters must be populated in order to send to Azure. + + :param receiver_name: Required. The name of the receiver to resubscribe. + :type receiver_name: str + """ + + _validation = { + 'receiver_name': {'required': True}, + } + + _attribute_map = { + 'receiver_name': {'key': 'receiverName', 'type': 'str'}, + } + + def __init__(self, *, receiver_name: str, **kwargs) -> None: + super(EnableRequest, self).__init__(**kwargs) + self.receiver_name = receiver_name + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class ItsmReceiver(Model): + """An Itsm receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the Itsm receiver. Names must be unique + across all receivers within an action group. + :type name: str + :param workspace_id: Required. OMS LA instance identifier. + :type workspace_id: str + :param connection_id: Required. Unique identification of ITSM connection + among multiple defined in above workspace. + :type connection_id: str + :param ticket_configuration: Required. JSON blob for the configurations of + the ITSM action. CreateMultipleWorkItems option will be part of this blob + as well. + :type ticket_configuration: str + :param region: Required. Region in which workspace resides. Supported + values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' + :type region: str + """ + + _validation = { + 'name': {'required': True}, + 'workspace_id': {'required': True}, + 'connection_id': {'required': True}, + 'ticket_configuration': {'required': True}, + 'region': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, + 'connection_id': {'key': 'connectionId', 'type': 'str'}, + 'ticket_configuration': {'key': 'ticketConfiguration', 'type': 'str'}, + 'region': {'key': 'region', 'type': 'str'}, + } + + def __init__(self, *, name: str, workspace_id: str, connection_id: str, ticket_configuration: str, region: str, **kwargs) -> None: + super(ItsmReceiver, self).__init__(**kwargs) + self.name = name + self.workspace_id = workspace_id + self.connection_id = connection_id + self.ticket_configuration = ticket_configuration + self.region = region + + +class SmsReceiver(Model): + """An SMS receiver. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the SMS receiver. Names must be unique + across all receivers within an action group. + :type name: str + :param country_code: Required. The country code of the SMS receiver. + :type country_code: str + :param phone_number: Required. The phone number of the SMS receiver. + :type phone_number: str + :ivar status: The status of the receiver. Possible values include: + 'NotSpecified', 'Enabled', 'Disabled' + :vartype status: str or + ~azure.mgmt.monitor.v2017_04_01.models.ReceiverStatus + """ + + _validation = { + 'name': {'required': True}, + 'country_code': {'required': True}, + 'phone_number': {'required': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'phone_number': {'key': 'phoneNumber', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'ReceiverStatus'}, + } + + def __init__(self, *, name: str, country_code: str, phone_number: str, **kwargs) -> None: + super(SmsReceiver, self).__init__(**kwargs) + self.name = name + self.country_code = country_code + self.phone_number = phone_number + self.status = None + + +class WebhookReceiver(Model): + """A webhook receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the webhook receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param service_uri: Required. The URI where webhooks should be sent. + :type service_uri: str + """ + + _validation = { + 'name': {'required': True}, + 'service_uri': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + } + + def __init__(self, *, name: str, service_uri: str, **kwargs) -> None: + super(WebhookReceiver, self).__init__(**kwargs) + self.name = name + self.service_uri = service_uri diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/_monitor_management_client_enums.py new file mode 100644 index 000000000000..b6d8fd20db3d --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/_monitor_management_client_enums.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum + + +class ReceiverStatus(str, Enum): + + not_specified = "NotSpecified" + enabled = "Enabled" + disabled = "Disabled" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/_paged_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/_paged_models.py new file mode 100644 index 000000000000..54ceb4db4d3f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/_paged_models.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class ActionGroupResourcePaged(Paged): + """ + A paging container for iterating over a list of :class:`ActionGroupResource ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ActionGroupResource]'} + } + + def __init__(self, *args, **kwargs): + + super(ActionGroupResourcePaged, self).__init__(*args, **kwargs) +class ActivityLogAlertResourcePaged(Paged): + """ + A paging container for iterating over a list of :class:`ActivityLogAlertResource ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ActivityLogAlertResource]'} + } + + def __init__(self, *args, **kwargs): + + super(ActivityLogAlertResourcePaged, self).__init__(*args, **kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/__init__.py new file mode 100644 index 000000000000..15cb305d44c2 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/__init__.py @@ -0,0 +1,18 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._action_groups_operations import ActionGroupsOperations +from ._activity_log_alerts_operations import ActivityLogAlertsOperations + +__all__ = [ + 'ActionGroupsOperations', + 'ActivityLogAlertsOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/_action_groups_operations.py new file mode 100644 index 000000000000..0db184e69e23 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/_action_groups_operations.py @@ -0,0 +1,487 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class ActionGroupsOperations(object): + """ActionGroupsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2017-04-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-04-01" + + self.config = config + + def create_or_update( + self, resource_group_name, action_group_name, action_group, custom_headers=None, raw=False, **operation_config): + """Create a new action group or update an existing one. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param action_group_name: The name of the action group. + :type action_group_name: str + :param action_group: The action group to create or use for the update. + :type action_group: + ~azure.mgmt.monitor.v2017_04_01.models.ActionGroupResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ActionGroupResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2017_04_01.models.ActionGroupResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(action_group, 'ActionGroupResource') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ActionGroupResource', response) + if response.status_code == 201: + deserialized = self._deserialize('ActionGroupResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} + + def get( + self, resource_group_name, action_group_name, custom_headers=None, raw=False, **operation_config): + """Get an action group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param action_group_name: The name of the action group. + :type action_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ActionGroupResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2017_04_01.models.ActionGroupResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ActionGroupResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} + + def delete( + self, resource_group_name, action_group_name, custom_headers=None, raw=False, **operation_config): + """Delete an action group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param action_group_name: The name of the action group. + :type action_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} + + def update( + self, resource_group_name, action_group_name, tags=None, enabled=True, custom_headers=None, raw=False, **operation_config): + """Updates an existing action group's tags. To update other fields use the + CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param action_group_name: The name of the action group. + :type action_group_name: str + :param tags: Resource tags + :type tags: dict[str, str] + :param enabled: Indicates whether this action group is enabled. If an + action group is not enabled, then none of its actions will be + activated. + :type enabled: bool + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ActionGroupResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2017_04_01.models.ActionGroupResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + action_group_patch = models.ActionGroupPatchBody(tags=tags, enabled=enabled) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(action_group_patch, 'ActionGroupPatchBody') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ActionGroupResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} + + def list_by_subscription_id( + self, custom_headers=None, raw=False, **operation_config): + """Get a list of all action groups in a subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ActionGroupResource + :rtype: + ~azure.mgmt.monitor.v2017_04_01.models.ActionGroupResourcePaged[~azure.mgmt.monitor.v2017_04_01.models.ActionGroupResource] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription_id.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ActionGroupResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Get a list of all action groups in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ActionGroupResource + :rtype: + ~azure.mgmt.monitor.v2017_04_01.models.ActionGroupResourcePaged[~azure.mgmt.monitor.v2017_04_01.models.ActionGroupResource] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ActionGroupResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups'} + + def enable_receiver( + self, resource_group_name, action_group_name, receiver_name, custom_headers=None, raw=False, **operation_config): + """Enable a receiver in an action group. This changes the receiver's + status from Disabled to Enabled. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param action_group_name: The name of the action group. + :type action_group_name: str + :param receiver_name: The name of the receiver to resubscribe. + :type receiver_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + enable_request = models.EnableRequest(receiver_name=receiver_name) + + # Construct URL + url = self.enable_receiver.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(enable_request, 'EnableRequest') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 409]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + enable_receiver.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/_activity_log_alerts_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/_activity_log_alerts_operations.py new file mode 100644 index 000000000000..878c1d235e69 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/_activity_log_alerts_operations.py @@ -0,0 +1,430 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class ActivityLogAlertsOperations(object): + """ActivityLogAlertsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2017-04-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-04-01" + + self.config = config + + def create_or_update( + self, resource_group_name, activity_log_alert_name, activity_log_alert, custom_headers=None, raw=False, **operation_config): + """Create a new activity log alert or update an existing one. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param activity_log_alert_name: The name of the activity log alert. + :type activity_log_alert_name: str + :param activity_log_alert: The activity log alert to create or use for + the update. + :type activity_log_alert: + ~azure.mgmt.monitor.v2017_04_01.models.ActivityLogAlertResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ActivityLogAlertResource or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.monitor.v2017_04_01.models.ActivityLogAlertResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(activity_log_alert, 'ActivityLogAlertResource') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ActivityLogAlertResource', response) + if response.status_code == 201: + deserialized = self._deserialize('ActivityLogAlertResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}'} + + def get( + self, resource_group_name, activity_log_alert_name, custom_headers=None, raw=False, **operation_config): + """Get an activity log alert. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param activity_log_alert_name: The name of the activity log alert. + :type activity_log_alert_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ActivityLogAlertResource or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.monitor.v2017_04_01.models.ActivityLogAlertResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ActivityLogAlertResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}'} + + def delete( + self, resource_group_name, activity_log_alert_name, custom_headers=None, raw=False, **operation_config): + """Delete an activity log alert. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param activity_log_alert_name: The name of the activity log alert. + :type activity_log_alert_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}'} + + def update( + self, resource_group_name, activity_log_alert_name, tags=None, enabled=True, custom_headers=None, raw=False, **operation_config): + """Updates an existing ActivityLogAlertResource's tags. To update other + fields use the CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param activity_log_alert_name: The name of the activity log alert. + :type activity_log_alert_name: str + :param tags: Resource tags + :type tags: dict[str, str] + :param enabled: Indicates whether this activity log alert is enabled. + If an activity log alert is not enabled, then none of its actions will + be activated. + :type enabled: bool + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ActivityLogAlertResource or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.monitor.v2017_04_01.models.ActivityLogAlertResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + activity_log_alert_patch = models.ActivityLogAlertPatchBody(tags=tags, enabled=enabled) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(activity_log_alert_patch, 'ActivityLogAlertPatchBody') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ActivityLogAlertResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}'} + + def list_by_subscription_id( + self, custom_headers=None, raw=False, **operation_config): + """Get a list of all activity log alerts in a subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ActivityLogAlertResource + :rtype: + ~azure.mgmt.monitor.v2017_04_01.models.ActivityLogAlertResourcePaged[~azure.mgmt.monitor.v2017_04_01.models.ActivityLogAlertResource] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription_id.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ActivityLogAlertResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Get a list of all activity log alerts in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ActivityLogAlertResource + :rtype: + ~azure.mgmt.monitor.v2017_04_01.models.ActivityLogAlertResourcePaged[~azure.mgmt.monitor.v2017_04_01.models.ActivityLogAlertResource] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ActivityLogAlertResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/version.py new file mode 100644 index 000000000000..5c2dbfde66c5 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2017-04-01" + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/__init__.py new file mode 100644 index 000000000000..8e97360e5ffb --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._configuration import MonitorManagementClientConfiguration +from ._monitor_management_client import MonitorManagementClient +__all__ = ['MonitorManagementClient', 'MonitorManagementClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_configuration.py new file mode 100644 index 000000000000..9b4e1e19d961 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_configuration.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +from msrestazure import AzureConfiguration + +from .version import VERSION + + +class MonitorManagementClientConfiguration(AzureConfiguration): + """Configuration for MonitorManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param str base_url: Service URL + """ + + def __init__( + self, credentials, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(MonitorManagementClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-monitor/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_monitor_management_client.py new file mode 100644 index 000000000000..05e2b143e993 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_monitor_management_client.py @@ -0,0 +1,62 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import MonitorManagementClientConfiguration +from .operations import DiagnosticSettingsCategoryOperations +from .operations import DiagnosticSettingsOperations +from .operations import MetricDefinitionsOperations +from .operations import MetricsOperations +from . import models + + +class MonitorManagementClient(SDKClient): + """Monitor Management Client + + :ivar config: Configuration for client. + :vartype config: MonitorManagementClientConfiguration + + :ivar diagnostic_settings_category: DiagnosticSettingsCategory operations + :vartype diagnostic_settings_category: azure.mgmt.monitor.v2017_05_01_preview.operations.DiagnosticSettingsCategoryOperations + :ivar diagnostic_settings: DiagnosticSettings operations + :vartype diagnostic_settings: azure.mgmt.monitor.v2017_05_01_preview.operations.DiagnosticSettingsOperations + :ivar metric_definitions: MetricDefinitions operations + :vartype metric_definitions: azure.mgmt.monitor.v2017_05_01_preview.operations.MetricDefinitionsOperations + :ivar metrics: Metrics operations + :vartype metrics: azure.mgmt.monitor.v2017_05_01_preview.operations.MetricsOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param str base_url: Service URL + """ + + def __init__( + self, credentials, base_url=None): + + self.config = MonitorManagementClientConfiguration(credentials, base_url) + super(MonitorManagementClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2017-05-01-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.diagnostic_settings_category = DiagnosticSettingsCategoryOperations( + self._client, self.config, self._serialize, self._deserialize) + self.diagnostic_settings = DiagnosticSettingsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.metric_definitions = MetricDefinitionsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.metrics = MetricsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/__init__.py new file mode 100644 index 000000000000..55ca858563fa --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/__init__.py @@ -0,0 +1,79 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import DiagnosticSettingsCategoryResource + from ._models_py3 import DiagnosticSettingsCategoryResourceCollection + from ._models_py3 import DiagnosticSettingsResource + from ._models_py3 import DiagnosticSettingsResourceCollection + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import LocalizableString + from ._models_py3 import LogSettings + from ._models_py3 import MetadataValue + from ._models_py3 import Metric + from ._models_py3 import MetricAvailability + from ._models_py3 import MetricDefinition + from ._models_py3 import MetricSettings + from ._models_py3 import MetricValue + from ._models_py3 import ProxyOnlyResource + from ._models_py3 import Response + from ._models_py3 import RetentionPolicy + from ._models_py3 import TimeSeriesElement +except (SyntaxError, ImportError): + from ._models import DiagnosticSettingsCategoryResource + from ._models import DiagnosticSettingsCategoryResourceCollection + from ._models import DiagnosticSettingsResource + from ._models import DiagnosticSettingsResourceCollection + from ._models import ErrorResponse, ErrorResponseException + from ._models import LocalizableString + from ._models import LogSettings + from ._models import MetadataValue + from ._models import Metric + from ._models import MetricAvailability + from ._models import MetricDefinition + from ._models import MetricSettings + from ._models import MetricValue + from ._models import ProxyOnlyResource + from ._models import Response + from ._models import RetentionPolicy + from ._models import TimeSeriesElement +from ._paged_models import MetricDefinitionPaged +from ._monitor_management_client_enums import ( + CategoryType, + Unit, + AggregationType, + ResultType, +) + +__all__ = [ + 'DiagnosticSettingsCategoryResource', + 'DiagnosticSettingsCategoryResourceCollection', + 'DiagnosticSettingsResource', + 'DiagnosticSettingsResourceCollection', + 'ErrorResponse', 'ErrorResponseException', + 'LocalizableString', + 'LogSettings', + 'MetadataValue', + 'Metric', + 'MetricAvailability', + 'MetricDefinition', + 'MetricSettings', + 'MetricValue', + 'ProxyOnlyResource', + 'Response', + 'RetentionPolicy', + 'TimeSeriesElement', + 'MetricDefinitionPaged', + 'CategoryType', + 'Unit', + 'AggregationType', + 'ResultType', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_models.py new file mode 100644 index 000000000000..1f45012628e6 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_models.py @@ -0,0 +1,614 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ProxyOnlyResource(Model): + """A proxy only azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ProxyOnlyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class DiagnosticSettingsCategoryResource(ProxyOnlyResource): + """The diagnostic settings category resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param category_type: The type of the diagnostic settings category. + Possible values include: 'Metrics', 'Logs' + :type category_type: str or + ~azure.mgmt.monitor.v2017_05_01_preview.models.CategoryType + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'category_type': {'key': 'properties.categoryType', 'type': 'CategoryType'}, + } + + def __init__(self, **kwargs): + super(DiagnosticSettingsCategoryResource, self).__init__(**kwargs) + self.category_type = kwargs.get('category_type', None) + + +class DiagnosticSettingsCategoryResourceCollection(Model): + """Represents a collection of diagnostic setting category resources. + + :param value: The collection of diagnostic settings category resources. + :type value: + list[~azure.mgmt.monitor.v2017_05_01_preview.models.DiagnosticSettingsCategoryResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DiagnosticSettingsCategoryResource]'}, + } + + def __init__(self, **kwargs): + super(DiagnosticSettingsCategoryResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class DiagnosticSettingsResource(ProxyOnlyResource): + """The diagnostic setting resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param storage_account_id: The resource ID of the storage account to which + you would like to send Diagnostic Logs. + :type storage_account_id: str + :param service_bus_rule_id: The service bus rule Id of the diagnostic + setting. This is here to maintain backwards compatibility. + :type service_bus_rule_id: str + :param event_hub_authorization_rule_id: The resource Id for the event hub + authorization rule. + :type event_hub_authorization_rule_id: str + :param event_hub_name: The name of the event hub. If none is specified, + the default event hub will be selected. + :type event_hub_name: str + :param metrics: the list of metric settings. + :type metrics: + list[~azure.mgmt.monitor.v2017_05_01_preview.models.MetricSettings] + :param logs: the list of logs settings. + :type logs: + list[~azure.mgmt.monitor.v2017_05_01_preview.models.LogSettings] + :param workspace_id: The workspace ID (resource ID of a Log Analytics + workspace) for a Log Analytics workspace to which you would like to send + Diagnostic Logs. Example: + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + :type workspace_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, + 'event_hub_authorization_rule_id': {'key': 'properties.eventHubAuthorizationRuleId', 'type': 'str'}, + 'event_hub_name': {'key': 'properties.eventHubName', 'type': 'str'}, + 'metrics': {'key': 'properties.metrics', 'type': '[MetricSettings]'}, + 'logs': {'key': 'properties.logs', 'type': '[LogSettings]'}, + 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DiagnosticSettingsResource, self).__init__(**kwargs) + self.storage_account_id = kwargs.get('storage_account_id', None) + self.service_bus_rule_id = kwargs.get('service_bus_rule_id', None) + self.event_hub_authorization_rule_id = kwargs.get('event_hub_authorization_rule_id', None) + self.event_hub_name = kwargs.get('event_hub_name', None) + self.metrics = kwargs.get('metrics', None) + self.logs = kwargs.get('logs', None) + self.workspace_id = kwargs.get('workspace_id', None) + + +class DiagnosticSettingsResourceCollection(Model): + """Represents a collection of alert rule resources. + + :param value: The collection of diagnostic settings resources;. + :type value: + list[~azure.mgmt.monitor.v2017_05_01_preview.models.DiagnosticSettingsResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DiagnosticSettingsResource]'}, + } + + def __init__(self, **kwargs): + super(DiagnosticSettingsResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class LocalizableString(Model): + """The localizable string class. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. the invariant value. + :type value: str + :param localized_value: the locale specific value. + :type localized_value: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(LocalizableString, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.localized_value = kwargs.get('localized_value', None) + + +class LogSettings(Model): + """Part of MultiTenantDiagnosticSettings. Specifies the settings for a + particular log. + + All required parameters must be populated in order to send to Azure. + + :param category: Name of a Diagnostic Log category for a resource type + this setting is applied to. To obtain the list of Diagnostic Log + categories for a resource, first perform a GET diagnostic settings + operation. + :type category: str + :param enabled: Required. a value indicating whether this log is enabled. + :type enabled: bool + :param retention_policy: the retention policy for this log. + :type retention_policy: + ~azure.mgmt.monitor.v2017_05_01_preview.models.RetentionPolicy + """ + + _validation = { + 'enabled': {'required': True}, + } + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + } + + def __init__(self, **kwargs): + super(LogSettings, self).__init__(**kwargs) + self.category = kwargs.get('category', None) + self.enabled = kwargs.get('enabled', None) + self.retention_policy = kwargs.get('retention_policy', None) + + +class MetadataValue(Model): + """Represents a metric metadata value. + + :param name: the name of the metadata. + :type name: + ~azure.mgmt.monitor.v2017_05_01_preview.models.LocalizableString + :param value: the value of the metadata. + :type value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MetadataValue, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.value = kwargs.get('value', None) + + +class Metric(Model): + """The result data of a query. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. the metric Id. + :type id: str + :param type: Required. the resource type of the metric resource. + :type type: str + :param name: Required. the name and the display name of the metric, i.e. + it is localizable string. + :type name: + ~azure.mgmt.monitor.v2017_05_01_preview.models.LocalizableString + :param unit: Required. the unit of the metric. Possible values include: + 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', + 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified' + :type unit: str or ~azure.mgmt.monitor.v2017_05_01_preview.models.Unit + :param timeseries: Required. the time series returned when a data query is + performed. + :type timeseries: + list[~azure.mgmt.monitor.v2017_05_01_preview.models.TimeSeriesElement] + """ + + _validation = { + 'id': {'required': True}, + 'type': {'required': True}, + 'name': {'required': True}, + 'unit': {'required': True}, + 'timeseries': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'unit': {'key': 'unit', 'type': 'Unit'}, + 'timeseries': {'key': 'timeseries', 'type': '[TimeSeriesElement]'}, + } + + def __init__(self, **kwargs): + super(Metric, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.type = kwargs.get('type', None) + self.name = kwargs.get('name', None) + self.unit = kwargs.get('unit', None) + self.timeseries = kwargs.get('timeseries', None) + + +class MetricAvailability(Model): + """Metric availability specifies the time grain (aggregation interval or + frequency) and the retention period for that time grain. + + :param time_grain: the time grain specifies the aggregation interval for + the metric. Expressed as a duration 'PT1M', 'P1D', etc. + :type time_grain: timedelta + :param retention: the retention period for the metric at the specified + timegrain. Expressed as a duration 'PT1M', 'P1D', etc. + :type retention: timedelta + """ + + _attribute_map = { + 'time_grain': {'key': 'timeGrain', 'type': 'duration'}, + 'retention': {'key': 'retention', 'type': 'duration'}, + } + + def __init__(self, **kwargs): + super(MetricAvailability, self).__init__(**kwargs) + self.time_grain = kwargs.get('time_grain', None) + self.retention = kwargs.get('retention', None) + + +class MetricDefinition(Model): + """Metric definition class specifies the metadata for a metric. + + :param is_dimension_required: Flag to indicate whether the dimension is + required. + :type is_dimension_required: bool + :param resource_id: the resource identifier of the resource that emitted + the metric. + :type resource_id: str + :param name: the name and the display name of the metric, i.e. it is a + localizable string. + :type name: + ~azure.mgmt.monitor.v2017_05_01_preview.models.LocalizableString + :param unit: the unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', + 'MilliSeconds', 'ByteSeconds', 'Unspecified' + :type unit: str or ~azure.mgmt.monitor.v2017_05_01_preview.models.Unit + :param primary_aggregation_type: the primary aggregation type value + defining how to use the values for display. Possible values include: + 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' + :type primary_aggregation_type: str or + ~azure.mgmt.monitor.v2017_05_01_preview.models.AggregationType + :param metric_availabilities: the collection of what aggregation intervals + are available to be queried. + :type metric_availabilities: + list[~azure.mgmt.monitor.v2017_05_01_preview.models.MetricAvailability] + :param id: the resource identifier of the metric definition. + :type id: str + :param dimensions: the name and the display name of the dimension, i.e. it + is a localizable string. + :type dimensions: + list[~azure.mgmt.monitor.v2017_05_01_preview.models.LocalizableString] + """ + + _attribute_map = { + 'is_dimension_required': {'key': 'isDimensionRequired', 'type': 'bool'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'unit': {'key': 'unit', 'type': 'Unit'}, + 'primary_aggregation_type': {'key': 'primaryAggregationType', 'type': 'AggregationType'}, + 'metric_availabilities': {'key': 'metricAvailabilities', 'type': '[MetricAvailability]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[LocalizableString]'}, + } + + def __init__(self, **kwargs): + super(MetricDefinition, self).__init__(**kwargs) + self.is_dimension_required = kwargs.get('is_dimension_required', None) + self.resource_id = kwargs.get('resource_id', None) + self.name = kwargs.get('name', None) + self.unit = kwargs.get('unit', None) + self.primary_aggregation_type = kwargs.get('primary_aggregation_type', None) + self.metric_availabilities = kwargs.get('metric_availabilities', None) + self.id = kwargs.get('id', None) + self.dimensions = kwargs.get('dimensions', None) + + +class MetricSettings(Model): + """Part of MultiTenantDiagnosticSettings. Specifies the settings for a + particular metric. + + All required parameters must be populated in order to send to Azure. + + :param time_grain: the timegrain of the metric in ISO8601 format. + :type time_grain: timedelta + :param category: Name of a Diagnostic Metric category for a resource type + this setting is applied to. To obtain the list of Diagnostic metric + categories for a resource, first perform a GET diagnostic settings + operation. + :type category: str + :param enabled: Required. a value indicating whether this category is + enabled. + :type enabled: bool + :param retention_policy: the retention policy for this category. + :type retention_policy: + ~azure.mgmt.monitor.v2017_05_01_preview.models.RetentionPolicy + """ + + _validation = { + 'enabled': {'required': True}, + } + + _attribute_map = { + 'time_grain': {'key': 'timeGrain', 'type': 'duration'}, + 'category': {'key': 'category', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + } + + def __init__(self, **kwargs): + super(MetricSettings, self).__init__(**kwargs) + self.time_grain = kwargs.get('time_grain', None) + self.category = kwargs.get('category', None) + self.enabled = kwargs.get('enabled', None) + self.retention_policy = kwargs.get('retention_policy', None) + + +class MetricValue(Model): + """Represents a metric value. + + All required parameters must be populated in order to send to Azure. + + :param time_stamp: Required. the timestamp for the metric value in ISO + 8601 format. + :type time_stamp: datetime + :param average: the average value in the time range. + :type average: float + :param minimum: the least value in the time range. + :type minimum: float + :param maximum: the greatest value in the time range. + :type maximum: float + :param total: the sum of all of the values in the time range. + :type total: float + :param count: the number of samples in the time range. Can be used to + determine the number of values that contributed to the average value. + :type count: long + """ + + _validation = { + 'time_stamp': {'required': True}, + } + + _attribute_map = { + 'time_stamp': {'key': 'timeStamp', 'type': 'iso-8601'}, + 'average': {'key': 'average', 'type': 'float'}, + 'minimum': {'key': 'minimum', 'type': 'float'}, + 'maximum': {'key': 'maximum', 'type': 'float'}, + 'total': {'key': 'total', 'type': 'float'}, + 'count': {'key': 'count', 'type': 'long'}, + } + + def __init__(self, **kwargs): + super(MetricValue, self).__init__(**kwargs) + self.time_stamp = kwargs.get('time_stamp', None) + self.average = kwargs.get('average', None) + self.minimum = kwargs.get('minimum', None) + self.maximum = kwargs.get('maximum', None) + self.total = kwargs.get('total', None) + self.count = kwargs.get('count', None) + + +class Response(Model): + """The response to a metrics query. + + All required parameters must be populated in order to send to Azure. + + :param cost: The integer value representing the cost of the query, for + data case. + :type cost: float + :param timespan: Required. The timespan for which the data was retrieved. + Its value consists of two datetimes concatenated, separated by '/'. This + may be adjusted in the future and returned back from what was originally + requested. + :type timespan: str + :param interval: The interval (window size) for which the metric data was + returned in. This may be adjusted in the future and returned back from + what was originally requested. This is not present if a metadata request + was made. + :type interval: timedelta + :param value: Required. the value of the collection. + :type value: list[~azure.mgmt.monitor.v2017_05_01_preview.models.Metric] + """ + + _validation = { + 'cost': {'minimum': 0}, + 'timespan': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'cost': {'key': 'cost', 'type': 'float'}, + 'timespan': {'key': 'timespan', 'type': 'str'}, + 'interval': {'key': 'interval', 'type': 'duration'}, + 'value': {'key': 'value', 'type': '[Metric]'}, + } + + def __init__(self, **kwargs): + super(Response, self).__init__(**kwargs) + self.cost = kwargs.get('cost', None) + self.timespan = kwargs.get('timespan', None) + self.interval = kwargs.get('interval', None) + self.value = kwargs.get('value', None) + + +class RetentionPolicy(Model): + """Specifies the retention policy for the log. + + All required parameters must be populated in order to send to Azure. + + :param enabled: Required. a value indicating whether the retention policy + is enabled. + :type enabled: bool + :param days: Required. the number of days for the retention in days. A + value of 0 will retain the events indefinitely. + :type days: int + """ + + _validation = { + 'enabled': {'required': True}, + 'days': {'required': True, 'minimum': 0}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'days': {'key': 'days', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(RetentionPolicy, self).__init__(**kwargs) + self.enabled = kwargs.get('enabled', None) + self.days = kwargs.get('days', None) + + +class TimeSeriesElement(Model): + """A time series result type. The discriminator value is always TimeSeries in + this case. + + :param metadatavalues: the metadata values returned if $filter was + specified in the call. + :type metadatavalues: + list[~azure.mgmt.monitor.v2017_05_01_preview.models.MetadataValue] + :param data: An array of data points representing the metric values. This + is only returned if a result type of data is specified. + :type data: + list[~azure.mgmt.monitor.v2017_05_01_preview.models.MetricValue] + """ + + _attribute_map = { + 'metadatavalues': {'key': 'metadatavalues', 'type': '[MetadataValue]'}, + 'data': {'key': 'data', 'type': '[MetricValue]'}, + } + + def __init__(self, **kwargs): + super(TimeSeriesElement, self).__init__(**kwargs) + self.metadatavalues = kwargs.get('metadatavalues', None) + self.data = kwargs.get('data', None) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_models_py3.py new file mode 100644 index 000000000000..62b3b6b184d8 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_models_py3.py @@ -0,0 +1,614 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ProxyOnlyResource(Model): + """A proxy only azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(ProxyOnlyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class DiagnosticSettingsCategoryResource(ProxyOnlyResource): + """The diagnostic settings category resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param category_type: The type of the diagnostic settings category. + Possible values include: 'Metrics', 'Logs' + :type category_type: str or + ~azure.mgmt.monitor.v2017_05_01_preview.models.CategoryType + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'category_type': {'key': 'properties.categoryType', 'type': 'CategoryType'}, + } + + def __init__(self, *, category_type=None, **kwargs) -> None: + super(DiagnosticSettingsCategoryResource, self).__init__(**kwargs) + self.category_type = category_type + + +class DiagnosticSettingsCategoryResourceCollection(Model): + """Represents a collection of diagnostic setting category resources. + + :param value: The collection of diagnostic settings category resources. + :type value: + list[~azure.mgmt.monitor.v2017_05_01_preview.models.DiagnosticSettingsCategoryResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DiagnosticSettingsCategoryResource]'}, + } + + def __init__(self, *, value=None, **kwargs) -> None: + super(DiagnosticSettingsCategoryResourceCollection, self).__init__(**kwargs) + self.value = value + + +class DiagnosticSettingsResource(ProxyOnlyResource): + """The diagnostic setting resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param storage_account_id: The resource ID of the storage account to which + you would like to send Diagnostic Logs. + :type storage_account_id: str + :param service_bus_rule_id: The service bus rule Id of the diagnostic + setting. This is here to maintain backwards compatibility. + :type service_bus_rule_id: str + :param event_hub_authorization_rule_id: The resource Id for the event hub + authorization rule. + :type event_hub_authorization_rule_id: str + :param event_hub_name: The name of the event hub. If none is specified, + the default event hub will be selected. + :type event_hub_name: str + :param metrics: the list of metric settings. + :type metrics: + list[~azure.mgmt.monitor.v2017_05_01_preview.models.MetricSettings] + :param logs: the list of logs settings. + :type logs: + list[~azure.mgmt.monitor.v2017_05_01_preview.models.LogSettings] + :param workspace_id: The workspace ID (resource ID of a Log Analytics + workspace) for a Log Analytics workspace to which you would like to send + Diagnostic Logs. Example: + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + :type workspace_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, + 'event_hub_authorization_rule_id': {'key': 'properties.eventHubAuthorizationRuleId', 'type': 'str'}, + 'event_hub_name': {'key': 'properties.eventHubName', 'type': 'str'}, + 'metrics': {'key': 'properties.metrics', 'type': '[MetricSettings]'}, + 'logs': {'key': 'properties.logs', 'type': '[LogSettings]'}, + 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, + } + + def __init__(self, *, storage_account_id: str=None, service_bus_rule_id: str=None, event_hub_authorization_rule_id: str=None, event_hub_name: str=None, metrics=None, logs=None, workspace_id: str=None, **kwargs) -> None: + super(DiagnosticSettingsResource, self).__init__(**kwargs) + self.storage_account_id = storage_account_id + self.service_bus_rule_id = service_bus_rule_id + self.event_hub_authorization_rule_id = event_hub_authorization_rule_id + self.event_hub_name = event_hub_name + self.metrics = metrics + self.logs = logs + self.workspace_id = workspace_id + + +class DiagnosticSettingsResourceCollection(Model): + """Represents a collection of alert rule resources. + + :param value: The collection of diagnostic settings resources;. + :type value: + list[~azure.mgmt.monitor.v2017_05_01_preview.models.DiagnosticSettingsResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DiagnosticSettingsResource]'}, + } + + def __init__(self, *, value=None, **kwargs) -> None: + super(DiagnosticSettingsResourceCollection, self).__init__(**kwargs) + self.value = value + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class LocalizableString(Model): + """The localizable string class. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. the invariant value. + :type value: str + :param localized_value: the locale specific value. + :type localized_value: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__(self, *, value: str, localized_value: str=None, **kwargs) -> None: + super(LocalizableString, self).__init__(**kwargs) + self.value = value + self.localized_value = localized_value + + +class LogSettings(Model): + """Part of MultiTenantDiagnosticSettings. Specifies the settings for a + particular log. + + All required parameters must be populated in order to send to Azure. + + :param category: Name of a Diagnostic Log category for a resource type + this setting is applied to. To obtain the list of Diagnostic Log + categories for a resource, first perform a GET diagnostic settings + operation. + :type category: str + :param enabled: Required. a value indicating whether this log is enabled. + :type enabled: bool + :param retention_policy: the retention policy for this log. + :type retention_policy: + ~azure.mgmt.monitor.v2017_05_01_preview.models.RetentionPolicy + """ + + _validation = { + 'enabled': {'required': True}, + } + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + } + + def __init__(self, *, enabled: bool, category: str=None, retention_policy=None, **kwargs) -> None: + super(LogSettings, self).__init__(**kwargs) + self.category = category + self.enabled = enabled + self.retention_policy = retention_policy + + +class MetadataValue(Model): + """Represents a metric metadata value. + + :param name: the name of the metadata. + :type name: + ~azure.mgmt.monitor.v2017_05_01_preview.models.LocalizableString + :param value: the value of the metadata. + :type value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, *, name=None, value: str=None, **kwargs) -> None: + super(MetadataValue, self).__init__(**kwargs) + self.name = name + self.value = value + + +class Metric(Model): + """The result data of a query. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. the metric Id. + :type id: str + :param type: Required. the resource type of the metric resource. + :type type: str + :param name: Required. the name and the display name of the metric, i.e. + it is localizable string. + :type name: + ~azure.mgmt.monitor.v2017_05_01_preview.models.LocalizableString + :param unit: Required. the unit of the metric. Possible values include: + 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', + 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified' + :type unit: str or ~azure.mgmt.monitor.v2017_05_01_preview.models.Unit + :param timeseries: Required. the time series returned when a data query is + performed. + :type timeseries: + list[~azure.mgmt.monitor.v2017_05_01_preview.models.TimeSeriesElement] + """ + + _validation = { + 'id': {'required': True}, + 'type': {'required': True}, + 'name': {'required': True}, + 'unit': {'required': True}, + 'timeseries': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'unit': {'key': 'unit', 'type': 'Unit'}, + 'timeseries': {'key': 'timeseries', 'type': '[TimeSeriesElement]'}, + } + + def __init__(self, *, id: str, type: str, name, unit, timeseries, **kwargs) -> None: + super(Metric, self).__init__(**kwargs) + self.id = id + self.type = type + self.name = name + self.unit = unit + self.timeseries = timeseries + + +class MetricAvailability(Model): + """Metric availability specifies the time grain (aggregation interval or + frequency) and the retention period for that time grain. + + :param time_grain: the time grain specifies the aggregation interval for + the metric. Expressed as a duration 'PT1M', 'P1D', etc. + :type time_grain: timedelta + :param retention: the retention period for the metric at the specified + timegrain. Expressed as a duration 'PT1M', 'P1D', etc. + :type retention: timedelta + """ + + _attribute_map = { + 'time_grain': {'key': 'timeGrain', 'type': 'duration'}, + 'retention': {'key': 'retention', 'type': 'duration'}, + } + + def __init__(self, *, time_grain=None, retention=None, **kwargs) -> None: + super(MetricAvailability, self).__init__(**kwargs) + self.time_grain = time_grain + self.retention = retention + + +class MetricDefinition(Model): + """Metric definition class specifies the metadata for a metric. + + :param is_dimension_required: Flag to indicate whether the dimension is + required. + :type is_dimension_required: bool + :param resource_id: the resource identifier of the resource that emitted + the metric. + :type resource_id: str + :param name: the name and the display name of the metric, i.e. it is a + localizable string. + :type name: + ~azure.mgmt.monitor.v2017_05_01_preview.models.LocalizableString + :param unit: the unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', + 'MilliSeconds', 'ByteSeconds', 'Unspecified' + :type unit: str or ~azure.mgmt.monitor.v2017_05_01_preview.models.Unit + :param primary_aggregation_type: the primary aggregation type value + defining how to use the values for display. Possible values include: + 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' + :type primary_aggregation_type: str or + ~azure.mgmt.monitor.v2017_05_01_preview.models.AggregationType + :param metric_availabilities: the collection of what aggregation intervals + are available to be queried. + :type metric_availabilities: + list[~azure.mgmt.monitor.v2017_05_01_preview.models.MetricAvailability] + :param id: the resource identifier of the metric definition. + :type id: str + :param dimensions: the name and the display name of the dimension, i.e. it + is a localizable string. + :type dimensions: + list[~azure.mgmt.monitor.v2017_05_01_preview.models.LocalizableString] + """ + + _attribute_map = { + 'is_dimension_required': {'key': 'isDimensionRequired', 'type': 'bool'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'unit': {'key': 'unit', 'type': 'Unit'}, + 'primary_aggregation_type': {'key': 'primaryAggregationType', 'type': 'AggregationType'}, + 'metric_availabilities': {'key': 'metricAvailabilities', 'type': '[MetricAvailability]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[LocalizableString]'}, + } + + def __init__(self, *, is_dimension_required: bool=None, resource_id: str=None, name=None, unit=None, primary_aggregation_type=None, metric_availabilities=None, id: str=None, dimensions=None, **kwargs) -> None: + super(MetricDefinition, self).__init__(**kwargs) + self.is_dimension_required = is_dimension_required + self.resource_id = resource_id + self.name = name + self.unit = unit + self.primary_aggregation_type = primary_aggregation_type + self.metric_availabilities = metric_availabilities + self.id = id + self.dimensions = dimensions + + +class MetricSettings(Model): + """Part of MultiTenantDiagnosticSettings. Specifies the settings for a + particular metric. + + All required parameters must be populated in order to send to Azure. + + :param time_grain: the timegrain of the metric in ISO8601 format. + :type time_grain: timedelta + :param category: Name of a Diagnostic Metric category for a resource type + this setting is applied to. To obtain the list of Diagnostic metric + categories for a resource, first perform a GET diagnostic settings + operation. + :type category: str + :param enabled: Required. a value indicating whether this category is + enabled. + :type enabled: bool + :param retention_policy: the retention policy for this category. + :type retention_policy: + ~azure.mgmt.monitor.v2017_05_01_preview.models.RetentionPolicy + """ + + _validation = { + 'enabled': {'required': True}, + } + + _attribute_map = { + 'time_grain': {'key': 'timeGrain', 'type': 'duration'}, + 'category': {'key': 'category', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + } + + def __init__(self, *, enabled: bool, time_grain=None, category: str=None, retention_policy=None, **kwargs) -> None: + super(MetricSettings, self).__init__(**kwargs) + self.time_grain = time_grain + self.category = category + self.enabled = enabled + self.retention_policy = retention_policy + + +class MetricValue(Model): + """Represents a metric value. + + All required parameters must be populated in order to send to Azure. + + :param time_stamp: Required. the timestamp for the metric value in ISO + 8601 format. + :type time_stamp: datetime + :param average: the average value in the time range. + :type average: float + :param minimum: the least value in the time range. + :type minimum: float + :param maximum: the greatest value in the time range. + :type maximum: float + :param total: the sum of all of the values in the time range. + :type total: float + :param count: the number of samples in the time range. Can be used to + determine the number of values that contributed to the average value. + :type count: long + """ + + _validation = { + 'time_stamp': {'required': True}, + } + + _attribute_map = { + 'time_stamp': {'key': 'timeStamp', 'type': 'iso-8601'}, + 'average': {'key': 'average', 'type': 'float'}, + 'minimum': {'key': 'minimum', 'type': 'float'}, + 'maximum': {'key': 'maximum', 'type': 'float'}, + 'total': {'key': 'total', 'type': 'float'}, + 'count': {'key': 'count', 'type': 'long'}, + } + + def __init__(self, *, time_stamp, average: float=None, minimum: float=None, maximum: float=None, total: float=None, count: int=None, **kwargs) -> None: + super(MetricValue, self).__init__(**kwargs) + self.time_stamp = time_stamp + self.average = average + self.minimum = minimum + self.maximum = maximum + self.total = total + self.count = count + + +class Response(Model): + """The response to a metrics query. + + All required parameters must be populated in order to send to Azure. + + :param cost: The integer value representing the cost of the query, for + data case. + :type cost: float + :param timespan: Required. The timespan for which the data was retrieved. + Its value consists of two datetimes concatenated, separated by '/'. This + may be adjusted in the future and returned back from what was originally + requested. + :type timespan: str + :param interval: The interval (window size) for which the metric data was + returned in. This may be adjusted in the future and returned back from + what was originally requested. This is not present if a metadata request + was made. + :type interval: timedelta + :param value: Required. the value of the collection. + :type value: list[~azure.mgmt.monitor.v2017_05_01_preview.models.Metric] + """ + + _validation = { + 'cost': {'minimum': 0}, + 'timespan': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'cost': {'key': 'cost', 'type': 'float'}, + 'timespan': {'key': 'timespan', 'type': 'str'}, + 'interval': {'key': 'interval', 'type': 'duration'}, + 'value': {'key': 'value', 'type': '[Metric]'}, + } + + def __init__(self, *, timespan: str, value, cost: float=None, interval=None, **kwargs) -> None: + super(Response, self).__init__(**kwargs) + self.cost = cost + self.timespan = timespan + self.interval = interval + self.value = value + + +class RetentionPolicy(Model): + """Specifies the retention policy for the log. + + All required parameters must be populated in order to send to Azure. + + :param enabled: Required. a value indicating whether the retention policy + is enabled. + :type enabled: bool + :param days: Required. the number of days for the retention in days. A + value of 0 will retain the events indefinitely. + :type days: int + """ + + _validation = { + 'enabled': {'required': True}, + 'days': {'required': True, 'minimum': 0}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'days': {'key': 'days', 'type': 'int'}, + } + + def __init__(self, *, enabled: bool, days: int, **kwargs) -> None: + super(RetentionPolicy, self).__init__(**kwargs) + self.enabled = enabled + self.days = days + + +class TimeSeriesElement(Model): + """A time series result type. The discriminator value is always TimeSeries in + this case. + + :param metadatavalues: the metadata values returned if $filter was + specified in the call. + :type metadatavalues: + list[~azure.mgmt.monitor.v2017_05_01_preview.models.MetadataValue] + :param data: An array of data points representing the metric values. This + is only returned if a result type of data is specified. + :type data: + list[~azure.mgmt.monitor.v2017_05_01_preview.models.MetricValue] + """ + + _attribute_map = { + 'metadatavalues': {'key': 'metadatavalues', 'type': '[MetadataValue]'}, + 'data': {'key': 'data', 'type': '[MetricValue]'}, + } + + def __init__(self, *, metadatavalues=None, data=None, **kwargs) -> None: + super(TimeSeriesElement, self).__init__(**kwargs) + self.metadatavalues = metadatavalues + self.data = data diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_monitor_management_client_enums.py new file mode 100644 index 000000000000..326125fa9335 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_monitor_management_client_enums.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 enum import Enum + + +class CategoryType(str, Enum): + + metrics = "Metrics" + logs = "Logs" + + +class Unit(str, Enum): + + count = "Count" + bytes = "Bytes" + seconds = "Seconds" + count_per_second = "CountPerSecond" + bytes_per_second = "BytesPerSecond" + percent = "Percent" + milli_seconds = "MilliSeconds" + byte_seconds = "ByteSeconds" + unspecified = "Unspecified" + + +class AggregationType(str, Enum): + + none = "None" + average = "Average" + count = "Count" + minimum = "Minimum" + maximum = "Maximum" + total = "Total" + + +class ResultType(str, Enum): + + data = "Data" + metadata = "Metadata" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_paged_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_paged_models.py new file mode 100644 index 000000000000..3a5cf54038bf --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_paged_models.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class MetricDefinitionPaged(Paged): + """ + A paging container for iterating over a list of :class:`MetricDefinition ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[MetricDefinition]'} + } + + def __init__(self, *args, **kwargs): + + super(MetricDefinitionPaged, self).__init__(*args, **kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/__init__.py new file mode 100644 index 000000000000..0f0941fad399 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._diagnostic_settings_category_operations import DiagnosticSettingsCategoryOperations +from ._diagnostic_settings_operations import DiagnosticSettingsOperations +from ._metric_definitions_operations import MetricDefinitionsOperations +from ._metrics_operations import MetricsOperations + +__all__ = [ + 'DiagnosticSettingsCategoryOperations', + 'DiagnosticSettingsOperations', + 'MetricDefinitionsOperations', + 'MetricsOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_diagnostic_settings_category_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_diagnostic_settings_category_operations.py new file mode 100644 index 000000000000..0fe0c114442e --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_diagnostic_settings_category_operations.py @@ -0,0 +1,158 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class DiagnosticSettingsCategoryOperations(object): + """DiagnosticSettingsCategoryOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2017-05-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-05-01-preview" + + self.config = config + + def get( + self, resource_uri, name, custom_headers=None, raw=False, **operation_config): + """Gets the diagnostic settings category for the specified resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param name: The name of the diagnostic setting. + :type name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DiagnosticSettingsCategoryResource or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.monitor.v2017_05_01_preview.models.DiagnosticSettingsCategoryResource + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DiagnosticSettingsCategoryResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories/{name}'} + + def list( + self, resource_uri, custom_headers=None, raw=False, **operation_config): + """Lists the diagnostic settings categories for the specified resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DiagnosticSettingsCategoryResourceCollection or + ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.monitor.v2017_05_01_preview.models.DiagnosticSettingsCategoryResourceCollection + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DiagnosticSettingsCategoryResourceCollection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_diagnostic_settings_operations.py new file mode 100644 index 000000000000..2fc5496f9b5e --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_diagnostic_settings_operations.py @@ -0,0 +1,275 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class DiagnosticSettingsOperations(object): + """DiagnosticSettingsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2017-05-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-05-01-preview" + + self.config = config + + def get( + self, resource_uri, name, custom_headers=None, raw=False, **operation_config): + """Gets the active diagnostic settings for the specified resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param name: The name of the diagnostic setting. + :type name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DiagnosticSettingsResource or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.monitor.v2017_05_01_preview.models.DiagnosticSettingsResource + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DiagnosticSettingsResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}'} + + def create_or_update( + self, resource_uri, parameters, name, custom_headers=None, raw=False, **operation_config): + """Creates or updates diagnostic settings for the specified resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param parameters: Parameters supplied to the operation. + :type parameters: + ~azure.mgmt.monitor.v2017_05_01_preview.models.DiagnosticSettingsResource + :param name: The name of the diagnostic setting. + :type name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DiagnosticSettingsResource or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.monitor.v2017_05_01_preview.models.DiagnosticSettingsResource + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'DiagnosticSettingsResource') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DiagnosticSettingsResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}'} + + def delete( + self, resource_uri, name, custom_headers=None, raw=False, **operation_config): + """Deletes existing diagnostic settings for the specified resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param name: The name of the diagnostic setting. + :type name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}'} + + def list( + self, resource_uri, custom_headers=None, raw=False, **operation_config): + """Gets the active diagnostic settings list for the specified resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DiagnosticSettingsResourceCollection or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.monitor.v2017_05_01_preview.models.DiagnosticSettingsResourceCollection + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DiagnosticSettingsResourceCollection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettings'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_metric_definitions_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_metric_definitions_operations.py new file mode 100644 index 000000000000..25515550257c --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_metric_definitions_operations.py @@ -0,0 +1,106 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class MetricDefinitionsOperations(object): + """MetricDefinitionsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2017-05-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-05-01-preview" + + self.config = config + + def list( + self, resource_uri, custom_headers=None, raw=False, **operation_config): + """Lists the metric definitions for the resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of MetricDefinition + :rtype: + ~azure.mgmt.monitor.v2017_05_01_preview.models.MetricDefinitionPaged[~azure.mgmt.monitor.v2017_05_01_preview.models.MetricDefinition] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metricDefinitions'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_metrics_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_metrics_operations.py new file mode 100644 index 000000000000..b6a1e53836ab --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_metrics_operations.py @@ -0,0 +1,146 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class MetricsOperations(object): + """MetricsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2017-05-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-05-01-preview" + + self.config = config + + def list( + self, resource_uri, timespan=None, interval=None, metric=None, aggregation=None, top=None, orderby=None, filter=None, result_type=None, custom_headers=None, raw=False, **operation_config): + """**Lists the metric values for a resource**. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param timespan: The timespan of the query. It is a string with the + following format 'startDateTime_ISO/endDateTime_ISO'. + :type timespan: str + :param interval: The interval (i.e. timegrain) of the query. + :type interval: timedelta + :param metric: The name of the metric to retrieve. + :type metric: str + :param aggregation: The list of aggregation types (comma separated) to + retrieve. + :type aggregation: str + :param top: The maximum number of records to retrieve. + Valid only if $filter is specified. + Defaults to 10. + :type top: float + :param orderby: The aggregation to use for sorting results and the + direction of the sort. + Only one order can be specified. + Examples: sum asc. + :type orderby: str + :param filter: The **$filter** is used to reduce the set of metric + data returned.
Example:
Metric contains metadata A, B and + C.
- Return all time series of C where A = a1 and B = b1 or + b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq + ‘*’**
- Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C + eq ‘*’ or B = ‘b2’**
This is invalid because the logical or + operator cannot separate two different metadata names.
- Return all + time series where A = a1, B = b1 and C = c1:
**$filter=A eq ‘a1’ + and B eq ‘b1’ and C eq ‘c1’**
- Return all time series where A = + a1
**$filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**. + :type filter: str + :param result_type: Reduces the set of data collected. The syntax + allowed depends on the operation. See the operation's description for + details. Possible values include: 'Data', 'Metadata' + :type result_type: str or + ~azure.mgmt.monitor.v2017_05_01_preview.models.ResultType + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Response or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2017_05_01_preview.models.Response or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if timespan is not None: + query_parameters['timespan'] = self._serialize.query("timespan", timespan, 'str') + if interval is not None: + query_parameters['interval'] = self._serialize.query("interval", interval, 'duration') + if metric is not None: + query_parameters['metric'] = self._serialize.query("metric", metric, 'str') + if aggregation is not None: + query_parameters['aggregation'] = self._serialize.query("aggregation", aggregation, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'float') + if orderby is not None: + query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if result_type is not None: + query_parameters['resultType'] = self._serialize.query("result_type", result_type, 'ResultType') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Response', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metrics'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/version.py new file mode 100644 index 000000000000..745aab5cf9f1 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2017-05-01-preview" + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/__init__.py new file mode 100644 index 000000000000..8e97360e5ffb --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._configuration import MonitorManagementClientConfiguration +from ._monitor_management_client import MonitorManagementClient +__all__ = ['MonitorManagementClient', 'MonitorManagementClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_configuration.py new file mode 100644 index 000000000000..9b4e1e19d961 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_configuration.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +from msrestazure import AzureConfiguration + +from .version import VERSION + + +class MonitorManagementClientConfiguration(AzureConfiguration): + """Configuration for MonitorManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param str base_url: Service URL + """ + + def __init__( + self, credentials, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(MonitorManagementClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-monitor/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_monitor_management_client.py new file mode 100644 index 000000000000..aba71bb8fa93 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_monitor_management_client.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 msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import MonitorManagementClientConfiguration +from .operations import MetricBaselineOperations +from . import models + + +class MonitorManagementClient(SDKClient): + """Monitor Management Client + + :ivar config: Configuration for client. + :vartype config: MonitorManagementClientConfiguration + + :ivar metric_baseline: MetricBaseline operations + :vartype metric_baseline: azure.mgmt.monitor.v2017_11_01_preview.operations.MetricBaselineOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param str base_url: Service URL + """ + + def __init__( + self, credentials, base_url=None): + + self.config = MonitorManagementClientConfiguration(credentials, base_url) + super(MonitorManagementClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2017-11-01-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.metric_baseline = MetricBaselineOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/__init__.py new file mode 100644 index 000000000000..7e9e81063208 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/__init__.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import Baseline + from ._models_py3 import BaselineMetadataValue + from ._models_py3 import BaselineResponse + from ._models_py3 import CalculateBaselineResponse + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import LocalizableString + from ._models_py3 import TimeSeriesInformation +except (SyntaxError, ImportError): + from ._models import Baseline + from ._models import BaselineMetadataValue + from ._models import BaselineResponse + from ._models import CalculateBaselineResponse + from ._models import ErrorResponse, ErrorResponseException + from ._models import LocalizableString + from ._models import TimeSeriesInformation +from ._monitor_management_client_enums import ( + Sensitivity, + ResultType, +) + +__all__ = [ + 'Baseline', + 'BaselineMetadataValue', + 'BaselineResponse', + 'CalculateBaselineResponse', + 'ErrorResponse', 'ErrorResponseException', + 'LocalizableString', + 'TimeSeriesInformation', + 'Sensitivity', + 'ResultType', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_models.py new file mode 100644 index 000000000000..545374259225 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_models.py @@ -0,0 +1,265 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class Baseline(Model): + """The baseline values for a single sensitivity value. + + All required parameters must be populated in order to send to Azure. + + :param sensitivity: Required. the sensitivity of the baseline. Possible + values include: 'Low', 'Medium', 'High' + :type sensitivity: str or + ~azure.mgmt.monitor.v2017_11_01_preview.models.Sensitivity + :param low_thresholds: Required. The low thresholds of the baseline. + :type low_thresholds: list[float] + :param high_thresholds: Required. The high thresholds of the baseline. + :type high_thresholds: list[float] + """ + + _validation = { + 'sensitivity': {'required': True}, + 'low_thresholds': {'required': True}, + 'high_thresholds': {'required': True}, + } + + _attribute_map = { + 'sensitivity': {'key': 'sensitivity', 'type': 'Sensitivity'}, + 'low_thresholds': {'key': 'lowThresholds', 'type': '[float]'}, + 'high_thresholds': {'key': 'highThresholds', 'type': '[float]'}, + } + + def __init__(self, **kwargs): + super(Baseline, self).__init__(**kwargs) + self.sensitivity = kwargs.get('sensitivity', None) + self.low_thresholds = kwargs.get('low_thresholds', None) + self.high_thresholds = kwargs.get('high_thresholds', None) + + +class BaselineMetadataValue(Model): + """Represents a baseline metadata value. + + :param name: the name of the metadata. + :type name: + ~azure.mgmt.monitor.v2017_11_01_preview.models.LocalizableString + :param value: the value of the metadata. + :type value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(BaselineMetadataValue, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.value = kwargs.get('value', None) + + +class BaselineResponse(Model): + """The response to a baseline query. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: the metric baseline Id. + :vartype id: str + :ivar type: the resource type of the baseline resource. + :vartype type: str + :ivar name: the name and the display name of the metric, i.e. it is + localizable string. + :vartype name: + ~azure.mgmt.monitor.v2017_11_01_preview.models.LocalizableString + :param timespan: The timespan for which the data was retrieved. Its value + consists of two datetimes concatenated, separated by '/'. This may be + adjusted in the future and returned back from what was originally + requested. + :type timespan: str + :param interval: The interval (window size) for which the metric data was + returned in. This may be adjusted in the future and returned back from + what was originally requested. This is not present if a metadata request + was made. + :type interval: timedelta + :param aggregation: The aggregation type of the metric. + :type aggregation: str + :param timestamps: the array of timestamps of the baselines. + :type timestamps: list[datetime] + :param baseline: the baseline values for each sensitivity. + :type baseline: + list[~azure.mgmt.monitor.v2017_11_01_preview.models.Baseline] + :param metadata: the baseline metadata values. + :type metadata: + list[~azure.mgmt.monitor.v2017_11_01_preview.models.BaselineMetadataValue] + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'timespan': {'key': 'properties.timespan', 'type': 'str'}, + 'interval': {'key': 'properties.interval', 'type': 'duration'}, + 'aggregation': {'key': 'properties.aggregation', 'type': 'str'}, + 'timestamps': {'key': 'properties.timestamps', 'type': '[iso-8601]'}, + 'baseline': {'key': 'properties.baseline', 'type': '[Baseline]'}, + 'metadata': {'key': 'properties.metadata', 'type': '[BaselineMetadataValue]'}, + } + + def __init__(self, **kwargs): + super(BaselineResponse, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.timespan = kwargs.get('timespan', None) + self.interval = kwargs.get('interval', None) + self.aggregation = kwargs.get('aggregation', None) + self.timestamps = kwargs.get('timestamps', None) + self.baseline = kwargs.get('baseline', None) + self.metadata = kwargs.get('metadata', None) + + +class CalculateBaselineResponse(Model): + """The response to a calculate baseline call. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. the resource type of the baseline resource. + :type type: str + :param timestamps: the array of timestamps of the baselines. + :type timestamps: list[datetime] + :param baseline: Required. the baseline values for each sensitivity. + :type baseline: + list[~azure.mgmt.monitor.v2017_11_01_preview.models.Baseline] + """ + + _validation = { + 'type': {'required': True}, + 'baseline': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, + 'baseline': {'key': 'baseline', 'type': '[Baseline]'}, + } + + def __init__(self, **kwargs): + super(CalculateBaselineResponse, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.timestamps = kwargs.get('timestamps', None) + self.baseline = kwargs.get('baseline', None) + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class LocalizableString(Model): + """The localizable string class. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. the invariant value. + :type value: str + :param localized_value: the locale specific value. + :type localized_value: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(LocalizableString, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.localized_value = kwargs.get('localized_value', None) + + +class TimeSeriesInformation(Model): + """The time series info needed for calculating the baseline. + + All required parameters must be populated in order to send to Azure. + + :param sensitivities: Required. the list of sensitivities for calculating + the baseline. + :type sensitivities: list[str] + :param values: Required. The metric values to calculate the baseline. + :type values: list[float] + :param timestamps: the array of timestamps of the baselines. + :type timestamps: list[datetime] + """ + + _validation = { + 'sensitivities': {'required': True}, + 'values': {'required': True}, + } + + _attribute_map = { + 'sensitivities': {'key': 'sensitivities', 'type': '[str]'}, + 'values': {'key': 'values', 'type': '[float]'}, + 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, + } + + def __init__(self, **kwargs): + super(TimeSeriesInformation, self).__init__(**kwargs) + self.sensitivities = kwargs.get('sensitivities', None) + self.values = kwargs.get('values', None) + self.timestamps = kwargs.get('timestamps', None) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_models_py3.py new file mode 100644 index 000000000000..0cb722871a11 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_models_py3.py @@ -0,0 +1,265 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class Baseline(Model): + """The baseline values for a single sensitivity value. + + All required parameters must be populated in order to send to Azure. + + :param sensitivity: Required. the sensitivity of the baseline. Possible + values include: 'Low', 'Medium', 'High' + :type sensitivity: str or + ~azure.mgmt.monitor.v2017_11_01_preview.models.Sensitivity + :param low_thresholds: Required. The low thresholds of the baseline. + :type low_thresholds: list[float] + :param high_thresholds: Required. The high thresholds of the baseline. + :type high_thresholds: list[float] + """ + + _validation = { + 'sensitivity': {'required': True}, + 'low_thresholds': {'required': True}, + 'high_thresholds': {'required': True}, + } + + _attribute_map = { + 'sensitivity': {'key': 'sensitivity', 'type': 'Sensitivity'}, + 'low_thresholds': {'key': 'lowThresholds', 'type': '[float]'}, + 'high_thresholds': {'key': 'highThresholds', 'type': '[float]'}, + } + + def __init__(self, *, sensitivity, low_thresholds, high_thresholds, **kwargs) -> None: + super(Baseline, self).__init__(**kwargs) + self.sensitivity = sensitivity + self.low_thresholds = low_thresholds + self.high_thresholds = high_thresholds + + +class BaselineMetadataValue(Model): + """Represents a baseline metadata value. + + :param name: the name of the metadata. + :type name: + ~azure.mgmt.monitor.v2017_11_01_preview.models.LocalizableString + :param value: the value of the metadata. + :type value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, *, name=None, value: str=None, **kwargs) -> None: + super(BaselineMetadataValue, self).__init__(**kwargs) + self.name = name + self.value = value + + +class BaselineResponse(Model): + """The response to a baseline query. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: the metric baseline Id. + :vartype id: str + :ivar type: the resource type of the baseline resource. + :vartype type: str + :ivar name: the name and the display name of the metric, i.e. it is + localizable string. + :vartype name: + ~azure.mgmt.monitor.v2017_11_01_preview.models.LocalizableString + :param timespan: The timespan for which the data was retrieved. Its value + consists of two datetimes concatenated, separated by '/'. This may be + adjusted in the future and returned back from what was originally + requested. + :type timespan: str + :param interval: The interval (window size) for which the metric data was + returned in. This may be adjusted in the future and returned back from + what was originally requested. This is not present if a metadata request + was made. + :type interval: timedelta + :param aggregation: The aggregation type of the metric. + :type aggregation: str + :param timestamps: the array of timestamps of the baselines. + :type timestamps: list[datetime] + :param baseline: the baseline values for each sensitivity. + :type baseline: + list[~azure.mgmt.monitor.v2017_11_01_preview.models.Baseline] + :param metadata: the baseline metadata values. + :type metadata: + list[~azure.mgmt.monitor.v2017_11_01_preview.models.BaselineMetadataValue] + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'timespan': {'key': 'properties.timespan', 'type': 'str'}, + 'interval': {'key': 'properties.interval', 'type': 'duration'}, + 'aggregation': {'key': 'properties.aggregation', 'type': 'str'}, + 'timestamps': {'key': 'properties.timestamps', 'type': '[iso-8601]'}, + 'baseline': {'key': 'properties.baseline', 'type': '[Baseline]'}, + 'metadata': {'key': 'properties.metadata', 'type': '[BaselineMetadataValue]'}, + } + + def __init__(self, *, timespan: str=None, interval=None, aggregation: str=None, timestamps=None, baseline=None, metadata=None, **kwargs) -> None: + super(BaselineResponse, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.timespan = timespan + self.interval = interval + self.aggregation = aggregation + self.timestamps = timestamps + self.baseline = baseline + self.metadata = metadata + + +class CalculateBaselineResponse(Model): + """The response to a calculate baseline call. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. the resource type of the baseline resource. + :type type: str + :param timestamps: the array of timestamps of the baselines. + :type timestamps: list[datetime] + :param baseline: Required. the baseline values for each sensitivity. + :type baseline: + list[~azure.mgmt.monitor.v2017_11_01_preview.models.Baseline] + """ + + _validation = { + 'type': {'required': True}, + 'baseline': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, + 'baseline': {'key': 'baseline', 'type': '[Baseline]'}, + } + + def __init__(self, *, type: str, baseline, timestamps=None, **kwargs) -> None: + super(CalculateBaselineResponse, self).__init__(**kwargs) + self.type = type + self.timestamps = timestamps + self.baseline = baseline + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class LocalizableString(Model): + """The localizable string class. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. the invariant value. + :type value: str + :param localized_value: the locale specific value. + :type localized_value: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__(self, *, value: str, localized_value: str=None, **kwargs) -> None: + super(LocalizableString, self).__init__(**kwargs) + self.value = value + self.localized_value = localized_value + + +class TimeSeriesInformation(Model): + """The time series info needed for calculating the baseline. + + All required parameters must be populated in order to send to Azure. + + :param sensitivities: Required. the list of sensitivities for calculating + the baseline. + :type sensitivities: list[str] + :param values: Required. The metric values to calculate the baseline. + :type values: list[float] + :param timestamps: the array of timestamps of the baselines. + :type timestamps: list[datetime] + """ + + _validation = { + 'sensitivities': {'required': True}, + 'values': {'required': True}, + } + + _attribute_map = { + 'sensitivities': {'key': 'sensitivities', 'type': '[str]'}, + 'values': {'key': 'values', 'type': '[float]'}, + 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, + } + + def __init__(self, *, sensitivities, values, timestamps=None, **kwargs) -> None: + super(TimeSeriesInformation, self).__init__(**kwargs) + self.sensitivities = sensitivities + self.values = values + self.timestamps = timestamps diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_monitor_management_client_enums.py new file mode 100644 index 000000000000..d8ef46ea0c5c --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_monitor_management_client_enums.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum + + +class Sensitivity(str, Enum): + + low = "Low" + medium = "Medium" + high = "High" + + +class ResultType(str, Enum): + + data = "Data" + metadata = "Metadata" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/operations/__init__.py new file mode 100644 index 000000000000..ac12083cd891 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/operations/__init__.py @@ -0,0 +1,16 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._metric_baseline_operations import MetricBaselineOperations + +__all__ = [ + 'MetricBaselineOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/operations/_metric_baseline_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/operations/_metric_baseline_operations.py new file mode 100644 index 000000000000..8c7b0516c620 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/operations/_metric_baseline_operations.py @@ -0,0 +1,199 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class MetricBaselineOperations(object): + """MetricBaselineOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2017-11-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-11-01-preview" + + self.config = config + + def get( + self, resource_uri, metric_name, timespan=None, interval=None, aggregation=None, sensitivities=None, result_type=None, custom_headers=None, raw=False, **operation_config): + """**Gets the baseline values for a specific metric**. + + :param resource_uri: The identifier of the resource. It has the + following structure: + subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. + For example: + subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + :type resource_uri: str + :param metric_name: The name of the metric to retrieve the baseline + for. + :type metric_name: str + :param timespan: The timespan of the query. It is a string with the + following format 'startDateTime_ISO/endDateTime_ISO'. + :type timespan: str + :param interval: The interval (i.e. timegrain) of the query. + :type interval: timedelta + :param aggregation: The aggregation type of the metric to retrieve the + baseline for. + :type aggregation: str + :param sensitivities: The list of sensitivities (comma separated) to + retrieve. + :type sensitivities: str + :param result_type: Allows retrieving only metadata of the baseline. + On data request all information is retrieved. Possible values include: + 'Data', 'Metadata' + :type result_type: str or + ~azure.mgmt.monitor.v2017_11_01_preview.models.ResultType + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: BaselineResponse or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.monitor.v2017_11_01_preview.models.BaselineResponse or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), + 'metricName': self._serialize.url("metric_name", metric_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if timespan is not None: + query_parameters['timespan'] = self._serialize.query("timespan", timespan, 'str') + if interval is not None: + query_parameters['interval'] = self._serialize.query("interval", interval, 'duration') + if aggregation is not None: + query_parameters['aggregation'] = self._serialize.query("aggregation", aggregation, 'str') + if sensitivities is not None: + query_parameters['sensitivities'] = self._serialize.query("sensitivities", sensitivities, 'str') + if result_type is not None: + query_parameters['resultType'] = self._serialize.query("result_type", result_type, 'ResultType') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('BaselineResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/baseline/{metricName}'} + + def calculate_baseline( + self, resource_uri, time_series_information, custom_headers=None, raw=False, **operation_config): + """**Lists the baseline values for a resource**. + + :param resource_uri: The identifier of the resource. It has the + following structure: + subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. + For example: + subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + :type resource_uri: str + :param time_series_information: Information that need to be specified + to calculate a baseline on a time series. + :type time_series_information: + ~azure.mgmt.monitor.v2017_11_01_preview.models.TimeSeriesInformation + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: CalculateBaselineResponse or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.monitor.v2017_11_01_preview.models.CalculateBaselineResponse + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.calculate_baseline.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(time_series_information, 'TimeSeriesInformation') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CalculateBaselineResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + calculate_baseline.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/calculatebaseline'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/version.py new file mode 100644 index 000000000000..2e47e927c208 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2017-11-01-preview" + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/__init__.py new file mode 100644 index 000000000000..8e97360e5ffb --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._configuration import MonitorManagementClientConfiguration +from ._monitor_management_client import MonitorManagementClient +__all__ = ['MonitorManagementClient', 'MonitorManagementClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_configuration.py new file mode 100644 index 000000000000..9b4e1e19d961 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_configuration.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +from msrestazure import AzureConfiguration + +from .version import VERSION + + +class MonitorManagementClientConfiguration(AzureConfiguration): + """Configuration for MonitorManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param str base_url: Service URL + """ + + def __init__( + self, credentials, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(MonitorManagementClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-monitor/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_monitor_management_client.py new file mode 100644 index 000000000000..93cfc6d5bbc6 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_monitor_management_client.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 msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import MonitorManagementClientConfiguration +from .operations import MetricNamespacesOperations +from . import models + + +class MonitorManagementClient(SDKClient): + """Monitor Management Client + + :ivar config: Configuration for client. + :vartype config: MonitorManagementClientConfiguration + + :ivar metric_namespaces: MetricNamespaces operations + :vartype metric_namespaces: azure.mgmt.monitor.v2017_12_01_preview.operations.MetricNamespacesOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param str base_url: Service URL + """ + + def __init__( + self, credentials, base_url=None): + + self.config = MonitorManagementClientConfiguration(credentials, base_url) + super(MonitorManagementClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2017-12-01-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.metric_namespaces = MetricNamespacesOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/__init__.py new file mode 100644 index 000000000000..3976b3b47e85 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/__init__.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import MetricNamespace + from ._models_py3 import MetricNamespaceName +except (SyntaxError, ImportError): + from ._models import ErrorResponse, ErrorResponseException + from ._models import MetricNamespace + from ._models import MetricNamespaceName +from ._paged_models import MetricNamespacePaged + +__all__ = [ + 'ErrorResponse', 'ErrorResponseException', + 'MetricNamespace', + 'MetricNamespaceName', + 'MetricNamespacePaged', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/_models.py new file mode 100644 index 000000000000..aa8bcd526af1 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/_models.py @@ -0,0 +1,99 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class MetricNamespace(Model): + """Metric namespace class specifies the metadata for a metric namespace. + + :param id: The ID of the metricNamespace. + :type id: str + :param type: The type of the namespace. + :type type: str + :param name: The name of the namespace. + :type name: str + :param properties: Properties which include the fully qualified namespace + name. + :type properties: + ~azure.mgmt.monitor.v2017_12_01_preview.models.MetricNamespaceName + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'MetricNamespaceName'}, + } + + def __init__(self, **kwargs): + super(MetricNamespace, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.type = kwargs.get('type', None) + self.name = kwargs.get('name', None) + self.properties = kwargs.get('properties', None) + + +class MetricNamespaceName(Model): + """The fully qualified metric namespace name. + + :param metric_namespace_name: The metric namespace name. + :type metric_namespace_name: str + """ + + _attribute_map = { + 'metric_namespace_name': {'key': 'metricNamespaceName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MetricNamespaceName, self).__init__(**kwargs) + self.metric_namespace_name = kwargs.get('metric_namespace_name', None) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/_models_py3.py new file mode 100644 index 000000000000..8a0b5b6b2e16 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/_models_py3.py @@ -0,0 +1,99 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class MetricNamespace(Model): + """Metric namespace class specifies the metadata for a metric namespace. + + :param id: The ID of the metricNamespace. + :type id: str + :param type: The type of the namespace. + :type type: str + :param name: The name of the namespace. + :type name: str + :param properties: Properties which include the fully qualified namespace + name. + :type properties: + ~azure.mgmt.monitor.v2017_12_01_preview.models.MetricNamespaceName + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'MetricNamespaceName'}, + } + + def __init__(self, *, id: str=None, type: str=None, name: str=None, properties=None, **kwargs) -> None: + super(MetricNamespace, self).__init__(**kwargs) + self.id = id + self.type = type + self.name = name + self.properties = properties + + +class MetricNamespaceName(Model): + """The fully qualified metric namespace name. + + :param metric_namespace_name: The metric namespace name. + :type metric_namespace_name: str + """ + + _attribute_map = { + 'metric_namespace_name': {'key': 'metricNamespaceName', 'type': 'str'}, + } + + def __init__(self, *, metric_namespace_name: str=None, **kwargs) -> None: + super(MetricNamespaceName, self).__init__(**kwargs) + self.metric_namespace_name = metric_namespace_name diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/_paged_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/_paged_models.py new file mode 100644 index 000000000000..c61b630b70f6 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/_paged_models.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class MetricNamespacePaged(Paged): + """ + A paging container for iterating over a list of :class:`MetricNamespace ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[MetricNamespace]'} + } + + def __init__(self, *args, **kwargs): + + super(MetricNamespacePaged, self).__init__(*args, **kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/operations/__init__.py new file mode 100644 index 000000000000..c30fbfbc9f5c --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/operations/__init__.py @@ -0,0 +1,16 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._metric_namespaces_operations import MetricNamespacesOperations + +__all__ = [ + 'MetricNamespacesOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/operations/_metric_namespaces_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/operations/_metric_namespaces_operations.py new file mode 100644 index 000000000000..a9be4e117ab3 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/operations/_metric_namespaces_operations.py @@ -0,0 +1,111 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class MetricNamespacesOperations(object): + """MetricNamespacesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2017-12-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-12-01-preview" + + self.config = config + + def list( + self, resource_uri, start_time=None, custom_headers=None, raw=False, **operation_config): + """Lists the metric namespaces for the resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param start_time: The ISO 8601 conform Date start time from which to + query for metric namespaces. + :type start_time: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of MetricNamespace + :rtype: + ~azure.mgmt.monitor.v2017_12_01_preview.models.MetricNamespacePaged[~azure.mgmt.monitor.v2017_12_01_preview.models.MetricNamespace] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if start_time is not None: + query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricNamespacePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metricNamespaces'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/version.py new file mode 100644 index 000000000000..d2d4445f16cf --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2017-12-01-preview" + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/__init__.py new file mode 100644 index 000000000000..8e97360e5ffb --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._configuration import MonitorManagementClientConfiguration +from ._monitor_management_client import MonitorManagementClient +__all__ = ['MonitorManagementClient', 'MonitorManagementClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_configuration.py new file mode 100644 index 000000000000..9b4e1e19d961 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_configuration.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +from msrestazure import AzureConfiguration + +from .version import VERSION + + +class MonitorManagementClientConfiguration(AzureConfiguration): + """Configuration for MonitorManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param str base_url: Service URL + """ + + def __init__( + self, credentials, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(MonitorManagementClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-monitor/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_monitor_management_client.py new file mode 100644 index 000000000000..3f71ecf9ad04 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_monitor_management_client.py @@ -0,0 +1,52 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import MonitorManagementClientConfiguration +from .operations import MetricDefinitionsOperations +from .operations import MetricsOperations +from . import models + + +class MonitorManagementClient(SDKClient): + """Monitor Management Client + + :ivar config: Configuration for client. + :vartype config: MonitorManagementClientConfiguration + + :ivar metric_definitions: MetricDefinitions operations + :vartype metric_definitions: azure.mgmt.monitor.v2018_01_01.operations.MetricDefinitionsOperations + :ivar metrics: Metrics operations + :vartype metrics: azure.mgmt.monitor.v2018_01_01.operations.MetricsOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param str base_url: Service URL + """ + + def __init__( + self, credentials, base_url=None): + + self.config = MonitorManagementClientConfiguration(credentials, base_url) + super(MonitorManagementClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2018-01-01' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.metric_definitions = MetricDefinitionsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.metrics = MetricsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/__init__.py new file mode 100644 index 000000000000..3a11fb0034bb --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/__init__.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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import LocalizableString + from ._models_py3 import MetadataValue + from ._models_py3 import Metric + from ._models_py3 import MetricAvailability + from ._models_py3 import MetricDefinition + from ._models_py3 import MetricValue + from ._models_py3 import Response + from ._models_py3 import TimeSeriesElement +except (SyntaxError, ImportError): + from ._models import ErrorResponse, ErrorResponseException + from ._models import LocalizableString + from ._models import MetadataValue + from ._models import Metric + from ._models import MetricAvailability + from ._models import MetricDefinition + from ._models import MetricValue + from ._models import Response + from ._models import TimeSeriesElement +from ._paged_models import MetricDefinitionPaged +from ._monitor_management_client_enums import ( + Unit, + AggregationType, + ResultType, +) + +__all__ = [ + 'ErrorResponse', 'ErrorResponseException', + 'LocalizableString', + 'MetadataValue', + 'Metric', + 'MetricAvailability', + 'MetricDefinition', + 'MetricValue', + 'Response', + 'TimeSeriesElement', + 'MetricDefinitionPaged', + 'Unit', + 'AggregationType', + 'ResultType', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_models.py new file mode 100644 index 000000000000..645a3895d476 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_models.py @@ -0,0 +1,355 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class LocalizableString(Model): + """The localizable string class. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. the invariant value. + :type value: str + :param localized_value: the locale specific value. + :type localized_value: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(LocalizableString, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.localized_value = kwargs.get('localized_value', None) + + +class MetadataValue(Model): + """Represents a metric metadata value. + + :param name: the name of the metadata. + :type name: ~azure.mgmt.monitor.v2018_01_01.models.LocalizableString + :param value: the value of the metadata. + :type value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MetadataValue, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.value = kwargs.get('value', None) + + +class Metric(Model): + """The result data of a query. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. the metric Id. + :type id: str + :param type: Required. the resource type of the metric resource. + :type type: str + :param name: Required. the name and the display name of the metric, i.e. + it is localizable string. + :type name: ~azure.mgmt.monitor.v2018_01_01.models.LocalizableString + :param unit: Required. the unit of the metric. Possible values include: + 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', + 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified' + :type unit: str or ~azure.mgmt.monitor.v2018_01_01.models.Unit + :param timeseries: Required. the time series returned when a data query is + performed. + :type timeseries: + list[~azure.mgmt.monitor.v2018_01_01.models.TimeSeriesElement] + """ + + _validation = { + 'id': {'required': True}, + 'type': {'required': True}, + 'name': {'required': True}, + 'unit': {'required': True}, + 'timeseries': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'unit': {'key': 'unit', 'type': 'Unit'}, + 'timeseries': {'key': 'timeseries', 'type': '[TimeSeriesElement]'}, + } + + def __init__(self, **kwargs): + super(Metric, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.type = kwargs.get('type', None) + self.name = kwargs.get('name', None) + self.unit = kwargs.get('unit', None) + self.timeseries = kwargs.get('timeseries', None) + + +class MetricAvailability(Model): + """Metric availability specifies the time grain (aggregation interval or + frequency) and the retention period for that time grain. + + :param time_grain: the time grain specifies the aggregation interval for + the metric. Expressed as a duration 'PT1M', 'P1D', etc. + :type time_grain: timedelta + :param retention: the retention period for the metric at the specified + timegrain. Expressed as a duration 'PT1M', 'P1D', etc. + :type retention: timedelta + """ + + _attribute_map = { + 'time_grain': {'key': 'timeGrain', 'type': 'duration'}, + 'retention': {'key': 'retention', 'type': 'duration'}, + } + + def __init__(self, **kwargs): + super(MetricAvailability, self).__init__(**kwargs) + self.time_grain = kwargs.get('time_grain', None) + self.retention = kwargs.get('retention', None) + + +class MetricDefinition(Model): + """Metric definition class specifies the metadata for a metric. + + :param is_dimension_required: Flag to indicate whether the dimension is + required. + :type is_dimension_required: bool + :param resource_id: the resource identifier of the resource that emitted + the metric. + :type resource_id: str + :param namespace: the namespace the metric belongs to. + :type namespace: str + :param name: the name and the display name of the metric, i.e. it is a + localizable string. + :type name: ~azure.mgmt.monitor.v2018_01_01.models.LocalizableString + :param unit: the unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', + 'MilliSeconds', 'ByteSeconds', 'Unspecified' + :type unit: str or ~azure.mgmt.monitor.v2018_01_01.models.Unit + :param primary_aggregation_type: the primary aggregation type value + defining how to use the values for display. Possible values include: + 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' + :type primary_aggregation_type: str or + ~azure.mgmt.monitor.v2018_01_01.models.AggregationType + :param supported_aggregation_types: the collection of what aggregation + types are supported. + :type supported_aggregation_types: list[str or + ~azure.mgmt.monitor.v2018_01_01.models.AggregationType] + :param metric_availabilities: the collection of what aggregation intervals + are available to be queried. + :type metric_availabilities: + list[~azure.mgmt.monitor.v2018_01_01.models.MetricAvailability] + :param id: the resource identifier of the metric definition. + :type id: str + :param dimensions: the name and the display name of the dimension, i.e. it + is a localizable string. + :type dimensions: + list[~azure.mgmt.monitor.v2018_01_01.models.LocalizableString] + """ + + _attribute_map = { + 'is_dimension_required': {'key': 'isDimensionRequired', 'type': 'bool'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'namespace': {'key': 'namespace', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'unit': {'key': 'unit', 'type': 'Unit'}, + 'primary_aggregation_type': {'key': 'primaryAggregationType', 'type': 'AggregationType'}, + 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[AggregationType]'}, + 'metric_availabilities': {'key': 'metricAvailabilities', 'type': '[MetricAvailability]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[LocalizableString]'}, + } + + def __init__(self, **kwargs): + super(MetricDefinition, self).__init__(**kwargs) + self.is_dimension_required = kwargs.get('is_dimension_required', None) + self.resource_id = kwargs.get('resource_id', None) + self.namespace = kwargs.get('namespace', None) + self.name = kwargs.get('name', None) + self.unit = kwargs.get('unit', None) + self.primary_aggregation_type = kwargs.get('primary_aggregation_type', None) + self.supported_aggregation_types = kwargs.get('supported_aggregation_types', None) + self.metric_availabilities = kwargs.get('metric_availabilities', None) + self.id = kwargs.get('id', None) + self.dimensions = kwargs.get('dimensions', None) + + +class MetricValue(Model): + """Represents a metric value. + + All required parameters must be populated in order to send to Azure. + + :param time_stamp: Required. the timestamp for the metric value in ISO + 8601 format. + :type time_stamp: datetime + :param average: the average value in the time range. + :type average: float + :param minimum: the least value in the time range. + :type minimum: float + :param maximum: the greatest value in the time range. + :type maximum: float + :param total: the sum of all of the values in the time range. + :type total: float + :param count: the number of samples in the time range. Can be used to + determine the number of values that contributed to the average value. + :type count: long + """ + + _validation = { + 'time_stamp': {'required': True}, + } + + _attribute_map = { + 'time_stamp': {'key': 'timeStamp', 'type': 'iso-8601'}, + 'average': {'key': 'average', 'type': 'float'}, + 'minimum': {'key': 'minimum', 'type': 'float'}, + 'maximum': {'key': 'maximum', 'type': 'float'}, + 'total': {'key': 'total', 'type': 'float'}, + 'count': {'key': 'count', 'type': 'long'}, + } + + def __init__(self, **kwargs): + super(MetricValue, self).__init__(**kwargs) + self.time_stamp = kwargs.get('time_stamp', None) + self.average = kwargs.get('average', None) + self.minimum = kwargs.get('minimum', None) + self.maximum = kwargs.get('maximum', None) + self.total = kwargs.get('total', None) + self.count = kwargs.get('count', None) + + +class Response(Model): + """The response to a metrics query. + + All required parameters must be populated in order to send to Azure. + + :param cost: The integer value representing the cost of the query, for + data case. + :type cost: float + :param timespan: Required. The timespan for which the data was retrieved. + Its value consists of two datetimes concatenated, separated by '/'. This + may be adjusted in the future and returned back from what was originally + requested. + :type timespan: str + :param interval: The interval (window size) for which the metric data was + returned in. This may be adjusted in the future and returned back from + what was originally requested. This is not present if a metadata request + was made. + :type interval: timedelta + :param namespace: The namespace of the metrics been queried + :type namespace: str + :param resourceregion: The region of the resource been queried for + metrics. + :type resourceregion: str + :param value: Required. the value of the collection. + :type value: list[~azure.mgmt.monitor.v2018_01_01.models.Metric] + """ + + _validation = { + 'cost': {'minimum': 0}, + 'timespan': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'cost': {'key': 'cost', 'type': 'float'}, + 'timespan': {'key': 'timespan', 'type': 'str'}, + 'interval': {'key': 'interval', 'type': 'duration'}, + 'namespace': {'key': 'namespace', 'type': 'str'}, + 'resourceregion': {'key': 'resourceregion', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Metric]'}, + } + + def __init__(self, **kwargs): + super(Response, self).__init__(**kwargs) + self.cost = kwargs.get('cost', None) + self.timespan = kwargs.get('timespan', None) + self.interval = kwargs.get('interval', None) + self.namespace = kwargs.get('namespace', None) + self.resourceregion = kwargs.get('resourceregion', None) + self.value = kwargs.get('value', None) + + +class TimeSeriesElement(Model): + """A time series result type. The discriminator value is always TimeSeries in + this case. + + :param metadatavalues: the metadata values returned if $filter was + specified in the call. + :type metadatavalues: + list[~azure.mgmt.monitor.v2018_01_01.models.MetadataValue] + :param data: An array of data points representing the metric values. This + is only returned if a result type of data is specified. + :type data: list[~azure.mgmt.monitor.v2018_01_01.models.MetricValue] + """ + + _attribute_map = { + 'metadatavalues': {'key': 'metadatavalues', 'type': '[MetadataValue]'}, + 'data': {'key': 'data', 'type': '[MetricValue]'}, + } + + def __init__(self, **kwargs): + super(TimeSeriesElement, self).__init__(**kwargs) + self.metadatavalues = kwargs.get('metadatavalues', None) + self.data = kwargs.get('data', None) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_models_py3.py new file mode 100644 index 000000000000..972b2120cfb0 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_models_py3.py @@ -0,0 +1,355 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class LocalizableString(Model): + """The localizable string class. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. the invariant value. + :type value: str + :param localized_value: the locale specific value. + :type localized_value: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__(self, *, value: str, localized_value: str=None, **kwargs) -> None: + super(LocalizableString, self).__init__(**kwargs) + self.value = value + self.localized_value = localized_value + + +class MetadataValue(Model): + """Represents a metric metadata value. + + :param name: the name of the metadata. + :type name: ~azure.mgmt.monitor.v2018_01_01.models.LocalizableString + :param value: the value of the metadata. + :type value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, *, name=None, value: str=None, **kwargs) -> None: + super(MetadataValue, self).__init__(**kwargs) + self.name = name + self.value = value + + +class Metric(Model): + """The result data of a query. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. the metric Id. + :type id: str + :param type: Required. the resource type of the metric resource. + :type type: str + :param name: Required. the name and the display name of the metric, i.e. + it is localizable string. + :type name: ~azure.mgmt.monitor.v2018_01_01.models.LocalizableString + :param unit: Required. the unit of the metric. Possible values include: + 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', + 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified' + :type unit: str or ~azure.mgmt.monitor.v2018_01_01.models.Unit + :param timeseries: Required. the time series returned when a data query is + performed. + :type timeseries: + list[~azure.mgmt.monitor.v2018_01_01.models.TimeSeriesElement] + """ + + _validation = { + 'id': {'required': True}, + 'type': {'required': True}, + 'name': {'required': True}, + 'unit': {'required': True}, + 'timeseries': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'unit': {'key': 'unit', 'type': 'Unit'}, + 'timeseries': {'key': 'timeseries', 'type': '[TimeSeriesElement]'}, + } + + def __init__(self, *, id: str, type: str, name, unit, timeseries, **kwargs) -> None: + super(Metric, self).__init__(**kwargs) + self.id = id + self.type = type + self.name = name + self.unit = unit + self.timeseries = timeseries + + +class MetricAvailability(Model): + """Metric availability specifies the time grain (aggregation interval or + frequency) and the retention period for that time grain. + + :param time_grain: the time grain specifies the aggregation interval for + the metric. Expressed as a duration 'PT1M', 'P1D', etc. + :type time_grain: timedelta + :param retention: the retention period for the metric at the specified + timegrain. Expressed as a duration 'PT1M', 'P1D', etc. + :type retention: timedelta + """ + + _attribute_map = { + 'time_grain': {'key': 'timeGrain', 'type': 'duration'}, + 'retention': {'key': 'retention', 'type': 'duration'}, + } + + def __init__(self, *, time_grain=None, retention=None, **kwargs) -> None: + super(MetricAvailability, self).__init__(**kwargs) + self.time_grain = time_grain + self.retention = retention + + +class MetricDefinition(Model): + """Metric definition class specifies the metadata for a metric. + + :param is_dimension_required: Flag to indicate whether the dimension is + required. + :type is_dimension_required: bool + :param resource_id: the resource identifier of the resource that emitted + the metric. + :type resource_id: str + :param namespace: the namespace the metric belongs to. + :type namespace: str + :param name: the name and the display name of the metric, i.e. it is a + localizable string. + :type name: ~azure.mgmt.monitor.v2018_01_01.models.LocalizableString + :param unit: the unit of the metric. Possible values include: 'Count', + 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', + 'MilliSeconds', 'ByteSeconds', 'Unspecified' + :type unit: str or ~azure.mgmt.monitor.v2018_01_01.models.Unit + :param primary_aggregation_type: the primary aggregation type value + defining how to use the values for display. Possible values include: + 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' + :type primary_aggregation_type: str or + ~azure.mgmt.monitor.v2018_01_01.models.AggregationType + :param supported_aggregation_types: the collection of what aggregation + types are supported. + :type supported_aggregation_types: list[str or + ~azure.mgmt.monitor.v2018_01_01.models.AggregationType] + :param metric_availabilities: the collection of what aggregation intervals + are available to be queried. + :type metric_availabilities: + list[~azure.mgmt.monitor.v2018_01_01.models.MetricAvailability] + :param id: the resource identifier of the metric definition. + :type id: str + :param dimensions: the name and the display name of the dimension, i.e. it + is a localizable string. + :type dimensions: + list[~azure.mgmt.monitor.v2018_01_01.models.LocalizableString] + """ + + _attribute_map = { + 'is_dimension_required': {'key': 'isDimensionRequired', 'type': 'bool'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'namespace': {'key': 'namespace', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'unit': {'key': 'unit', 'type': 'Unit'}, + 'primary_aggregation_type': {'key': 'primaryAggregationType', 'type': 'AggregationType'}, + 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[AggregationType]'}, + 'metric_availabilities': {'key': 'metricAvailabilities', 'type': '[MetricAvailability]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[LocalizableString]'}, + } + + def __init__(self, *, is_dimension_required: bool=None, resource_id: str=None, namespace: str=None, name=None, unit=None, primary_aggregation_type=None, supported_aggregation_types=None, metric_availabilities=None, id: str=None, dimensions=None, **kwargs) -> None: + super(MetricDefinition, self).__init__(**kwargs) + self.is_dimension_required = is_dimension_required + self.resource_id = resource_id + self.namespace = namespace + self.name = name + self.unit = unit + self.primary_aggregation_type = primary_aggregation_type + self.supported_aggregation_types = supported_aggregation_types + self.metric_availabilities = metric_availabilities + self.id = id + self.dimensions = dimensions + + +class MetricValue(Model): + """Represents a metric value. + + All required parameters must be populated in order to send to Azure. + + :param time_stamp: Required. the timestamp for the metric value in ISO + 8601 format. + :type time_stamp: datetime + :param average: the average value in the time range. + :type average: float + :param minimum: the least value in the time range. + :type minimum: float + :param maximum: the greatest value in the time range. + :type maximum: float + :param total: the sum of all of the values in the time range. + :type total: float + :param count: the number of samples in the time range. Can be used to + determine the number of values that contributed to the average value. + :type count: long + """ + + _validation = { + 'time_stamp': {'required': True}, + } + + _attribute_map = { + 'time_stamp': {'key': 'timeStamp', 'type': 'iso-8601'}, + 'average': {'key': 'average', 'type': 'float'}, + 'minimum': {'key': 'minimum', 'type': 'float'}, + 'maximum': {'key': 'maximum', 'type': 'float'}, + 'total': {'key': 'total', 'type': 'float'}, + 'count': {'key': 'count', 'type': 'long'}, + } + + def __init__(self, *, time_stamp, average: float=None, minimum: float=None, maximum: float=None, total: float=None, count: int=None, **kwargs) -> None: + super(MetricValue, self).__init__(**kwargs) + self.time_stamp = time_stamp + self.average = average + self.minimum = minimum + self.maximum = maximum + self.total = total + self.count = count + + +class Response(Model): + """The response to a metrics query. + + All required parameters must be populated in order to send to Azure. + + :param cost: The integer value representing the cost of the query, for + data case. + :type cost: float + :param timespan: Required. The timespan for which the data was retrieved. + Its value consists of two datetimes concatenated, separated by '/'. This + may be adjusted in the future and returned back from what was originally + requested. + :type timespan: str + :param interval: The interval (window size) for which the metric data was + returned in. This may be adjusted in the future and returned back from + what was originally requested. This is not present if a metadata request + was made. + :type interval: timedelta + :param namespace: The namespace of the metrics been queried + :type namespace: str + :param resourceregion: The region of the resource been queried for + metrics. + :type resourceregion: str + :param value: Required. the value of the collection. + :type value: list[~azure.mgmt.monitor.v2018_01_01.models.Metric] + """ + + _validation = { + 'cost': {'minimum': 0}, + 'timespan': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'cost': {'key': 'cost', 'type': 'float'}, + 'timespan': {'key': 'timespan', 'type': 'str'}, + 'interval': {'key': 'interval', 'type': 'duration'}, + 'namespace': {'key': 'namespace', 'type': 'str'}, + 'resourceregion': {'key': 'resourceregion', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Metric]'}, + } + + def __init__(self, *, timespan: str, value, cost: float=None, interval=None, namespace: str=None, resourceregion: str=None, **kwargs) -> None: + super(Response, self).__init__(**kwargs) + self.cost = cost + self.timespan = timespan + self.interval = interval + self.namespace = namespace + self.resourceregion = resourceregion + self.value = value + + +class TimeSeriesElement(Model): + """A time series result type. The discriminator value is always TimeSeries in + this case. + + :param metadatavalues: the metadata values returned if $filter was + specified in the call. + :type metadatavalues: + list[~azure.mgmt.monitor.v2018_01_01.models.MetadataValue] + :param data: An array of data points representing the metric values. This + is only returned if a result type of data is specified. + :type data: list[~azure.mgmt.monitor.v2018_01_01.models.MetricValue] + """ + + _attribute_map = { + 'metadatavalues': {'key': 'metadatavalues', 'type': '[MetadataValue]'}, + 'data': {'key': 'data', 'type': '[MetricValue]'}, + } + + def __init__(self, *, metadatavalues=None, data=None, **kwargs) -> None: + super(TimeSeriesElement, self).__init__(**kwargs) + self.metadatavalues = metadatavalues + self.data = data diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_monitor_management_client_enums.py new file mode 100644 index 000000000000..61455e4c0c37 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_monitor_management_client_enums.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 enum import Enum + + +class Unit(str, Enum): + + count = "Count" + bytes = "Bytes" + seconds = "Seconds" + count_per_second = "CountPerSecond" + bytes_per_second = "BytesPerSecond" + percent = "Percent" + milli_seconds = "MilliSeconds" + byte_seconds = "ByteSeconds" + unspecified = "Unspecified" + + +class AggregationType(str, Enum): + + none = "None" + average = "Average" + count = "Count" + minimum = "Minimum" + maximum = "Maximum" + total = "Total" + + +class ResultType(str, Enum): + + data = "Data" + metadata = "Metadata" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_paged_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_paged_models.py new file mode 100644 index 000000000000..d720cea3d1c4 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_paged_models.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class MetricDefinitionPaged(Paged): + """ + A paging container for iterating over a list of :class:`MetricDefinition ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[MetricDefinition]'} + } + + def __init__(self, *args, **kwargs): + + super(MetricDefinitionPaged, self).__init__(*args, **kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/operations/__init__.py new file mode 100644 index 000000000000..b554536601cf --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/operations/__init__.py @@ -0,0 +1,18 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._metric_definitions_operations import MetricDefinitionsOperations +from ._metrics_operations import MetricsOperations + +__all__ = [ + 'MetricDefinitionsOperations', + 'MetricsOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/operations/_metric_definitions_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/operations/_metric_definitions_operations.py new file mode 100644 index 000000000000..1a54af556e95 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/operations/_metric_definitions_operations.py @@ -0,0 +1,111 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class MetricDefinitionsOperations(object): + """MetricDefinitionsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2018-01-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-01-01" + + self.config = config + + def list( + self, resource_uri, metricnamespace=None, custom_headers=None, raw=False, **operation_config): + """Lists the metric definitions for the resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param metricnamespace: Metric namespace to query metric definitions + for. + :type metricnamespace: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of MetricDefinition + :rtype: + ~azure.mgmt.monitor.v2018_01_01.models.MetricDefinitionPaged[~azure.mgmt.monitor.v2018_01_01.models.MetricDefinition] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if metricnamespace is not None: + query_parameters['metricnamespace'] = self._serialize.query("metricnamespace", metricnamespace, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metricDefinitions'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/operations/_metrics_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/operations/_metrics_operations.py new file mode 100644 index 000000000000..5a09983ea0da --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/operations/_metrics_operations.py @@ -0,0 +1,152 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class MetricsOperations(object): + """MetricsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2018-01-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-01-01" + + self.config = config + + def list( + self, resource_uri, timespan=None, interval=None, metricnames=None, aggregation=None, top=None, orderby=None, filter=None, result_type=None, metricnamespace=None, custom_headers=None, raw=False, **operation_config): + """**Lists the metric values for a resource**. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param timespan: The timespan of the query. It is a string with the + following format 'startDateTime_ISO/endDateTime_ISO'. + :type timespan: str + :param interval: The interval (i.e. timegrain) of the query. + :type interval: timedelta + :param metricnames: The names of the metrics (comma separated) to + retrieve. + :type metricnames: str + :param aggregation: The list of aggregation types (comma separated) to + retrieve. + :type aggregation: str + :param top: The maximum number of records to retrieve. + Valid only if $filter is specified. + Defaults to 10. + :type top: int + :param orderby: The aggregation to use for sorting results and the + direction of the sort. + Only one order can be specified. + Examples: sum asc. + :type orderby: str + :param filter: The **$filter** is used to reduce the set of metric + data returned.
Example:
Metric contains metadata A, B and + C.
- Return all time series of C where A = a1 and B = b1 or + b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq + ‘*’**
- Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C + eq ‘*’ or B = ‘b2’**
This is invalid because the logical or + operator cannot separate two different metadata names.
- Return all + time series where A = a1, B = b1 and C = c1:
**$filter=A eq ‘a1’ + and B eq ‘b1’ and C eq ‘c1’**
- Return all time series where A = + a1
**$filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**. + :type filter: str + :param result_type: Reduces the set of data collected. The syntax + allowed depends on the operation. See the operation's description for + details. Possible values include: 'Data', 'Metadata' + :type result_type: str or + ~azure.mgmt.monitor.v2018_01_01.models.ResultType + :param metricnamespace: Metric namespace to query metric definitions + for. + :type metricnamespace: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Response or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2018_01_01.models.Response or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if timespan is not None: + query_parameters['timespan'] = self._serialize.query("timespan", timespan, 'str') + if interval is not None: + query_parameters['interval'] = self._serialize.query("interval", interval, 'duration') + if metricnames is not None: + query_parameters['metricnames'] = self._serialize.query("metricnames", metricnames, 'str') + if aggregation is not None: + query_parameters['aggregation'] = self._serialize.query("aggregation", aggregation, 'str') + if top is not None: + query_parameters['top'] = self._serialize.query("top", top, 'int') + if orderby is not None: + query_parameters['orderby'] = self._serialize.query("orderby", orderby, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if result_type is not None: + query_parameters['resultType'] = self._serialize.query("result_type", result_type, 'ResultType') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if metricnamespace is not None: + query_parameters['metricnamespace'] = self._serialize.query("metricnamespace", metricnamespace, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Response', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metrics'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/version.py new file mode 100644 index 000000000000..c3c04423a322 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2018-01-01" + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/__init__.py new file mode 100644 index 000000000000..8e97360e5ffb --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._configuration import MonitorManagementClientConfiguration +from ._monitor_management_client import MonitorManagementClient +__all__ = ['MonitorManagementClient', 'MonitorManagementClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_configuration.py new file mode 100644 index 000000000000..88436f6b4a33 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_configuration.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 msrestazure import AzureConfiguration + +from .version import VERSION + + +class MonitorManagementClientConfiguration(AzureConfiguration): + """Configuration for MonitorManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription Id. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(MonitorManagementClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-monitor/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_monitor_management_client.py new file mode 100644 index 000000000000..aefd37600bf1 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_monitor_management_client.py @@ -0,0 +1,59 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import MonitorManagementClientConfiguration +from .operations import ActionGroupsOperations +from .operations import MetricAlertsOperations +from .operations import MetricAlertsStatusOperations +from . import models + + +class MonitorManagementClient(SDKClient): + """Monitor Management Client + + :ivar config: Configuration for client. + :vartype config: MonitorManagementClientConfiguration + + :ivar action_groups: ActionGroups operations + :vartype action_groups: azure.mgmt.monitor.v2018_03_01.operations.ActionGroupsOperations + :ivar metric_alerts: MetricAlerts operations + :vartype metric_alerts: azure.mgmt.monitor.v2018_03_01.operations.MetricAlertsOperations + :ivar metric_alerts_status: MetricAlertsStatus operations + :vartype metric_alerts_status: azure.mgmt.monitor.v2018_03_01.operations.MetricAlertsStatusOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription Id. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = MonitorManagementClientConfiguration(credentials, subscription_id, base_url) + super(MonitorManagementClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2018-03-01' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.action_groups = ActionGroupsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.metric_alerts = MetricAlertsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.metric_alerts_status = MetricAlertsStatusOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/__init__.py new file mode 100644 index 000000000000..99bcdefd12eb --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/__init__.py @@ -0,0 +1,108 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import ActionGroupPatchBody + from ._models_py3 import ActionGroupResource + from ._models_py3 import AutomationRunbookReceiver + from ._models_py3 import AzureAppPushReceiver + from ._models_py3 import AzureFunctionReceiver + from ._models_py3 import DynamicMetricCriteria + from ._models_py3 import DynamicThresholdFailingPeriods + from ._models_py3 import EmailReceiver + from ._models_py3 import EnableRequest + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import ItsmReceiver + from ._models_py3 import LogicAppReceiver + from ._models_py3 import MetricAlertAction + from ._models_py3 import MetricAlertCriteria + from ._models_py3 import MetricAlertMultipleResourceMultipleMetricCriteria + from ._models_py3 import MetricAlertResource + from ._models_py3 import MetricAlertResourcePatch + from ._models_py3 import MetricAlertSingleResourceMultipleMetricCriteria + from ._models_py3 import MetricAlertStatus + from ._models_py3 import MetricAlertStatusCollection + from ._models_py3 import MetricAlertStatusProperties + from ._models_py3 import MetricCriteria + from ._models_py3 import MetricDimension + from ._models_py3 import MultiMetricCriteria + from ._models_py3 import Resource + from ._models_py3 import SmsReceiver + from ._models_py3 import VoiceReceiver + from ._models_py3 import WebhookReceiver +except (SyntaxError, ImportError): + from ._models import ActionGroupPatchBody + from ._models import ActionGroupResource + from ._models import AutomationRunbookReceiver + from ._models import AzureAppPushReceiver + from ._models import AzureFunctionReceiver + from ._models import DynamicMetricCriteria + from ._models import DynamicThresholdFailingPeriods + from ._models import EmailReceiver + from ._models import EnableRequest + from ._models import ErrorResponse, ErrorResponseException + from ._models import ItsmReceiver + from ._models import LogicAppReceiver + from ._models import MetricAlertAction + from ._models import MetricAlertCriteria + from ._models import MetricAlertMultipleResourceMultipleMetricCriteria + from ._models import MetricAlertResource + from ._models import MetricAlertResourcePatch + from ._models import MetricAlertSingleResourceMultipleMetricCriteria + from ._models import MetricAlertStatus + from ._models import MetricAlertStatusCollection + from ._models import MetricAlertStatusProperties + from ._models import MetricCriteria + from ._models import MetricDimension + from ._models import MultiMetricCriteria + from ._models import Resource + from ._models import SmsReceiver + from ._models import VoiceReceiver + from ._models import WebhookReceiver +from ._paged_models import ActionGroupResourcePaged +from ._paged_models import MetricAlertResourcePaged +from ._monitor_management_client_enums import ( + ReceiverStatus, +) + +__all__ = [ + 'ActionGroupPatchBody', + 'ActionGroupResource', + 'AutomationRunbookReceiver', + 'AzureAppPushReceiver', + 'AzureFunctionReceiver', + 'DynamicMetricCriteria', + 'DynamicThresholdFailingPeriods', + 'EmailReceiver', + 'EnableRequest', + 'ErrorResponse', 'ErrorResponseException', + 'ItsmReceiver', + 'LogicAppReceiver', + 'MetricAlertAction', + 'MetricAlertCriteria', + 'MetricAlertMultipleResourceMultipleMetricCriteria', + 'MetricAlertResource', + 'MetricAlertResourcePatch', + 'MetricAlertSingleResourceMultipleMetricCriteria', + 'MetricAlertStatus', + 'MetricAlertStatusCollection', + 'MetricAlertStatusProperties', + 'MetricCriteria', + 'MetricDimension', + 'MultiMetricCriteria', + 'Resource', + 'SmsReceiver', + 'VoiceReceiver', + 'WebhookReceiver', + 'ActionGroupResourcePaged', + 'MetricAlertResourcePaged', + 'ReceiverStatus', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models.py new file mode 100644 index 000000000000..afd1c724fc87 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models.py @@ -0,0 +1,1227 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ActionGroupPatchBody(Model): + """An action group object for the body of patch operations. + + :param tags: Resource tags + :type tags: dict[str, str] + :param enabled: Indicates whether this action group is enabled. If an + action group is not enabled, then none of its actions will be activated. + Default value: True . + :type enabled: bool + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(ActionGroupPatchBody, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.enabled = kwargs.get('enabled', True) + + +class Resource(Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class ActionGroupResource(Resource): + """An action group resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param group_short_name: Required. The short name of the action group. + This will be used in SMS messages. + :type group_short_name: str + :param enabled: Required. Indicates whether this action group is enabled. + If an action group is not enabled, then none of its receivers will receive + communications. Default value: True . + :type enabled: bool + :param email_receivers: The list of email receivers that are part of this + action group. + :type email_receivers: + list[~azure.mgmt.monitor.v2018_03_01.models.EmailReceiver] + :param sms_receivers: The list of SMS receivers that are part of this + action group. + :type sms_receivers: + list[~azure.mgmt.monitor.v2018_03_01.models.SmsReceiver] + :param webhook_receivers: The list of webhook receivers that are part of + this action group. + :type webhook_receivers: + list[~azure.mgmt.monitor.v2018_03_01.models.WebhookReceiver] + :param itsm_receivers: The list of ITSM receivers that are part of this + action group. + :type itsm_receivers: + list[~azure.mgmt.monitor.v2018_03_01.models.ItsmReceiver] + :param azure_app_push_receivers: The list of AzureAppPush receivers that + are part of this action group. + :type azure_app_push_receivers: + list[~azure.mgmt.monitor.v2018_03_01.models.AzureAppPushReceiver] + :param automation_runbook_receivers: The list of AutomationRunbook + receivers that are part of this action group. + :type automation_runbook_receivers: + list[~azure.mgmt.monitor.v2018_03_01.models.AutomationRunbookReceiver] + :param voice_receivers: The list of voice receivers that are part of this + action group. + :type voice_receivers: + list[~azure.mgmt.monitor.v2018_03_01.models.VoiceReceiver] + :param logic_app_receivers: The list of logic app receivers that are part + of this action group. + :type logic_app_receivers: + list[~azure.mgmt.monitor.v2018_03_01.models.LogicAppReceiver] + :param azure_function_receivers: The list of azure function receivers that + are part of this action group. + :type azure_function_receivers: + list[~azure.mgmt.monitor.v2018_03_01.models.AzureFunctionReceiver] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'group_short_name': {'required': True, 'max_length': 12}, + 'enabled': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'group_short_name': {'key': 'properties.groupShortName', 'type': 'str'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'email_receivers': {'key': 'properties.emailReceivers', 'type': '[EmailReceiver]'}, + 'sms_receivers': {'key': 'properties.smsReceivers', 'type': '[SmsReceiver]'}, + 'webhook_receivers': {'key': 'properties.webhookReceivers', 'type': '[WebhookReceiver]'}, + 'itsm_receivers': {'key': 'properties.itsmReceivers', 'type': '[ItsmReceiver]'}, + 'azure_app_push_receivers': {'key': 'properties.azureAppPushReceivers', 'type': '[AzureAppPushReceiver]'}, + 'automation_runbook_receivers': {'key': 'properties.automationRunbookReceivers', 'type': '[AutomationRunbookReceiver]'}, + 'voice_receivers': {'key': 'properties.voiceReceivers', 'type': '[VoiceReceiver]'}, + 'logic_app_receivers': {'key': 'properties.logicAppReceivers', 'type': '[LogicAppReceiver]'}, + 'azure_function_receivers': {'key': 'properties.azureFunctionReceivers', 'type': '[AzureFunctionReceiver]'}, + } + + def __init__(self, **kwargs): + super(ActionGroupResource, self).__init__(**kwargs) + self.group_short_name = kwargs.get('group_short_name', None) + self.enabled = kwargs.get('enabled', True) + self.email_receivers = kwargs.get('email_receivers', None) + self.sms_receivers = kwargs.get('sms_receivers', None) + self.webhook_receivers = kwargs.get('webhook_receivers', None) + self.itsm_receivers = kwargs.get('itsm_receivers', None) + self.azure_app_push_receivers = kwargs.get('azure_app_push_receivers', None) + self.automation_runbook_receivers = kwargs.get('automation_runbook_receivers', None) + self.voice_receivers = kwargs.get('voice_receivers', None) + self.logic_app_receivers = kwargs.get('logic_app_receivers', None) + self.azure_function_receivers = kwargs.get('azure_function_receivers', None) + + +class AutomationRunbookReceiver(Model): + """The Azure Automation Runbook notification receiver. + + All required parameters must be populated in order to send to Azure. + + :param automation_account_id: Required. The Azure automation account Id + which holds this runbook and authenticate to Azure resource. + :type automation_account_id: str + :param runbook_name: Required. The name for this runbook. + :type runbook_name: str + :param webhook_resource_id: Required. The resource id for webhook linked + to this runbook. + :type webhook_resource_id: str + :param is_global_runbook: Required. Indicates whether this instance is + global runbook. + :type is_global_runbook: bool + :param name: Indicates name of the webhook. + :type name: str + :param service_uri: The URI where webhooks should be sent. + :type service_uri: str + """ + + _validation = { + 'automation_account_id': {'required': True}, + 'runbook_name': {'required': True}, + 'webhook_resource_id': {'required': True}, + 'is_global_runbook': {'required': True}, + } + + _attribute_map = { + 'automation_account_id': {'key': 'automationAccountId', 'type': 'str'}, + 'runbook_name': {'key': 'runbookName', 'type': 'str'}, + 'webhook_resource_id': {'key': 'webhookResourceId', 'type': 'str'}, + 'is_global_runbook': {'key': 'isGlobalRunbook', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AutomationRunbookReceiver, self).__init__(**kwargs) + self.automation_account_id = kwargs.get('automation_account_id', None) + self.runbook_name = kwargs.get('runbook_name', None) + self.webhook_resource_id = kwargs.get('webhook_resource_id', None) + self.is_global_runbook = kwargs.get('is_global_runbook', None) + self.name = kwargs.get('name', None) + self.service_uri = kwargs.get('service_uri', None) + + +class AzureAppPushReceiver(Model): + """The Azure mobile App push notification receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the Azure mobile app push receiver. + Names must be unique across all receivers within an action group. + :type name: str + :param email_address: Required. The email address registered for the Azure + mobile app. + :type email_address: str + """ + + _validation = { + 'name': {'required': True}, + 'email_address': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AzureAppPushReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.email_address = kwargs.get('email_address', None) + + +class AzureFunctionReceiver(Model): + """An azure function receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the azure function receiver. Names must + be unique across all receivers within an action group. + :type name: str + :param function_app_resource_id: Required. The azure resource id of the + function app. + :type function_app_resource_id: str + :param function_name: Required. The function name in the function app. + :type function_name: str + :param http_trigger_url: Required. The http trigger url where http request + sent to. + :type http_trigger_url: str + """ + + _validation = { + 'name': {'required': True}, + 'function_app_resource_id': {'required': True}, + 'function_name': {'required': True}, + 'http_trigger_url': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'function_app_resource_id': {'key': 'functionAppResourceId', 'type': 'str'}, + 'function_name': {'key': 'functionName', 'type': 'str'}, + 'http_trigger_url': {'key': 'httpTriggerUrl', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AzureFunctionReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.function_app_resource_id = kwargs.get('function_app_resource_id', None) + self.function_name = kwargs.get('function_name', None) + self.http_trigger_url = kwargs.get('http_trigger_url', None) + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class MultiMetricCriteria(Model): + """The types of conditions for a multi resource alert. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: MetricCriteria, DynamicMetricCriteria + + All required parameters must be populated in order to send to Azure. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param name: Required. Name of the criteria. + :type name: str + :param metric_name: Required. Name of the metric. + :type metric_name: str + :param metric_namespace: Namespace of the metric. + :type metric_namespace: str + :param time_aggregation: Required. the criteria time aggregation types. + :type time_aggregation: object + :param dimensions: List of dimension conditions. + :type dimensions: + list[~azure.mgmt.monitor.v2018_03_01.models.MetricDimension] + :param criterion_type: Required. Constant filled by server. + :type criterion_type: str + """ + + _validation = { + 'name': {'required': True}, + 'metric_name': {'required': True}, + 'time_aggregation': {'required': True}, + 'criterion_type': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'name': {'key': 'name', 'type': 'str'}, + 'metric_name': {'key': 'metricName', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, + 'time_aggregation': {'key': 'timeAggregation', 'type': 'object'}, + 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, + 'criterion_type': {'key': 'criterionType', 'type': 'str'}, + } + + _subtype_map = { + 'criterion_type': {'StaticThresholdCriterion': 'MetricCriteria', 'DynamicThresholdCriterion': 'DynamicMetricCriteria'} + } + + def __init__(self, **kwargs): + super(MultiMetricCriteria, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) + self.name = kwargs.get('name', None) + self.metric_name = kwargs.get('metric_name', None) + self.metric_namespace = kwargs.get('metric_namespace', None) + self.time_aggregation = kwargs.get('time_aggregation', None) + self.dimensions = kwargs.get('dimensions', None) + self.criterion_type = None + + +class DynamicMetricCriteria(MultiMetricCriteria): + """Criterion for dynamic threshold. + + All required parameters must be populated in order to send to Azure. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param name: Required. Name of the criteria. + :type name: str + :param metric_name: Required. Name of the metric. + :type metric_name: str + :param metric_namespace: Namespace of the metric. + :type metric_namespace: str + :param time_aggregation: Required. the criteria time aggregation types. + :type time_aggregation: object + :param dimensions: List of dimension conditions. + :type dimensions: + list[~azure.mgmt.monitor.v2018_03_01.models.MetricDimension] + :param criterion_type: Required. Constant filled by server. + :type criterion_type: str + :param operator: Required. The operator used to compare the metric value + against the threshold. + :type operator: object + :param alert_sensitivity: Required. The extent of deviation required to + trigger an alert. This will affect how tight the threshold is to the + metric series pattern. + :type alert_sensitivity: object + :param failing_periods: Required. The minimum number of violations + required within the selected lookback time window required to raise an + alert. + :type failing_periods: + ~azure.mgmt.monitor.v2018_03_01.models.DynamicThresholdFailingPeriods + :param ignore_data_before: Use this option to set the date from which to + start learning the metric historical data and calculate the dynamic + thresholds (in ISO8601 format) + :type ignore_data_before: datetime + """ + + _validation = { + 'name': {'required': True}, + 'metric_name': {'required': True}, + 'time_aggregation': {'required': True}, + 'criterion_type': {'required': True}, + 'operator': {'required': True}, + 'alert_sensitivity': {'required': True}, + 'failing_periods': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'name': {'key': 'name', 'type': 'str'}, + 'metric_name': {'key': 'metricName', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, + 'time_aggregation': {'key': 'timeAggregation', 'type': 'object'}, + 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, + 'criterion_type': {'key': 'criterionType', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'object'}, + 'alert_sensitivity': {'key': 'alertSensitivity', 'type': 'object'}, + 'failing_periods': {'key': 'failingPeriods', 'type': 'DynamicThresholdFailingPeriods'}, + 'ignore_data_before': {'key': 'ignoreDataBefore', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(DynamicMetricCriteria, self).__init__(**kwargs) + self.operator = kwargs.get('operator', None) + self.alert_sensitivity = kwargs.get('alert_sensitivity', None) + self.failing_periods = kwargs.get('failing_periods', None) + self.ignore_data_before = kwargs.get('ignore_data_before', None) + self.criterion_type = 'DynamicThresholdCriterion' + + +class DynamicThresholdFailingPeriods(Model): + """The minimum number of violations required within the selected lookback time + window required to raise an alert. + + All required parameters must be populated in order to send to Azure. + + :param number_of_evaluation_periods: Required. The number of aggregated + lookback points. The lookback time window is calculated based on the + aggregation granularity (windowSize) and the selected number of aggregated + points. + :type number_of_evaluation_periods: float + :param min_failing_periods_to_alert: Required. The number of violations to + trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. + :type min_failing_periods_to_alert: float + """ + + _validation = { + 'number_of_evaluation_periods': {'required': True}, + 'min_failing_periods_to_alert': {'required': True}, + } + + _attribute_map = { + 'number_of_evaluation_periods': {'key': 'numberOfEvaluationPeriods', 'type': 'float'}, + 'min_failing_periods_to_alert': {'key': 'minFailingPeriodsToAlert', 'type': 'float'}, + } + + def __init__(self, **kwargs): + super(DynamicThresholdFailingPeriods, self).__init__(**kwargs) + self.number_of_evaluation_periods = kwargs.get('number_of_evaluation_periods', None) + self.min_failing_periods_to_alert = kwargs.get('min_failing_periods_to_alert', None) + + +class EmailReceiver(Model): + """An email receiver. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the email receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param email_address: Required. The email address of this receiver. + :type email_address: str + :ivar status: The receiver status of the e-mail. Possible values include: + 'NotSpecified', 'Enabled', 'Disabled' + :vartype status: str or + ~azure.mgmt.monitor.v2018_03_01.models.ReceiverStatus + """ + + _validation = { + 'name': {'required': True}, + 'email_address': {'required': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'ReceiverStatus'}, + } + + def __init__(self, **kwargs): + super(EmailReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.email_address = kwargs.get('email_address', None) + self.status = None + + +class EnableRequest(Model): + """Describes a receiver that should be resubscribed. + + All required parameters must be populated in order to send to Azure. + + :param receiver_name: Required. The name of the receiver to resubscribe. + :type receiver_name: str + """ + + _validation = { + 'receiver_name': {'required': True}, + } + + _attribute_map = { + 'receiver_name': {'key': 'receiverName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(EnableRequest, self).__init__(**kwargs) + self.receiver_name = kwargs.get('receiver_name', None) + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class ItsmReceiver(Model): + """An Itsm receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the Itsm receiver. Names must be unique + across all receivers within an action group. + :type name: str + :param workspace_id: Required. OMS LA instance identifier. + :type workspace_id: str + :param connection_id: Required. Unique identification of ITSM connection + among multiple defined in above workspace. + :type connection_id: str + :param ticket_configuration: Required. JSON blob for the configurations of + the ITSM action. CreateMultipleWorkItems option will be part of this blob + as well. + :type ticket_configuration: str + :param region: Required. Region in which workspace resides. Supported + values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' + :type region: str + """ + + _validation = { + 'name': {'required': True}, + 'workspace_id': {'required': True}, + 'connection_id': {'required': True}, + 'ticket_configuration': {'required': True}, + 'region': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, + 'connection_id': {'key': 'connectionId', 'type': 'str'}, + 'ticket_configuration': {'key': 'ticketConfiguration', 'type': 'str'}, + 'region': {'key': 'region', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ItsmReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.workspace_id = kwargs.get('workspace_id', None) + self.connection_id = kwargs.get('connection_id', None) + self.ticket_configuration = kwargs.get('ticket_configuration', None) + self.region = kwargs.get('region', None) + + +class LogicAppReceiver(Model): + """A logic app receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the logic app receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param resource_id: Required. The azure resource id of the logic app + receiver. + :type resource_id: str + :param callback_url: Required. The callback url where http request sent + to. + :type callback_url: str + """ + + _validation = { + 'name': {'required': True}, + 'resource_id': {'required': True}, + 'callback_url': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'callback_url': {'key': 'callbackUrl', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(LogicAppReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.resource_id = kwargs.get('resource_id', None) + self.callback_url = kwargs.get('callback_url', None) + + +class MetricAlertAction(Model): + """An alert action. + + :param action_group_id: the id of the action group to use. + :type action_group_id: str + :param webhook_properties: The properties of a webhook object. + :type webhook_properties: dict[str, str] + """ + + _attribute_map = { + 'action_group_id': {'key': 'actionGroupId', 'type': 'str'}, + 'webhook_properties': {'key': 'webhookProperties', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(MetricAlertAction, self).__init__(**kwargs) + self.action_group_id = kwargs.get('action_group_id', None) + self.webhook_properties = kwargs.get('webhook_properties', None) + + +class MetricAlertCriteria(Model): + """The rule criteria that defines the conditions of the alert rule. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: MetricAlertSingleResourceMultipleMetricCriteria, + MetricAlertMultipleResourceMultipleMetricCriteria + + All required parameters must be populated in order to send to Azure. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param odatatype: Required. Constant filled by server. + :type odatatype: str + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + } + + _subtype_map = { + 'odatatype': {'Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria': 'MetricAlertSingleResourceMultipleMetricCriteria', 'Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria': 'MetricAlertMultipleResourceMultipleMetricCriteria'} + } + + def __init__(self, **kwargs): + super(MetricAlertCriteria, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) + self.odatatype = None + + +class MetricAlertMultipleResourceMultipleMetricCriteria(MetricAlertCriteria): + """Specifies the metric alert criteria for multiple resource that has multiple + metric criteria. + + All required parameters must be populated in order to send to Azure. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param all_of: the list of multiple metric criteria for this 'all of' + operation. + :type all_of: + list[~azure.mgmt.monitor.v2018_03_01.models.MultiMetricCriteria] + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'all_of': {'key': 'allOf', 'type': '[MultiMetricCriteria]'}, + } + + def __init__(self, **kwargs): + super(MetricAlertMultipleResourceMultipleMetricCriteria, self).__init__(**kwargs) + self.all_of = kwargs.get('all_of', None) + self.odatatype = 'Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria' + + +class MetricAlertResource(Resource): + """The metric alert resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param description: Required. the description of the metric alert that + will be included in the alert email. + :type description: str + :param severity: Required. Alert severity {0, 1, 2, 3, 4} + :type severity: int + :param enabled: Required. the flag that indicates whether the metric alert + is enabled. + :type enabled: bool + :param scopes: the list of resource id's that this metric alert is scoped + to. + :type scopes: list[str] + :param evaluation_frequency: Required. how often the metric alert is + evaluated represented in ISO 8601 duration format. + :type evaluation_frequency: timedelta + :param window_size: Required. the period of time (in ISO 8601 duration + format) that is used to monitor alert activity based on the threshold. + :type window_size: timedelta + :param target_resource_type: the resource type of the target resource(s) + on which the alert is created/updated. Mandatory for + MultipleResourceMultipleMetricCriteria. + :type target_resource_type: str + :param target_resource_region: the region of the target resource(s) on + which the alert is created/updated. Mandatory for + MultipleResourceMultipleMetricCriteria. + :type target_resource_region: str + :param criteria: Required. defines the specific alert criteria + information. + :type criteria: ~azure.mgmt.monitor.v2018_03_01.models.MetricAlertCriteria + :param auto_mitigate: the flag that indicates whether the alert should be + auto resolved or not. + :type auto_mitigate: bool + :param actions: the array of actions that are performed when the alert + rule becomes active, and when an alert condition is resolved. + :type actions: + list[~azure.mgmt.monitor.v2018_03_01.models.MetricAlertAction] + :ivar last_updated_time: Last time the rule was updated in ISO8601 format. + :vartype last_updated_time: datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'description': {'required': True}, + 'severity': {'required': True}, + 'enabled': {'required': True}, + 'evaluation_frequency': {'required': True}, + 'window_size': {'required': True}, + 'criteria': {'required': True}, + 'last_updated_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'severity': {'key': 'properties.severity', 'type': 'int'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, + 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, + 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, + 'target_resource_type': {'key': 'properties.targetResourceType', 'type': 'str'}, + 'target_resource_region': {'key': 'properties.targetResourceRegion', 'type': 'str'}, + 'criteria': {'key': 'properties.criteria', 'type': 'MetricAlertCriteria'}, + 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, + 'actions': {'key': 'properties.actions', 'type': '[MetricAlertAction]'}, + 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(MetricAlertResource, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.severity = kwargs.get('severity', None) + self.enabled = kwargs.get('enabled', None) + self.scopes = kwargs.get('scopes', None) + self.evaluation_frequency = kwargs.get('evaluation_frequency', None) + self.window_size = kwargs.get('window_size', None) + self.target_resource_type = kwargs.get('target_resource_type', None) + self.target_resource_region = kwargs.get('target_resource_region', None) + self.criteria = kwargs.get('criteria', None) + self.auto_mitigate = kwargs.get('auto_mitigate', None) + self.actions = kwargs.get('actions', None) + self.last_updated_time = None + + +class MetricAlertResourcePatch(Model): + """The metric alert resource for patch operations. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param tags: Resource tags + :type tags: dict[str, str] + :param description: Required. the description of the metric alert that + will be included in the alert email. + :type description: str + :param severity: Required. Alert severity {0, 1, 2, 3, 4} + :type severity: int + :param enabled: Required. the flag that indicates whether the metric alert + is enabled. + :type enabled: bool + :param scopes: the list of resource id's that this metric alert is scoped + to. + :type scopes: list[str] + :param evaluation_frequency: Required. how often the metric alert is + evaluated represented in ISO 8601 duration format. + :type evaluation_frequency: timedelta + :param window_size: Required. the period of time (in ISO 8601 duration + format) that is used to monitor alert activity based on the threshold. + :type window_size: timedelta + :param target_resource_type: the resource type of the target resource(s) + on which the alert is created/updated. Mandatory for + MultipleResourceMultipleMetricCriteria. + :type target_resource_type: str + :param target_resource_region: the region of the target resource(s) on + which the alert is created/updated. Mandatory for + MultipleResourceMultipleMetricCriteria. + :type target_resource_region: str + :param criteria: Required. defines the specific alert criteria + information. + :type criteria: ~azure.mgmt.monitor.v2018_03_01.models.MetricAlertCriteria + :param auto_mitigate: the flag that indicates whether the alert should be + auto resolved or not. + :type auto_mitigate: bool + :param actions: the array of actions that are performed when the alert + rule becomes active, and when an alert condition is resolved. + :type actions: + list[~azure.mgmt.monitor.v2018_03_01.models.MetricAlertAction] + :ivar last_updated_time: Last time the rule was updated in ISO8601 format. + :vartype last_updated_time: datetime + """ + + _validation = { + 'description': {'required': True}, + 'severity': {'required': True}, + 'enabled': {'required': True}, + 'evaluation_frequency': {'required': True}, + 'window_size': {'required': True}, + 'criteria': {'required': True}, + 'last_updated_time': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'severity': {'key': 'properties.severity', 'type': 'int'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, + 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, + 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, + 'target_resource_type': {'key': 'properties.targetResourceType', 'type': 'str'}, + 'target_resource_region': {'key': 'properties.targetResourceRegion', 'type': 'str'}, + 'criteria': {'key': 'properties.criteria', 'type': 'MetricAlertCriteria'}, + 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, + 'actions': {'key': 'properties.actions', 'type': '[MetricAlertAction]'}, + 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(MetricAlertResourcePatch, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.description = kwargs.get('description', None) + self.severity = kwargs.get('severity', None) + self.enabled = kwargs.get('enabled', None) + self.scopes = kwargs.get('scopes', None) + self.evaluation_frequency = kwargs.get('evaluation_frequency', None) + self.window_size = kwargs.get('window_size', None) + self.target_resource_type = kwargs.get('target_resource_type', None) + self.target_resource_region = kwargs.get('target_resource_region', None) + self.criteria = kwargs.get('criteria', None) + self.auto_mitigate = kwargs.get('auto_mitigate', None) + self.actions = kwargs.get('actions', None) + self.last_updated_time = None + + +class MetricAlertSingleResourceMultipleMetricCriteria(MetricAlertCriteria): + """Specifies the metric alert criteria for a single resource that has multiple + metric criteria. + + All required parameters must be populated in order to send to Azure. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param all_of: The list of metric criteria for this 'all of' operation. + :type all_of: list[~azure.mgmt.monitor.v2018_03_01.models.MetricCriteria] + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'all_of': {'key': 'allOf', 'type': '[MetricCriteria]'}, + } + + def __init__(self, **kwargs): + super(MetricAlertSingleResourceMultipleMetricCriteria, self).__init__(**kwargs) + self.all_of = kwargs.get('all_of', None) + self.odatatype = 'Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria' + + +class MetricAlertStatus(Model): + """An alert status. + + :param name: The status name. + :type name: str + :param id: The alert rule arm id. + :type id: str + :param type: The extended resource type name. + :type type: str + :param properties: The alert status properties of the metric alert status. + :type properties: + ~azure.mgmt.monitor.v2018_03_01.models.MetricAlertStatusProperties + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'MetricAlertStatusProperties'}, + } + + def __init__(self, **kwargs): + super(MetricAlertStatus, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.id = kwargs.get('id', None) + self.type = kwargs.get('type', None) + self.properties = kwargs.get('properties', None) + + +class MetricAlertStatusCollection(Model): + """Represents a collection of alert rule resources. + + :param value: the values for the alert rule resources. + :type value: + list[~azure.mgmt.monitor.v2018_03_01.models.MetricAlertStatus] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[MetricAlertStatus]'}, + } + + def __init__(self, **kwargs): + super(MetricAlertStatusCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class MetricAlertStatusProperties(Model): + """An alert status properties. + + :param dimensions: An object describing the type of the dimensions. + :type dimensions: dict[str, str] + :param status: status value + :type status: str + :param timestamp: UTC time when the status was checked. + :type timestamp: datetime + """ + + _attribute_map = { + 'dimensions': {'key': 'dimensions', 'type': '{str}'}, + 'status': {'key': 'status', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(MetricAlertStatusProperties, self).__init__(**kwargs) + self.dimensions = kwargs.get('dimensions', None) + self.status = kwargs.get('status', None) + self.timestamp = kwargs.get('timestamp', None) + + +class MetricCriteria(MultiMetricCriteria): + """Criterion to filter metrics. + + All required parameters must be populated in order to send to Azure. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param name: Required. Name of the criteria. + :type name: str + :param metric_name: Required. Name of the metric. + :type metric_name: str + :param metric_namespace: Namespace of the metric. + :type metric_namespace: str + :param time_aggregation: Required. the criteria time aggregation types. + :type time_aggregation: object + :param dimensions: List of dimension conditions. + :type dimensions: + list[~azure.mgmt.monitor.v2018_03_01.models.MetricDimension] + :param criterion_type: Required. Constant filled by server. + :type criterion_type: str + :param operator: Required. the criteria operator. + :type operator: object + :param threshold: Required. the criteria threshold value that activates + the alert. + :type threshold: float + """ + + _validation = { + 'name': {'required': True}, + 'metric_name': {'required': True}, + 'time_aggregation': {'required': True}, + 'criterion_type': {'required': True}, + 'operator': {'required': True}, + 'threshold': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'name': {'key': 'name', 'type': 'str'}, + 'metric_name': {'key': 'metricName', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, + 'time_aggregation': {'key': 'timeAggregation', 'type': 'object'}, + 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, + 'criterion_type': {'key': 'criterionType', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'object'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + } + + def __init__(self, **kwargs): + super(MetricCriteria, self).__init__(**kwargs) + self.operator = kwargs.get('operator', None) + self.threshold = kwargs.get('threshold', None) + self.criterion_type = 'StaticThresholdCriterion' + + +class MetricDimension(Model): + """Specifies a metric dimension. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the dimension. + :type name: str + :param operator: Required. the dimension operator. Only 'Include' and + 'Exclude' are supported + :type operator: str + :param values: Required. list of dimension values. + :type values: list[str] + """ + + _validation = { + 'name': {'required': True}, + 'operator': {'required': True}, + 'values': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(MetricDimension, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.operator = kwargs.get('operator', None) + self.values = kwargs.get('values', None) + + +class SmsReceiver(Model): + """An SMS receiver. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the SMS receiver. Names must be unique + across all receivers within an action group. + :type name: str + :param country_code: Required. The country code of the SMS receiver. + :type country_code: str + :param phone_number: Required. The phone number of the SMS receiver. + :type phone_number: str + :ivar status: The status of the receiver. Possible values include: + 'NotSpecified', 'Enabled', 'Disabled' + :vartype status: str or + ~azure.mgmt.monitor.v2018_03_01.models.ReceiverStatus + """ + + _validation = { + 'name': {'required': True}, + 'country_code': {'required': True}, + 'phone_number': {'required': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'phone_number': {'key': 'phoneNumber', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'ReceiverStatus'}, + } + + def __init__(self, **kwargs): + super(SmsReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.country_code = kwargs.get('country_code', None) + self.phone_number = kwargs.get('phone_number', None) + self.status = None + + +class VoiceReceiver(Model): + """A voice receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the voice receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param country_code: Required. The country code of the voice receiver. + :type country_code: str + :param phone_number: Required. The phone number of the voice receiver. + :type phone_number: str + """ + + _validation = { + 'name': {'required': True}, + 'country_code': {'required': True}, + 'phone_number': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'phone_number': {'key': 'phoneNumber', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(VoiceReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.country_code = kwargs.get('country_code', None) + self.phone_number = kwargs.get('phone_number', None) + + +class WebhookReceiver(Model): + """A webhook receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the webhook receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param service_uri: Required. The URI where webhooks should be sent. + :type service_uri: str + """ + + _validation = { + 'name': {'required': True}, + 'service_uri': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(WebhookReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.service_uri = kwargs.get('service_uri', None) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models_py3.py new file mode 100644 index 000000000000..9defb4f09032 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models_py3.py @@ -0,0 +1,1227 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ActionGroupPatchBody(Model): + """An action group object for the body of patch operations. + + :param tags: Resource tags + :type tags: dict[str, str] + :param enabled: Indicates whether this action group is enabled. If an + action group is not enabled, then none of its actions will be activated. + Default value: True . + :type enabled: bool + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + } + + def __init__(self, *, tags=None, enabled: bool=True, **kwargs) -> None: + super(ActionGroupPatchBody, self).__init__(**kwargs) + self.tags = tags + self.enabled = enabled + + +class Resource(Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, location: str, tags=None, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class ActionGroupResource(Resource): + """An action group resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param group_short_name: Required. The short name of the action group. + This will be used in SMS messages. + :type group_short_name: str + :param enabled: Required. Indicates whether this action group is enabled. + If an action group is not enabled, then none of its receivers will receive + communications. Default value: True . + :type enabled: bool + :param email_receivers: The list of email receivers that are part of this + action group. + :type email_receivers: + list[~azure.mgmt.monitor.v2018_03_01.models.EmailReceiver] + :param sms_receivers: The list of SMS receivers that are part of this + action group. + :type sms_receivers: + list[~azure.mgmt.monitor.v2018_03_01.models.SmsReceiver] + :param webhook_receivers: The list of webhook receivers that are part of + this action group. + :type webhook_receivers: + list[~azure.mgmt.monitor.v2018_03_01.models.WebhookReceiver] + :param itsm_receivers: The list of ITSM receivers that are part of this + action group. + :type itsm_receivers: + list[~azure.mgmt.monitor.v2018_03_01.models.ItsmReceiver] + :param azure_app_push_receivers: The list of AzureAppPush receivers that + are part of this action group. + :type azure_app_push_receivers: + list[~azure.mgmt.monitor.v2018_03_01.models.AzureAppPushReceiver] + :param automation_runbook_receivers: The list of AutomationRunbook + receivers that are part of this action group. + :type automation_runbook_receivers: + list[~azure.mgmt.monitor.v2018_03_01.models.AutomationRunbookReceiver] + :param voice_receivers: The list of voice receivers that are part of this + action group. + :type voice_receivers: + list[~azure.mgmt.monitor.v2018_03_01.models.VoiceReceiver] + :param logic_app_receivers: The list of logic app receivers that are part + of this action group. + :type logic_app_receivers: + list[~azure.mgmt.monitor.v2018_03_01.models.LogicAppReceiver] + :param azure_function_receivers: The list of azure function receivers that + are part of this action group. + :type azure_function_receivers: + list[~azure.mgmt.monitor.v2018_03_01.models.AzureFunctionReceiver] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'group_short_name': {'required': True, 'max_length': 12}, + 'enabled': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'group_short_name': {'key': 'properties.groupShortName', 'type': 'str'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'email_receivers': {'key': 'properties.emailReceivers', 'type': '[EmailReceiver]'}, + 'sms_receivers': {'key': 'properties.smsReceivers', 'type': '[SmsReceiver]'}, + 'webhook_receivers': {'key': 'properties.webhookReceivers', 'type': '[WebhookReceiver]'}, + 'itsm_receivers': {'key': 'properties.itsmReceivers', 'type': '[ItsmReceiver]'}, + 'azure_app_push_receivers': {'key': 'properties.azureAppPushReceivers', 'type': '[AzureAppPushReceiver]'}, + 'automation_runbook_receivers': {'key': 'properties.automationRunbookReceivers', 'type': '[AutomationRunbookReceiver]'}, + 'voice_receivers': {'key': 'properties.voiceReceivers', 'type': '[VoiceReceiver]'}, + 'logic_app_receivers': {'key': 'properties.logicAppReceivers', 'type': '[LogicAppReceiver]'}, + 'azure_function_receivers': {'key': 'properties.azureFunctionReceivers', 'type': '[AzureFunctionReceiver]'}, + } + + def __init__(self, *, location: str, group_short_name: str, tags=None, enabled: bool=True, email_receivers=None, sms_receivers=None, webhook_receivers=None, itsm_receivers=None, azure_app_push_receivers=None, automation_runbook_receivers=None, voice_receivers=None, logic_app_receivers=None, azure_function_receivers=None, **kwargs) -> None: + super(ActionGroupResource, self).__init__(location=location, tags=tags, **kwargs) + self.group_short_name = group_short_name + self.enabled = enabled + self.email_receivers = email_receivers + self.sms_receivers = sms_receivers + self.webhook_receivers = webhook_receivers + self.itsm_receivers = itsm_receivers + self.azure_app_push_receivers = azure_app_push_receivers + self.automation_runbook_receivers = automation_runbook_receivers + self.voice_receivers = voice_receivers + self.logic_app_receivers = logic_app_receivers + self.azure_function_receivers = azure_function_receivers + + +class AutomationRunbookReceiver(Model): + """The Azure Automation Runbook notification receiver. + + All required parameters must be populated in order to send to Azure. + + :param automation_account_id: Required. The Azure automation account Id + which holds this runbook and authenticate to Azure resource. + :type automation_account_id: str + :param runbook_name: Required. The name for this runbook. + :type runbook_name: str + :param webhook_resource_id: Required. The resource id for webhook linked + to this runbook. + :type webhook_resource_id: str + :param is_global_runbook: Required. Indicates whether this instance is + global runbook. + :type is_global_runbook: bool + :param name: Indicates name of the webhook. + :type name: str + :param service_uri: The URI where webhooks should be sent. + :type service_uri: str + """ + + _validation = { + 'automation_account_id': {'required': True}, + 'runbook_name': {'required': True}, + 'webhook_resource_id': {'required': True}, + 'is_global_runbook': {'required': True}, + } + + _attribute_map = { + 'automation_account_id': {'key': 'automationAccountId', 'type': 'str'}, + 'runbook_name': {'key': 'runbookName', 'type': 'str'}, + 'webhook_resource_id': {'key': 'webhookResourceId', 'type': 'str'}, + 'is_global_runbook': {'key': 'isGlobalRunbook', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + } + + def __init__(self, *, automation_account_id: str, runbook_name: str, webhook_resource_id: str, is_global_runbook: bool, name: str=None, service_uri: str=None, **kwargs) -> None: + super(AutomationRunbookReceiver, self).__init__(**kwargs) + self.automation_account_id = automation_account_id + self.runbook_name = runbook_name + self.webhook_resource_id = webhook_resource_id + self.is_global_runbook = is_global_runbook + self.name = name + self.service_uri = service_uri + + +class AzureAppPushReceiver(Model): + """The Azure mobile App push notification receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the Azure mobile app push receiver. + Names must be unique across all receivers within an action group. + :type name: str + :param email_address: Required. The email address registered for the Azure + mobile app. + :type email_address: str + """ + + _validation = { + 'name': {'required': True}, + 'email_address': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + } + + def __init__(self, *, name: str, email_address: str, **kwargs) -> None: + super(AzureAppPushReceiver, self).__init__(**kwargs) + self.name = name + self.email_address = email_address + + +class AzureFunctionReceiver(Model): + """An azure function receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the azure function receiver. Names must + be unique across all receivers within an action group. + :type name: str + :param function_app_resource_id: Required. The azure resource id of the + function app. + :type function_app_resource_id: str + :param function_name: Required. The function name in the function app. + :type function_name: str + :param http_trigger_url: Required. The http trigger url where http request + sent to. + :type http_trigger_url: str + """ + + _validation = { + 'name': {'required': True}, + 'function_app_resource_id': {'required': True}, + 'function_name': {'required': True}, + 'http_trigger_url': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'function_app_resource_id': {'key': 'functionAppResourceId', 'type': 'str'}, + 'function_name': {'key': 'functionName', 'type': 'str'}, + 'http_trigger_url': {'key': 'httpTriggerUrl', 'type': 'str'}, + } + + def __init__(self, *, name: str, function_app_resource_id: str, function_name: str, http_trigger_url: str, **kwargs) -> None: + super(AzureFunctionReceiver, self).__init__(**kwargs) + self.name = name + self.function_app_resource_id = function_app_resource_id + self.function_name = function_name + self.http_trigger_url = http_trigger_url + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class MultiMetricCriteria(Model): + """The types of conditions for a multi resource alert. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: MetricCriteria, DynamicMetricCriteria + + All required parameters must be populated in order to send to Azure. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param name: Required. Name of the criteria. + :type name: str + :param metric_name: Required. Name of the metric. + :type metric_name: str + :param metric_namespace: Namespace of the metric. + :type metric_namespace: str + :param time_aggregation: Required. the criteria time aggregation types. + :type time_aggregation: object + :param dimensions: List of dimension conditions. + :type dimensions: + list[~azure.mgmt.monitor.v2018_03_01.models.MetricDimension] + :param criterion_type: Required. Constant filled by server. + :type criterion_type: str + """ + + _validation = { + 'name': {'required': True}, + 'metric_name': {'required': True}, + 'time_aggregation': {'required': True}, + 'criterion_type': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'name': {'key': 'name', 'type': 'str'}, + 'metric_name': {'key': 'metricName', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, + 'time_aggregation': {'key': 'timeAggregation', 'type': 'object'}, + 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, + 'criterion_type': {'key': 'criterionType', 'type': 'str'}, + } + + _subtype_map = { + 'criterion_type': {'StaticThresholdCriterion': 'MetricCriteria', 'DynamicThresholdCriterion': 'DynamicMetricCriteria'} + } + + def __init__(self, *, name: str, metric_name: str, time_aggregation, additional_properties=None, metric_namespace: str=None, dimensions=None, **kwargs) -> None: + super(MultiMetricCriteria, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.name = name + self.metric_name = metric_name + self.metric_namespace = metric_namespace + self.time_aggregation = time_aggregation + self.dimensions = dimensions + self.criterion_type = None + + +class DynamicMetricCriteria(MultiMetricCriteria): + """Criterion for dynamic threshold. + + All required parameters must be populated in order to send to Azure. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param name: Required. Name of the criteria. + :type name: str + :param metric_name: Required. Name of the metric. + :type metric_name: str + :param metric_namespace: Namespace of the metric. + :type metric_namespace: str + :param time_aggregation: Required. the criteria time aggregation types. + :type time_aggregation: object + :param dimensions: List of dimension conditions. + :type dimensions: + list[~azure.mgmt.monitor.v2018_03_01.models.MetricDimension] + :param criterion_type: Required. Constant filled by server. + :type criterion_type: str + :param operator: Required. The operator used to compare the metric value + against the threshold. + :type operator: object + :param alert_sensitivity: Required. The extent of deviation required to + trigger an alert. This will affect how tight the threshold is to the + metric series pattern. + :type alert_sensitivity: object + :param failing_periods: Required. The minimum number of violations + required within the selected lookback time window required to raise an + alert. + :type failing_periods: + ~azure.mgmt.monitor.v2018_03_01.models.DynamicThresholdFailingPeriods + :param ignore_data_before: Use this option to set the date from which to + start learning the metric historical data and calculate the dynamic + thresholds (in ISO8601 format) + :type ignore_data_before: datetime + """ + + _validation = { + 'name': {'required': True}, + 'metric_name': {'required': True}, + 'time_aggregation': {'required': True}, + 'criterion_type': {'required': True}, + 'operator': {'required': True}, + 'alert_sensitivity': {'required': True}, + 'failing_periods': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'name': {'key': 'name', 'type': 'str'}, + 'metric_name': {'key': 'metricName', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, + 'time_aggregation': {'key': 'timeAggregation', 'type': 'object'}, + 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, + 'criterion_type': {'key': 'criterionType', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'object'}, + 'alert_sensitivity': {'key': 'alertSensitivity', 'type': 'object'}, + 'failing_periods': {'key': 'failingPeriods', 'type': 'DynamicThresholdFailingPeriods'}, + 'ignore_data_before': {'key': 'ignoreDataBefore', 'type': 'iso-8601'}, + } + + def __init__(self, *, name: str, metric_name: str, time_aggregation, operator, alert_sensitivity, failing_periods, additional_properties=None, metric_namespace: str=None, dimensions=None, ignore_data_before=None, **kwargs) -> None: + super(DynamicMetricCriteria, self).__init__(additional_properties=additional_properties, name=name, metric_name=metric_name, metric_namespace=metric_namespace, time_aggregation=time_aggregation, dimensions=dimensions, **kwargs) + self.operator = operator + self.alert_sensitivity = alert_sensitivity + self.failing_periods = failing_periods + self.ignore_data_before = ignore_data_before + self.criterion_type = 'DynamicThresholdCriterion' + + +class DynamicThresholdFailingPeriods(Model): + """The minimum number of violations required within the selected lookback time + window required to raise an alert. + + All required parameters must be populated in order to send to Azure. + + :param number_of_evaluation_periods: Required. The number of aggregated + lookback points. The lookback time window is calculated based on the + aggregation granularity (windowSize) and the selected number of aggregated + points. + :type number_of_evaluation_periods: float + :param min_failing_periods_to_alert: Required. The number of violations to + trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. + :type min_failing_periods_to_alert: float + """ + + _validation = { + 'number_of_evaluation_periods': {'required': True}, + 'min_failing_periods_to_alert': {'required': True}, + } + + _attribute_map = { + 'number_of_evaluation_periods': {'key': 'numberOfEvaluationPeriods', 'type': 'float'}, + 'min_failing_periods_to_alert': {'key': 'minFailingPeriodsToAlert', 'type': 'float'}, + } + + def __init__(self, *, number_of_evaluation_periods: float, min_failing_periods_to_alert: float, **kwargs) -> None: + super(DynamicThresholdFailingPeriods, self).__init__(**kwargs) + self.number_of_evaluation_periods = number_of_evaluation_periods + self.min_failing_periods_to_alert = min_failing_periods_to_alert + + +class EmailReceiver(Model): + """An email receiver. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the email receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param email_address: Required. The email address of this receiver. + :type email_address: str + :ivar status: The receiver status of the e-mail. Possible values include: + 'NotSpecified', 'Enabled', 'Disabled' + :vartype status: str or + ~azure.mgmt.monitor.v2018_03_01.models.ReceiverStatus + """ + + _validation = { + 'name': {'required': True}, + 'email_address': {'required': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'ReceiverStatus'}, + } + + def __init__(self, *, name: str, email_address: str, **kwargs) -> None: + super(EmailReceiver, self).__init__(**kwargs) + self.name = name + self.email_address = email_address + self.status = None + + +class EnableRequest(Model): + """Describes a receiver that should be resubscribed. + + All required parameters must be populated in order to send to Azure. + + :param receiver_name: Required. The name of the receiver to resubscribe. + :type receiver_name: str + """ + + _validation = { + 'receiver_name': {'required': True}, + } + + _attribute_map = { + 'receiver_name': {'key': 'receiverName', 'type': 'str'}, + } + + def __init__(self, *, receiver_name: str, **kwargs) -> None: + super(EnableRequest, self).__init__(**kwargs) + self.receiver_name = receiver_name + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class ItsmReceiver(Model): + """An Itsm receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the Itsm receiver. Names must be unique + across all receivers within an action group. + :type name: str + :param workspace_id: Required. OMS LA instance identifier. + :type workspace_id: str + :param connection_id: Required. Unique identification of ITSM connection + among multiple defined in above workspace. + :type connection_id: str + :param ticket_configuration: Required. JSON blob for the configurations of + the ITSM action. CreateMultipleWorkItems option will be part of this blob + as well. + :type ticket_configuration: str + :param region: Required. Region in which workspace resides. Supported + values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' + :type region: str + """ + + _validation = { + 'name': {'required': True}, + 'workspace_id': {'required': True}, + 'connection_id': {'required': True}, + 'ticket_configuration': {'required': True}, + 'region': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, + 'connection_id': {'key': 'connectionId', 'type': 'str'}, + 'ticket_configuration': {'key': 'ticketConfiguration', 'type': 'str'}, + 'region': {'key': 'region', 'type': 'str'}, + } + + def __init__(self, *, name: str, workspace_id: str, connection_id: str, ticket_configuration: str, region: str, **kwargs) -> None: + super(ItsmReceiver, self).__init__(**kwargs) + self.name = name + self.workspace_id = workspace_id + self.connection_id = connection_id + self.ticket_configuration = ticket_configuration + self.region = region + + +class LogicAppReceiver(Model): + """A logic app receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the logic app receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param resource_id: Required. The azure resource id of the logic app + receiver. + :type resource_id: str + :param callback_url: Required. The callback url where http request sent + to. + :type callback_url: str + """ + + _validation = { + 'name': {'required': True}, + 'resource_id': {'required': True}, + 'callback_url': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'callback_url': {'key': 'callbackUrl', 'type': 'str'}, + } + + def __init__(self, *, name: str, resource_id: str, callback_url: str, **kwargs) -> None: + super(LogicAppReceiver, self).__init__(**kwargs) + self.name = name + self.resource_id = resource_id + self.callback_url = callback_url + + +class MetricAlertAction(Model): + """An alert action. + + :param action_group_id: the id of the action group to use. + :type action_group_id: str + :param webhook_properties: The properties of a webhook object. + :type webhook_properties: dict[str, str] + """ + + _attribute_map = { + 'action_group_id': {'key': 'actionGroupId', 'type': 'str'}, + 'webhook_properties': {'key': 'webhookProperties', 'type': '{str}'}, + } + + def __init__(self, *, action_group_id: str=None, webhook_properties=None, **kwargs) -> None: + super(MetricAlertAction, self).__init__(**kwargs) + self.action_group_id = action_group_id + self.webhook_properties = webhook_properties + + +class MetricAlertCriteria(Model): + """The rule criteria that defines the conditions of the alert rule. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: MetricAlertSingleResourceMultipleMetricCriteria, + MetricAlertMultipleResourceMultipleMetricCriteria + + All required parameters must be populated in order to send to Azure. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param odatatype: Required. Constant filled by server. + :type odatatype: str + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + } + + _subtype_map = { + 'odatatype': {'Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria': 'MetricAlertSingleResourceMultipleMetricCriteria', 'Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria': 'MetricAlertMultipleResourceMultipleMetricCriteria'} + } + + def __init__(self, *, additional_properties=None, **kwargs) -> None: + super(MetricAlertCriteria, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.odatatype = None + + +class MetricAlertMultipleResourceMultipleMetricCriteria(MetricAlertCriteria): + """Specifies the metric alert criteria for multiple resource that has multiple + metric criteria. + + All required parameters must be populated in order to send to Azure. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param all_of: the list of multiple metric criteria for this 'all of' + operation. + :type all_of: + list[~azure.mgmt.monitor.v2018_03_01.models.MultiMetricCriteria] + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'all_of': {'key': 'allOf', 'type': '[MultiMetricCriteria]'}, + } + + def __init__(self, *, additional_properties=None, all_of=None, **kwargs) -> None: + super(MetricAlertMultipleResourceMultipleMetricCriteria, self).__init__(additional_properties=additional_properties, **kwargs) + self.all_of = all_of + self.odatatype = 'Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria' + + +class MetricAlertResource(Resource): + """The metric alert resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param description: Required. the description of the metric alert that + will be included in the alert email. + :type description: str + :param severity: Required. Alert severity {0, 1, 2, 3, 4} + :type severity: int + :param enabled: Required. the flag that indicates whether the metric alert + is enabled. + :type enabled: bool + :param scopes: the list of resource id's that this metric alert is scoped + to. + :type scopes: list[str] + :param evaluation_frequency: Required. how often the metric alert is + evaluated represented in ISO 8601 duration format. + :type evaluation_frequency: timedelta + :param window_size: Required. the period of time (in ISO 8601 duration + format) that is used to monitor alert activity based on the threshold. + :type window_size: timedelta + :param target_resource_type: the resource type of the target resource(s) + on which the alert is created/updated. Mandatory for + MultipleResourceMultipleMetricCriteria. + :type target_resource_type: str + :param target_resource_region: the region of the target resource(s) on + which the alert is created/updated. Mandatory for + MultipleResourceMultipleMetricCriteria. + :type target_resource_region: str + :param criteria: Required. defines the specific alert criteria + information. + :type criteria: ~azure.mgmt.monitor.v2018_03_01.models.MetricAlertCriteria + :param auto_mitigate: the flag that indicates whether the alert should be + auto resolved or not. + :type auto_mitigate: bool + :param actions: the array of actions that are performed when the alert + rule becomes active, and when an alert condition is resolved. + :type actions: + list[~azure.mgmt.monitor.v2018_03_01.models.MetricAlertAction] + :ivar last_updated_time: Last time the rule was updated in ISO8601 format. + :vartype last_updated_time: datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'description': {'required': True}, + 'severity': {'required': True}, + 'enabled': {'required': True}, + 'evaluation_frequency': {'required': True}, + 'window_size': {'required': True}, + 'criteria': {'required': True}, + 'last_updated_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'severity': {'key': 'properties.severity', 'type': 'int'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, + 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, + 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, + 'target_resource_type': {'key': 'properties.targetResourceType', 'type': 'str'}, + 'target_resource_region': {'key': 'properties.targetResourceRegion', 'type': 'str'}, + 'criteria': {'key': 'properties.criteria', 'type': 'MetricAlertCriteria'}, + 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, + 'actions': {'key': 'properties.actions', 'type': '[MetricAlertAction]'}, + 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + } + + def __init__(self, *, location: str, description: str, severity: int, enabled: bool, evaluation_frequency, window_size, criteria, tags=None, scopes=None, target_resource_type: str=None, target_resource_region: str=None, auto_mitigate: bool=None, actions=None, **kwargs) -> None: + super(MetricAlertResource, self).__init__(location=location, tags=tags, **kwargs) + self.description = description + self.severity = severity + self.enabled = enabled + self.scopes = scopes + self.evaluation_frequency = evaluation_frequency + self.window_size = window_size + self.target_resource_type = target_resource_type + self.target_resource_region = target_resource_region + self.criteria = criteria + self.auto_mitigate = auto_mitigate + self.actions = actions + self.last_updated_time = None + + +class MetricAlertResourcePatch(Model): + """The metric alert resource for patch operations. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param tags: Resource tags + :type tags: dict[str, str] + :param description: Required. the description of the metric alert that + will be included in the alert email. + :type description: str + :param severity: Required. Alert severity {0, 1, 2, 3, 4} + :type severity: int + :param enabled: Required. the flag that indicates whether the metric alert + is enabled. + :type enabled: bool + :param scopes: the list of resource id's that this metric alert is scoped + to. + :type scopes: list[str] + :param evaluation_frequency: Required. how often the metric alert is + evaluated represented in ISO 8601 duration format. + :type evaluation_frequency: timedelta + :param window_size: Required. the period of time (in ISO 8601 duration + format) that is used to monitor alert activity based on the threshold. + :type window_size: timedelta + :param target_resource_type: the resource type of the target resource(s) + on which the alert is created/updated. Mandatory for + MultipleResourceMultipleMetricCriteria. + :type target_resource_type: str + :param target_resource_region: the region of the target resource(s) on + which the alert is created/updated. Mandatory for + MultipleResourceMultipleMetricCriteria. + :type target_resource_region: str + :param criteria: Required. defines the specific alert criteria + information. + :type criteria: ~azure.mgmt.monitor.v2018_03_01.models.MetricAlertCriteria + :param auto_mitigate: the flag that indicates whether the alert should be + auto resolved or not. + :type auto_mitigate: bool + :param actions: the array of actions that are performed when the alert + rule becomes active, and when an alert condition is resolved. + :type actions: + list[~azure.mgmt.monitor.v2018_03_01.models.MetricAlertAction] + :ivar last_updated_time: Last time the rule was updated in ISO8601 format. + :vartype last_updated_time: datetime + """ + + _validation = { + 'description': {'required': True}, + 'severity': {'required': True}, + 'enabled': {'required': True}, + 'evaluation_frequency': {'required': True}, + 'window_size': {'required': True}, + 'criteria': {'required': True}, + 'last_updated_time': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'severity': {'key': 'properties.severity', 'type': 'int'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, + 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, + 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, + 'target_resource_type': {'key': 'properties.targetResourceType', 'type': 'str'}, + 'target_resource_region': {'key': 'properties.targetResourceRegion', 'type': 'str'}, + 'criteria': {'key': 'properties.criteria', 'type': 'MetricAlertCriteria'}, + 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, + 'actions': {'key': 'properties.actions', 'type': '[MetricAlertAction]'}, + 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + } + + def __init__(self, *, description: str, severity: int, enabled: bool, evaluation_frequency, window_size, criteria, tags=None, scopes=None, target_resource_type: str=None, target_resource_region: str=None, auto_mitigate: bool=None, actions=None, **kwargs) -> None: + super(MetricAlertResourcePatch, self).__init__(**kwargs) + self.tags = tags + self.description = description + self.severity = severity + self.enabled = enabled + self.scopes = scopes + self.evaluation_frequency = evaluation_frequency + self.window_size = window_size + self.target_resource_type = target_resource_type + self.target_resource_region = target_resource_region + self.criteria = criteria + self.auto_mitigate = auto_mitigate + self.actions = actions + self.last_updated_time = None + + +class MetricAlertSingleResourceMultipleMetricCriteria(MetricAlertCriteria): + """Specifies the metric alert criteria for a single resource that has multiple + metric criteria. + + All required parameters must be populated in order to send to Azure. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param all_of: The list of metric criteria for this 'all of' operation. + :type all_of: list[~azure.mgmt.monitor.v2018_03_01.models.MetricCriteria] + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'all_of': {'key': 'allOf', 'type': '[MetricCriteria]'}, + } + + def __init__(self, *, additional_properties=None, all_of=None, **kwargs) -> None: + super(MetricAlertSingleResourceMultipleMetricCriteria, self).__init__(additional_properties=additional_properties, **kwargs) + self.all_of = all_of + self.odatatype = 'Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria' + + +class MetricAlertStatus(Model): + """An alert status. + + :param name: The status name. + :type name: str + :param id: The alert rule arm id. + :type id: str + :param type: The extended resource type name. + :type type: str + :param properties: The alert status properties of the metric alert status. + :type properties: + ~azure.mgmt.monitor.v2018_03_01.models.MetricAlertStatusProperties + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'MetricAlertStatusProperties'}, + } + + def __init__(self, *, name: str=None, id: str=None, type: str=None, properties=None, **kwargs) -> None: + super(MetricAlertStatus, self).__init__(**kwargs) + self.name = name + self.id = id + self.type = type + self.properties = properties + + +class MetricAlertStatusCollection(Model): + """Represents a collection of alert rule resources. + + :param value: the values for the alert rule resources. + :type value: + list[~azure.mgmt.monitor.v2018_03_01.models.MetricAlertStatus] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[MetricAlertStatus]'}, + } + + def __init__(self, *, value=None, **kwargs) -> None: + super(MetricAlertStatusCollection, self).__init__(**kwargs) + self.value = value + + +class MetricAlertStatusProperties(Model): + """An alert status properties. + + :param dimensions: An object describing the type of the dimensions. + :type dimensions: dict[str, str] + :param status: status value + :type status: str + :param timestamp: UTC time when the status was checked. + :type timestamp: datetime + """ + + _attribute_map = { + 'dimensions': {'key': 'dimensions', 'type': '{str}'}, + 'status': {'key': 'status', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + } + + def __init__(self, *, dimensions=None, status: str=None, timestamp=None, **kwargs) -> None: + super(MetricAlertStatusProperties, self).__init__(**kwargs) + self.dimensions = dimensions + self.status = status + self.timestamp = timestamp + + +class MetricCriteria(MultiMetricCriteria): + """Criterion to filter metrics. + + All required parameters must be populated in order to send to Azure. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param name: Required. Name of the criteria. + :type name: str + :param metric_name: Required. Name of the metric. + :type metric_name: str + :param metric_namespace: Namespace of the metric. + :type metric_namespace: str + :param time_aggregation: Required. the criteria time aggregation types. + :type time_aggregation: object + :param dimensions: List of dimension conditions. + :type dimensions: + list[~azure.mgmt.monitor.v2018_03_01.models.MetricDimension] + :param criterion_type: Required. Constant filled by server. + :type criterion_type: str + :param operator: Required. the criteria operator. + :type operator: object + :param threshold: Required. the criteria threshold value that activates + the alert. + :type threshold: float + """ + + _validation = { + 'name': {'required': True}, + 'metric_name': {'required': True}, + 'time_aggregation': {'required': True}, + 'criterion_type': {'required': True}, + 'operator': {'required': True}, + 'threshold': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'name': {'key': 'name', 'type': 'str'}, + 'metric_name': {'key': 'metricName', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, + 'time_aggregation': {'key': 'timeAggregation', 'type': 'object'}, + 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, + 'criterion_type': {'key': 'criterionType', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'object'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + } + + def __init__(self, *, name: str, metric_name: str, time_aggregation, operator, threshold: float, additional_properties=None, metric_namespace: str=None, dimensions=None, **kwargs) -> None: + super(MetricCriteria, self).__init__(additional_properties=additional_properties, name=name, metric_name=metric_name, metric_namespace=metric_namespace, time_aggregation=time_aggregation, dimensions=dimensions, **kwargs) + self.operator = operator + self.threshold = threshold + self.criterion_type = 'StaticThresholdCriterion' + + +class MetricDimension(Model): + """Specifies a metric dimension. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the dimension. + :type name: str + :param operator: Required. the dimension operator. Only 'Include' and + 'Exclude' are supported + :type operator: str + :param values: Required. list of dimension values. + :type values: list[str] + """ + + _validation = { + 'name': {'required': True}, + 'operator': {'required': True}, + 'values': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + def __init__(self, *, name: str, operator: str, values, **kwargs) -> None: + super(MetricDimension, self).__init__(**kwargs) + self.name = name + self.operator = operator + self.values = values + + +class SmsReceiver(Model): + """An SMS receiver. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the SMS receiver. Names must be unique + across all receivers within an action group. + :type name: str + :param country_code: Required. The country code of the SMS receiver. + :type country_code: str + :param phone_number: Required. The phone number of the SMS receiver. + :type phone_number: str + :ivar status: The status of the receiver. Possible values include: + 'NotSpecified', 'Enabled', 'Disabled' + :vartype status: str or + ~azure.mgmt.monitor.v2018_03_01.models.ReceiverStatus + """ + + _validation = { + 'name': {'required': True}, + 'country_code': {'required': True}, + 'phone_number': {'required': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'phone_number': {'key': 'phoneNumber', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'ReceiverStatus'}, + } + + def __init__(self, *, name: str, country_code: str, phone_number: str, **kwargs) -> None: + super(SmsReceiver, self).__init__(**kwargs) + self.name = name + self.country_code = country_code + self.phone_number = phone_number + self.status = None + + +class VoiceReceiver(Model): + """A voice receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the voice receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param country_code: Required. The country code of the voice receiver. + :type country_code: str + :param phone_number: Required. The phone number of the voice receiver. + :type phone_number: str + """ + + _validation = { + 'name': {'required': True}, + 'country_code': {'required': True}, + 'phone_number': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'phone_number': {'key': 'phoneNumber', 'type': 'str'}, + } + + def __init__(self, *, name: str, country_code: str, phone_number: str, **kwargs) -> None: + super(VoiceReceiver, self).__init__(**kwargs) + self.name = name + self.country_code = country_code + self.phone_number = phone_number + + +class WebhookReceiver(Model): + """A webhook receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the webhook receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param service_uri: Required. The URI where webhooks should be sent. + :type service_uri: str + """ + + _validation = { + 'name': {'required': True}, + 'service_uri': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + } + + def __init__(self, *, name: str, service_uri: str, **kwargs) -> None: + super(WebhookReceiver, self).__init__(**kwargs) + self.name = name + self.service_uri = service_uri diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_monitor_management_client_enums.py new file mode 100644 index 000000000000..b6d8fd20db3d --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_monitor_management_client_enums.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum + + +class ReceiverStatus(str, Enum): + + not_specified = "NotSpecified" + enabled = "Enabled" + disabled = "Disabled" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_paged_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_paged_models.py new file mode 100644 index 000000000000..134c115ac42e --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_paged_models.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class ActionGroupResourcePaged(Paged): + """ + A paging container for iterating over a list of :class:`ActionGroupResource ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ActionGroupResource]'} + } + + def __init__(self, *args, **kwargs): + + super(ActionGroupResourcePaged, self).__init__(*args, **kwargs) +class MetricAlertResourcePaged(Paged): + """ + A paging container for iterating over a list of :class:`MetricAlertResource ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[MetricAlertResource]'} + } + + def __init__(self, *args, **kwargs): + + super(MetricAlertResourcePaged, self).__init__(*args, **kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/__init__.py new file mode 100644 index 000000000000..7429f2c6210f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/__init__.py @@ -0,0 +1,20 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._action_groups_operations import ActionGroupsOperations +from ._metric_alerts_operations import MetricAlertsOperations +from ._metric_alerts_status_operations import MetricAlertsStatusOperations + +__all__ = [ + 'ActionGroupsOperations', + 'MetricAlertsOperations', + 'MetricAlertsStatusOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_action_groups_operations.py new file mode 100644 index 000000000000..3e21f5d116c7 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_action_groups_operations.py @@ -0,0 +1,488 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class ActionGroupsOperations(object): + """ActionGroupsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2018-03-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-03-01" + + self.config = config + + def create_or_update( + self, resource_group_name, action_group_name, action_group, custom_headers=None, raw=False, **operation_config): + """Create a new action group or update an existing one. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param action_group_name: The name of the action group. + :type action_group_name: str + :param action_group: The action group to create or use for the update. + :type action_group: + ~azure.mgmt.monitor.v2018_03_01.models.ActionGroupResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ActionGroupResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2018_03_01.models.ActionGroupResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(action_group, 'ActionGroupResource') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ActionGroupResource', response) + if response.status_code == 201: + deserialized = self._deserialize('ActionGroupResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} + + def get( + self, resource_group_name, action_group_name, custom_headers=None, raw=False, **operation_config): + """Get an action group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param action_group_name: The name of the action group. + :type action_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ActionGroupResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2018_03_01.models.ActionGroupResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ActionGroupResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} + + def delete( + self, resource_group_name, action_group_name, custom_headers=None, raw=False, **operation_config): + """Delete an action group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param action_group_name: The name of the action group. + :type action_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} + + def update( + self, resource_group_name, action_group_name, tags=None, enabled=True, custom_headers=None, raw=False, **operation_config): + """Updates an existing action group's tags. To update other fields use the + CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param action_group_name: The name of the action group. + :type action_group_name: str + :param tags: Resource tags + :type tags: dict[str, str] + :param enabled: Indicates whether this action group is enabled. If an + action group is not enabled, then none of its actions will be + activated. + :type enabled: bool + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ActionGroupResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2018_03_01.models.ActionGroupResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + action_group_patch = models.ActionGroupPatchBody(tags=tags, enabled=enabled) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(action_group_patch, 'ActionGroupPatchBody') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ActionGroupResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} + + def list_by_subscription_id( + self, custom_headers=None, raw=False, **operation_config): + """Get a list of all action groups in a subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ActionGroupResource + :rtype: + ~azure.mgmt.monitor.v2018_03_01.models.ActionGroupResourcePaged[~azure.mgmt.monitor.v2018_03_01.models.ActionGroupResource] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription_id.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ActionGroupResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Get a list of all action groups in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ActionGroupResource + :rtype: + ~azure.mgmt.monitor.v2018_03_01.models.ActionGroupResourcePaged[~azure.mgmt.monitor.v2018_03_01.models.ActionGroupResource] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ActionGroupResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups'} + + def enable_receiver( + self, resource_group_name, action_group_name, receiver_name, custom_headers=None, raw=False, **operation_config): + """Enable a receiver in an action group. This changes the receiver's + status from Disabled to Enabled. This operation is only supported for + Email or SMS receivers. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param action_group_name: The name of the action group. + :type action_group_name: str + :param receiver_name: The name of the receiver to resubscribe. + :type receiver_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + enable_request = models.EnableRequest(receiver_name=receiver_name) + + # Construct URL + url = self.enable_receiver.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(enable_request, 'EnableRequest') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 409]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + enable_receiver.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_metric_alerts_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_metric_alerts_operations.py new file mode 100644 index 000000000000..7b678d1d203b --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_metric_alerts_operations.py @@ -0,0 +1,420 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class MetricAlertsOperations(object): + """MetricAlertsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2018-03-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-03-01" + + self.config = config + + def list_by_subscription( + self, custom_headers=None, raw=False, **operation_config): + """Retrieve alert rule definitions in a subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of MetricAlertResource + :rtype: + ~azure.mgmt.monitor.v2018_03_01.models.MetricAlertResourcePaged[~azure.mgmt.monitor.v2018_03_01.models.MetricAlertResource] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricAlertResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Retrieve alert rule definitions in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of MetricAlertResource + :rtype: + ~azure.mgmt.monitor.v2018_03_01.models.MetricAlertResourcePaged[~azure.mgmt.monitor.v2018_03_01.models.MetricAlertResource] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MetricAlertResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts'} + + def get( + self, resource_group_name, rule_name, custom_headers=None, raw=False, **operation_config): + """Retrieve an alert rule definition. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: MetricAlertResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2018_03_01.models.MetricAlertResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MetricAlertResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}'} + + def create_or_update( + self, resource_group_name, rule_name, parameters, custom_headers=None, raw=False, **operation_config): + """Create or update an metric alert definition. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param parameters: The parameters of the rule to create or update. + :type parameters: + ~azure.mgmt.monitor.v2018_03_01.models.MetricAlertResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: MetricAlertResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2018_03_01.models.MetricAlertResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'MetricAlertResource') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MetricAlertResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}'} + + def update( + self, resource_group_name, rule_name, parameters, custom_headers=None, raw=False, **operation_config): + """Update an metric alert definition. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param parameters: The parameters of the rule to update. + :type parameters: + ~azure.mgmt.monitor.v2018_03_01.models.MetricAlertResourcePatch + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: MetricAlertResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2018_03_01.models.MetricAlertResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'MetricAlertResourcePatch') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MetricAlertResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}'} + + def delete( + self, resource_group_name, rule_name, custom_headers=None, raw=False, **operation_config): + """Delete an alert rule definition. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_metric_alerts_status_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_metric_alerts_status_operations.py new file mode 100644 index 000000000000..d3b896b86d97 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_metric_alerts_status_operations.py @@ -0,0 +1,164 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class MetricAlertsStatusOperations(object): + """MetricAlertsStatusOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2018-03-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-03-01" + + self.config = config + + def list( + self, resource_group_name, rule_name, custom_headers=None, raw=False, **operation_config): + """Retrieve an alert rule status. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: MetricAlertStatusCollection or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.monitor.v2018_03_01.models.MetricAlertStatusCollection or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MetricAlertStatusCollection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status'} + + def list_by_name( + self, resource_group_name, rule_name, status_name, custom_headers=None, raw=False, **operation_config): + """Retrieve an alert rule status. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param status_name: The name of the status. + :type status_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: MetricAlertStatusCollection or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.monitor.v2018_03_01.models.MetricAlertStatusCollection or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_name.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + 'statusName': self._serialize.url("status_name", status_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MetricAlertStatusCollection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status/{statusName}'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/version.py new file mode 100644 index 000000000000..89036952dd3c --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2018-03-01" + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/__init__.py new file mode 100644 index 000000000000..940dc0469831 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._configuration import MonitorClientConfiguration +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient', 'MonitorClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_configuration.py new file mode 100644 index 000000000000..b3de8cc8b8f3 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_configuration.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 msrestazure import AzureConfiguration + +from .version import VERSION + + +class MonitorClientConfiguration(AzureConfiguration): + """Configuration for MonitorClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription Id. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(MonitorClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-monitor/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_monitor_client.py new file mode 100644 index 000000000000..31ce6d7fa51e --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_monitor_client.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 msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import MonitorClientConfiguration +from .operations import ScheduledQueryRulesOperations +from . import models + + +class MonitorClient(SDKClient): + """Monitor Management Client + + :ivar config: Configuration for client. + :vartype config: MonitorClientConfiguration + + :ivar scheduled_query_rules: ScheduledQueryRules operations + :vartype scheduled_query_rules: azure.mgmt.monitor.v2018_04_16.operations.ScheduledQueryRulesOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription Id. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = MonitorClientConfiguration(credentials, subscription_id, base_url) + super(MonitorClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2018-04-16' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.scheduled_query_rules = ScheduledQueryRulesOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/__init__.py new file mode 100644 index 000000000000..03fc736b99ff --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/__init__.py @@ -0,0 +1,74 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import Action + from ._models_py3 import AlertingAction + from ._models_py3 import AzNsActionGroup + from ._models_py3 import Criteria + from ._models_py3 import Dimension + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import LogMetricTrigger + from ._models_py3 import LogSearchRuleResource + from ._models_py3 import LogSearchRuleResourcePatch + from ._models_py3 import LogToMetricAction + from ._models_py3 import Resource + from ._models_py3 import Schedule + from ._models_py3 import Source + from ._models_py3 import TriggerCondition +except (SyntaxError, ImportError): + from ._models import Action + from ._models import AlertingAction + from ._models import AzNsActionGroup + from ._models import Criteria + from ._models import Dimension + from ._models import ErrorResponse, ErrorResponseException + from ._models import LogMetricTrigger + from ._models import LogSearchRuleResource + from ._models import LogSearchRuleResourcePatch + from ._models import LogToMetricAction + from ._models import Resource + from ._models import Schedule + from ._models import Source + from ._models import TriggerCondition +from ._paged_models import LogSearchRuleResourcePaged +from ._monitor_client_enums import ( + Enabled, + ProvisioningState, + QueryType, + ConditionalOperator, + MetricTriggerType, + AlertSeverity, +) + +__all__ = [ + 'Action', + 'AlertingAction', + 'AzNsActionGroup', + 'Criteria', + 'Dimension', + 'ErrorResponse', 'ErrorResponseException', + 'LogMetricTrigger', + 'LogSearchRuleResource', + 'LogSearchRuleResourcePatch', + 'LogToMetricAction', + 'Resource', + 'Schedule', + 'Source', + 'TriggerCondition', + 'LogSearchRuleResourcePaged', + 'Enabled', + 'ProvisioningState', + 'QueryType', + 'ConditionalOperator', + 'MetricTriggerType', + 'AlertSeverity', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_models.py new file mode 100644 index 000000000000..e0524775a289 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_models.py @@ -0,0 +1,519 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class Action(Model): + """Action descriptor. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AlertingAction, LogToMetricAction + + All required parameters must be populated in order to send to Azure. + + :param odatatype: Required. Constant filled by server. + :type odatatype: str + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + } + + _subtype_map = { + 'odatatype': {'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction': 'AlertingAction', 'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction': 'LogToMetricAction'} + } + + def __init__(self, **kwargs): + super(Action, self).__init__(**kwargs) + self.odatatype = None + + +class AlertingAction(Action): + """Specify action need to be taken when rule type is Alert. + + All required parameters must be populated in order to send to Azure. + + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param severity: Required. Severity of the alert. Possible values include: + '0', '1', '2', '3', '4' + :type severity: str or + ~azure.mgmt.monitor.v2018_04_16.models.AlertSeverity + :param azns_action: Azure action group reference. + :type azns_action: ~azure.mgmt.monitor.v2018_04_16.models.AzNsActionGroup + :param throttling_in_min: time (in minutes) for which Alerts should be + throttled or suppressed. + :type throttling_in_min: int + :param trigger: Required. The trigger condition that results in the alert + rule being. + :type trigger: ~azure.mgmt.monitor.v2018_04_16.models.TriggerCondition + """ + + _validation = { + 'odatatype': {'required': True}, + 'severity': {'required': True}, + 'trigger': {'required': True}, + } + + _attribute_map = { + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'severity': {'key': 'severity', 'type': 'str'}, + 'azns_action': {'key': 'aznsAction', 'type': 'AzNsActionGroup'}, + 'throttling_in_min': {'key': 'throttlingInMin', 'type': 'int'}, + 'trigger': {'key': 'trigger', 'type': 'TriggerCondition'}, + } + + def __init__(self, **kwargs): + super(AlertingAction, self).__init__(**kwargs) + self.severity = kwargs.get('severity', None) + self.azns_action = kwargs.get('azns_action', None) + self.throttling_in_min = kwargs.get('throttling_in_min', None) + self.trigger = kwargs.get('trigger', None) + self.odatatype = 'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction' + + +class AzNsActionGroup(Model): + """Azure action group. + + :param action_group: Azure Action Group reference. + :type action_group: list[str] + :param email_subject: Custom subject override for all email ids in Azure + action group + :type email_subject: str + :param custom_webhook_payload: Custom payload to be sent for all webhook + URI in Azure action group + :type custom_webhook_payload: str + """ + + _attribute_map = { + 'action_group': {'key': 'actionGroup', 'type': '[str]'}, + 'email_subject': {'key': 'emailSubject', 'type': 'str'}, + 'custom_webhook_payload': {'key': 'customWebhookPayload', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AzNsActionGroup, self).__init__(**kwargs) + self.action_group = kwargs.get('action_group', None) + self.email_subject = kwargs.get('email_subject', None) + self.custom_webhook_payload = kwargs.get('custom_webhook_payload', None) + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class Criteria(Model): + """Specifies the criteria for converting log to metric. + + All required parameters must be populated in order to send to Azure. + + :param metric_name: Required. Name of the metric + :type metric_name: str + :param dimensions: List of Dimensions for creating metric + :type dimensions: list[~azure.mgmt.monitor.v2018_04_16.models.Dimension] + """ + + _validation = { + 'metric_name': {'required': True}, + } + + _attribute_map = { + 'metric_name': {'key': 'metricName', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, + } + + def __init__(self, **kwargs): + super(Criteria, self).__init__(**kwargs) + self.metric_name = kwargs.get('metric_name', None) + self.dimensions = kwargs.get('dimensions', None) + + +class Dimension(Model): + """Specifies the criteria for converting log to metric. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the dimension + :type name: str + :ivar operator: Required. Operator for dimension values. Default value: + "Include" . + :vartype operator: str + :param values: Required. List of dimension values + :type values: list[str] + """ + + _validation = { + 'name': {'required': True}, + 'operator': {'required': True, 'constant': True}, + 'values': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + operator = "Include" + + def __init__(self, **kwargs): + super(Dimension, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.values = kwargs.get('values', None) + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class LogMetricTrigger(Model): + """A log metrics trigger descriptor. + + :param threshold_operator: Evaluation operation for Metric -'GreaterThan' + or 'LessThan' or 'Equal'. Possible values include: 'GreaterThan', + 'LessThan', 'Equal' + :type threshold_operator: str or + ~azure.mgmt.monitor.v2018_04_16.models.ConditionalOperator + :param threshold: The threshold of the metric trigger. + :type threshold: float + :param metric_trigger_type: Metric Trigger Type - 'Consecutive' or + 'Total'. Possible values include: 'Consecutive', 'Total' + :type metric_trigger_type: str or + ~azure.mgmt.monitor.v2018_04_16.models.MetricTriggerType + :param metric_column: Evaluation of metric on a particular column + :type metric_column: str + """ + + _attribute_map = { + 'threshold_operator': {'key': 'thresholdOperator', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + 'metric_trigger_type': {'key': 'metricTriggerType', 'type': 'str'}, + 'metric_column': {'key': 'metricColumn', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(LogMetricTrigger, self).__init__(**kwargs) + self.threshold_operator = kwargs.get('threshold_operator', None) + self.threshold = kwargs.get('threshold', None) + self.metric_trigger_type = kwargs.get('metric_trigger_type', None) + self.metric_column = kwargs.get('metric_column', None) + + +class Resource(Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class LogSearchRuleResource(Resource): + """The Log Search Rule resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param description: The description of the Log Search rule. + :type description: str + :param enabled: The flag which indicates whether the Log Search rule is + enabled. Value should be true or false. Possible values include: 'true', + 'false' + :type enabled: str or ~azure.mgmt.monitor.v2018_04_16.models.Enabled + :ivar last_updated_time: Last time the rule was updated in IS08601 format. + :vartype last_updated_time: datetime + :ivar provisioning_state: Provisioning state of the scheduled query rule. + Possible values include: 'Succeeded', 'Deploying', 'Canceled', 'Failed' + :vartype provisioning_state: str or + ~azure.mgmt.monitor.v2018_04_16.models.ProvisioningState + :param source: Required. Data Source against which rule will Query Data + :type source: ~azure.mgmt.monitor.v2018_04_16.models.Source + :param schedule: Schedule (Frequency, Time Window) for rule. Required for + action type - AlertingAction + :type schedule: ~azure.mgmt.monitor.v2018_04_16.models.Schedule + :param action: Required. Action needs to be taken on rule execution. + :type action: ~azure.mgmt.monitor.v2018_04_16.models.Action + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'last_updated_time': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'source': {'required': True}, + 'action': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'enabled': {'key': 'properties.enabled', 'type': 'str'}, + 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': 'Source'}, + 'schedule': {'key': 'properties.schedule', 'type': 'Schedule'}, + 'action': {'key': 'properties.action', 'type': 'Action'}, + } + + def __init__(self, **kwargs): + super(LogSearchRuleResource, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.enabled = kwargs.get('enabled', None) + self.last_updated_time = None + self.provisioning_state = None + self.source = kwargs.get('source', None) + self.schedule = kwargs.get('schedule', None) + self.action = kwargs.get('action', None) + + +class LogSearchRuleResourcePatch(Model): + """The log search rule resource for patch operations. + + :param tags: Resource tags + :type tags: dict[str, str] + :param enabled: The flag which indicates whether the Log Search rule is + enabled. Value should be true or false. Possible values include: 'true', + 'false' + :type enabled: str or ~azure.mgmt.monitor.v2018_04_16.models.Enabled + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'enabled': {'key': 'properties.enabled', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(LogSearchRuleResourcePatch, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.enabled = kwargs.get('enabled', None) + + +class LogToMetricAction(Action): + """Specify action need to be taken when rule type is converting log to metric. + + All required parameters must be populated in order to send to Azure. + + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param criteria: Required. Criteria of Metric + :type criteria: list[~azure.mgmt.monitor.v2018_04_16.models.Criteria] + """ + + _validation = { + 'odatatype': {'required': True}, + 'criteria': {'required': True}, + } + + _attribute_map = { + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'criteria': {'key': 'criteria', 'type': '[Criteria]'}, + } + + def __init__(self, **kwargs): + super(LogToMetricAction, self).__init__(**kwargs) + self.criteria = kwargs.get('criteria', None) + self.odatatype = 'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction' + + +class Schedule(Model): + """Defines how often to run the search and the time interval. + + All required parameters must be populated in order to send to Azure. + + :param frequency_in_minutes: Required. frequency (in minutes) at which + rule condition should be evaluated. + :type frequency_in_minutes: int + :param time_window_in_minutes: Required. Time window for which data needs + to be fetched for query (should be greater than or equal to + frequencyInMinutes). + :type time_window_in_minutes: int + """ + + _validation = { + 'frequency_in_minutes': {'required': True}, + 'time_window_in_minutes': {'required': True}, + } + + _attribute_map = { + 'frequency_in_minutes': {'key': 'frequencyInMinutes', 'type': 'int'}, + 'time_window_in_minutes': {'key': 'timeWindowInMinutes', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(Schedule, self).__init__(**kwargs) + self.frequency_in_minutes = kwargs.get('frequency_in_minutes', None) + self.time_window_in_minutes = kwargs.get('time_window_in_minutes', None) + + +class Source(Model): + """Specifies the log search query. + + All required parameters must be populated in order to send to Azure. + + :param query: Log search query. Required for action type - AlertingAction + :type query: str + :param authorized_resources: List of Resource referred into query + :type authorized_resources: list[str] + :param data_source_id: Required. The resource uri over which log search + query is to be run. + :type data_source_id: str + :param query_type: Set value to 'ResultCount'. Possible values include: + 'ResultCount' + :type query_type: str or ~azure.mgmt.monitor.v2018_04_16.models.QueryType + """ + + _validation = { + 'data_source_id': {'required': True}, + } + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + 'authorized_resources': {'key': 'authorizedResources', 'type': '[str]'}, + 'data_source_id': {'key': 'dataSourceId', 'type': 'str'}, + 'query_type': {'key': 'queryType', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Source, self).__init__(**kwargs) + self.query = kwargs.get('query', None) + self.authorized_resources = kwargs.get('authorized_resources', None) + self.data_source_id = kwargs.get('data_source_id', None) + self.query_type = kwargs.get('query_type', None) + + +class TriggerCondition(Model): + """The condition that results in the Log Search rule. + + All required parameters must be populated in order to send to Azure. + + :param threshold_operator: Required. Evaluation operation for rule - + 'GreaterThan' or 'LessThan. Possible values include: 'GreaterThan', + 'LessThan', 'Equal' + :type threshold_operator: str or + ~azure.mgmt.monitor.v2018_04_16.models.ConditionalOperator + :param threshold: Required. Result or count threshold based on which rule + should be triggered. + :type threshold: float + :param metric_trigger: Trigger condition for metric query rule + :type metric_trigger: + ~azure.mgmt.monitor.v2018_04_16.models.LogMetricTrigger + """ + + _validation = { + 'threshold_operator': {'required': True}, + 'threshold': {'required': True}, + } + + _attribute_map = { + 'threshold_operator': {'key': 'thresholdOperator', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + 'metric_trigger': {'key': 'metricTrigger', 'type': 'LogMetricTrigger'}, + } + + def __init__(self, **kwargs): + super(TriggerCondition, self).__init__(**kwargs) + self.threshold_operator = kwargs.get('threshold_operator', None) + self.threshold = kwargs.get('threshold', None) + self.metric_trigger = kwargs.get('metric_trigger', None) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_models_py3.py new file mode 100644 index 000000000000..2881e1891318 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_models_py3.py @@ -0,0 +1,519 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class Action(Model): + """Action descriptor. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AlertingAction, LogToMetricAction + + All required parameters must be populated in order to send to Azure. + + :param odatatype: Required. Constant filled by server. + :type odatatype: str + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + } + + _subtype_map = { + 'odatatype': {'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction': 'AlertingAction', 'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction': 'LogToMetricAction'} + } + + def __init__(self, **kwargs) -> None: + super(Action, self).__init__(**kwargs) + self.odatatype = None + + +class AlertingAction(Action): + """Specify action need to be taken when rule type is Alert. + + All required parameters must be populated in order to send to Azure. + + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param severity: Required. Severity of the alert. Possible values include: + '0', '1', '2', '3', '4' + :type severity: str or + ~azure.mgmt.monitor.v2018_04_16.models.AlertSeverity + :param azns_action: Azure action group reference. + :type azns_action: ~azure.mgmt.monitor.v2018_04_16.models.AzNsActionGroup + :param throttling_in_min: time (in minutes) for which Alerts should be + throttled or suppressed. + :type throttling_in_min: int + :param trigger: Required. The trigger condition that results in the alert + rule being. + :type trigger: ~azure.mgmt.monitor.v2018_04_16.models.TriggerCondition + """ + + _validation = { + 'odatatype': {'required': True}, + 'severity': {'required': True}, + 'trigger': {'required': True}, + } + + _attribute_map = { + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'severity': {'key': 'severity', 'type': 'str'}, + 'azns_action': {'key': 'aznsAction', 'type': 'AzNsActionGroup'}, + 'throttling_in_min': {'key': 'throttlingInMin', 'type': 'int'}, + 'trigger': {'key': 'trigger', 'type': 'TriggerCondition'}, + } + + def __init__(self, *, severity, trigger, azns_action=None, throttling_in_min: int=None, **kwargs) -> None: + super(AlertingAction, self).__init__(**kwargs) + self.severity = severity + self.azns_action = azns_action + self.throttling_in_min = throttling_in_min + self.trigger = trigger + self.odatatype = 'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction' + + +class AzNsActionGroup(Model): + """Azure action group. + + :param action_group: Azure Action Group reference. + :type action_group: list[str] + :param email_subject: Custom subject override for all email ids in Azure + action group + :type email_subject: str + :param custom_webhook_payload: Custom payload to be sent for all webhook + URI in Azure action group + :type custom_webhook_payload: str + """ + + _attribute_map = { + 'action_group': {'key': 'actionGroup', 'type': '[str]'}, + 'email_subject': {'key': 'emailSubject', 'type': 'str'}, + 'custom_webhook_payload': {'key': 'customWebhookPayload', 'type': 'str'}, + } + + def __init__(self, *, action_group=None, email_subject: str=None, custom_webhook_payload: str=None, **kwargs) -> None: + super(AzNsActionGroup, self).__init__(**kwargs) + self.action_group = action_group + self.email_subject = email_subject + self.custom_webhook_payload = custom_webhook_payload + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class Criteria(Model): + """Specifies the criteria for converting log to metric. + + All required parameters must be populated in order to send to Azure. + + :param metric_name: Required. Name of the metric + :type metric_name: str + :param dimensions: List of Dimensions for creating metric + :type dimensions: list[~azure.mgmt.monitor.v2018_04_16.models.Dimension] + """ + + _validation = { + 'metric_name': {'required': True}, + } + + _attribute_map = { + 'metric_name': {'key': 'metricName', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, + } + + def __init__(self, *, metric_name: str, dimensions=None, **kwargs) -> None: + super(Criteria, self).__init__(**kwargs) + self.metric_name = metric_name + self.dimensions = dimensions + + +class Dimension(Model): + """Specifies the criteria for converting log to metric. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the dimension + :type name: str + :ivar operator: Required. Operator for dimension values. Default value: + "Include" . + :vartype operator: str + :param values: Required. List of dimension values + :type values: list[str] + """ + + _validation = { + 'name': {'required': True}, + 'operator': {'required': True, 'constant': True}, + 'values': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + operator = "Include" + + def __init__(self, *, name: str, values, **kwargs) -> None: + super(Dimension, self).__init__(**kwargs) + self.name = name + self.values = values + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class LogMetricTrigger(Model): + """A log metrics trigger descriptor. + + :param threshold_operator: Evaluation operation for Metric -'GreaterThan' + or 'LessThan' or 'Equal'. Possible values include: 'GreaterThan', + 'LessThan', 'Equal' + :type threshold_operator: str or + ~azure.mgmt.monitor.v2018_04_16.models.ConditionalOperator + :param threshold: The threshold of the metric trigger. + :type threshold: float + :param metric_trigger_type: Metric Trigger Type - 'Consecutive' or + 'Total'. Possible values include: 'Consecutive', 'Total' + :type metric_trigger_type: str or + ~azure.mgmt.monitor.v2018_04_16.models.MetricTriggerType + :param metric_column: Evaluation of metric on a particular column + :type metric_column: str + """ + + _attribute_map = { + 'threshold_operator': {'key': 'thresholdOperator', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + 'metric_trigger_type': {'key': 'metricTriggerType', 'type': 'str'}, + 'metric_column': {'key': 'metricColumn', 'type': 'str'}, + } + + def __init__(self, *, threshold_operator=None, threshold: float=None, metric_trigger_type=None, metric_column: str=None, **kwargs) -> None: + super(LogMetricTrigger, self).__init__(**kwargs) + self.threshold_operator = threshold_operator + self.threshold = threshold + self.metric_trigger_type = metric_trigger_type + self.metric_column = metric_column + + +class Resource(Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, location: str, tags=None, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class LogSearchRuleResource(Resource): + """The Log Search Rule resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param description: The description of the Log Search rule. + :type description: str + :param enabled: The flag which indicates whether the Log Search rule is + enabled. Value should be true or false. Possible values include: 'true', + 'false' + :type enabled: str or ~azure.mgmt.monitor.v2018_04_16.models.Enabled + :ivar last_updated_time: Last time the rule was updated in IS08601 format. + :vartype last_updated_time: datetime + :ivar provisioning_state: Provisioning state of the scheduled query rule. + Possible values include: 'Succeeded', 'Deploying', 'Canceled', 'Failed' + :vartype provisioning_state: str or + ~azure.mgmt.monitor.v2018_04_16.models.ProvisioningState + :param source: Required. Data Source against which rule will Query Data + :type source: ~azure.mgmt.monitor.v2018_04_16.models.Source + :param schedule: Schedule (Frequency, Time Window) for rule. Required for + action type - AlertingAction + :type schedule: ~azure.mgmt.monitor.v2018_04_16.models.Schedule + :param action: Required. Action needs to be taken on rule execution. + :type action: ~azure.mgmt.monitor.v2018_04_16.models.Action + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'last_updated_time': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'source': {'required': True}, + 'action': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'enabled': {'key': 'properties.enabled', 'type': 'str'}, + 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': 'Source'}, + 'schedule': {'key': 'properties.schedule', 'type': 'Schedule'}, + 'action': {'key': 'properties.action', 'type': 'Action'}, + } + + def __init__(self, *, location: str, source, action, tags=None, description: str=None, enabled=None, schedule=None, **kwargs) -> None: + super(LogSearchRuleResource, self).__init__(location=location, tags=tags, **kwargs) + self.description = description + self.enabled = enabled + self.last_updated_time = None + self.provisioning_state = None + self.source = source + self.schedule = schedule + self.action = action + + +class LogSearchRuleResourcePatch(Model): + """The log search rule resource for patch operations. + + :param tags: Resource tags + :type tags: dict[str, str] + :param enabled: The flag which indicates whether the Log Search rule is + enabled. Value should be true or false. Possible values include: 'true', + 'false' + :type enabled: str or ~azure.mgmt.monitor.v2018_04_16.models.Enabled + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'enabled': {'key': 'properties.enabled', 'type': 'str'}, + } + + def __init__(self, *, tags=None, enabled=None, **kwargs) -> None: + super(LogSearchRuleResourcePatch, self).__init__(**kwargs) + self.tags = tags + self.enabled = enabled + + +class LogToMetricAction(Action): + """Specify action need to be taken when rule type is converting log to metric. + + All required parameters must be populated in order to send to Azure. + + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param criteria: Required. Criteria of Metric + :type criteria: list[~azure.mgmt.monitor.v2018_04_16.models.Criteria] + """ + + _validation = { + 'odatatype': {'required': True}, + 'criteria': {'required': True}, + } + + _attribute_map = { + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'criteria': {'key': 'criteria', 'type': '[Criteria]'}, + } + + def __init__(self, *, criteria, **kwargs) -> None: + super(LogToMetricAction, self).__init__(**kwargs) + self.criteria = criteria + self.odatatype = 'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction' + + +class Schedule(Model): + """Defines how often to run the search and the time interval. + + All required parameters must be populated in order to send to Azure. + + :param frequency_in_minutes: Required. frequency (in minutes) at which + rule condition should be evaluated. + :type frequency_in_minutes: int + :param time_window_in_minutes: Required. Time window for which data needs + to be fetched for query (should be greater than or equal to + frequencyInMinutes). + :type time_window_in_minutes: int + """ + + _validation = { + 'frequency_in_minutes': {'required': True}, + 'time_window_in_minutes': {'required': True}, + } + + _attribute_map = { + 'frequency_in_minutes': {'key': 'frequencyInMinutes', 'type': 'int'}, + 'time_window_in_minutes': {'key': 'timeWindowInMinutes', 'type': 'int'}, + } + + def __init__(self, *, frequency_in_minutes: int, time_window_in_minutes: int, **kwargs) -> None: + super(Schedule, self).__init__(**kwargs) + self.frequency_in_minutes = frequency_in_minutes + self.time_window_in_minutes = time_window_in_minutes + + +class Source(Model): + """Specifies the log search query. + + All required parameters must be populated in order to send to Azure. + + :param query: Log search query. Required for action type - AlertingAction + :type query: str + :param authorized_resources: List of Resource referred into query + :type authorized_resources: list[str] + :param data_source_id: Required. The resource uri over which log search + query is to be run. + :type data_source_id: str + :param query_type: Set value to 'ResultCount'. Possible values include: + 'ResultCount' + :type query_type: str or ~azure.mgmt.monitor.v2018_04_16.models.QueryType + """ + + _validation = { + 'data_source_id': {'required': True}, + } + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + 'authorized_resources': {'key': 'authorizedResources', 'type': '[str]'}, + 'data_source_id': {'key': 'dataSourceId', 'type': 'str'}, + 'query_type': {'key': 'queryType', 'type': 'str'}, + } + + def __init__(self, *, data_source_id: str, query: str=None, authorized_resources=None, query_type=None, **kwargs) -> None: + super(Source, self).__init__(**kwargs) + self.query = query + self.authorized_resources = authorized_resources + self.data_source_id = data_source_id + self.query_type = query_type + + +class TriggerCondition(Model): + """The condition that results in the Log Search rule. + + All required parameters must be populated in order to send to Azure. + + :param threshold_operator: Required. Evaluation operation for rule - + 'GreaterThan' or 'LessThan. Possible values include: 'GreaterThan', + 'LessThan', 'Equal' + :type threshold_operator: str or + ~azure.mgmt.monitor.v2018_04_16.models.ConditionalOperator + :param threshold: Required. Result or count threshold based on which rule + should be triggered. + :type threshold: float + :param metric_trigger: Trigger condition for metric query rule + :type metric_trigger: + ~azure.mgmt.monitor.v2018_04_16.models.LogMetricTrigger + """ + + _validation = { + 'threshold_operator': {'required': True}, + 'threshold': {'required': True}, + } + + _attribute_map = { + 'threshold_operator': {'key': 'thresholdOperator', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + 'metric_trigger': {'key': 'metricTrigger', 'type': 'LogMetricTrigger'}, + } + + def __init__(self, *, threshold_operator, threshold: float, metric_trigger=None, **kwargs) -> None: + super(TriggerCondition, self).__init__(**kwargs) + self.threshold_operator = threshold_operator + self.threshold = threshold + self.metric_trigger = metric_trigger diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_monitor_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_monitor_client_enums.py new file mode 100644 index 000000000000..428846ca22af --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_monitor_client_enums.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 enum import Enum + + +class Enabled(str, Enum): + + true = "true" + false = "false" + + +class ProvisioningState(str, Enum): + + succeeded = "Succeeded" + deploying = "Deploying" + canceled = "Canceled" + failed = "Failed" + + +class QueryType(str, Enum): + + result_count = "ResultCount" + + +class ConditionalOperator(str, Enum): + + greater_than = "GreaterThan" + less_than = "LessThan" + equal = "Equal" + + +class MetricTriggerType(str, Enum): + + consecutive = "Consecutive" + total = "Total" + + +class AlertSeverity(str, Enum): + + zero = "0" + one = "1" + two = "2" + three = "3" + four = "4" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_paged_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_paged_models.py new file mode 100644 index 000000000000..e347b6e86c87 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_paged_models.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class LogSearchRuleResourcePaged(Paged): + """ + A paging container for iterating over a list of :class:`LogSearchRuleResource ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[LogSearchRuleResource]'} + } + + def __init__(self, *args, **kwargs): + + super(LogSearchRuleResourcePaged, self).__init__(*args, **kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/operations/__init__.py new file mode 100644 index 000000000000..c8cedc13e4d9 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/operations/__init__.py @@ -0,0 +1,16 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._scheduled_query_rules_operations import ScheduledQueryRulesOperations + +__all__ = [ + 'ScheduledQueryRulesOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/operations/_scheduled_query_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/operations/_scheduled_query_rules_operations.py new file mode 100644 index 000000000000..9ab8672aa79f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/operations/_scheduled_query_rules_operations.py @@ -0,0 +1,437 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class ScheduledQueryRulesOperations(object): + """ScheduledQueryRulesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2018-04-16". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-04-16" + + self.config = config + + def create_or_update( + self, resource_group_name, rule_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates an log search rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param parameters: The parameters of the rule to create or update. + :type parameters: + ~azure.mgmt.monitor.v2018_04_16.models.LogSearchRuleResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: LogSearchRuleResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2018_04_16.models.LogSearchRuleResource + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'LogSearchRuleResource') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('LogSearchRuleResource', response) + if response.status_code == 201: + deserialized = self._deserialize('LogSearchRuleResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}'} + + def get( + self, resource_group_name, rule_name, custom_headers=None, raw=False, **operation_config): + """Gets an Log Search rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: LogSearchRuleResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2018_04_16.models.LogSearchRuleResource + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('LogSearchRuleResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}'} + + def update( + self, resource_group_name, rule_name, tags=None, enabled=None, custom_headers=None, raw=False, **operation_config): + """Update log search Rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param tags: Resource tags + :type tags: dict[str, str] + :param enabled: The flag which indicates whether the Log Search rule + is enabled. Value should be true or false. Possible values include: + 'true', 'false' + :type enabled: str or ~azure.mgmt.monitor.v2018_04_16.models.Enabled + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: LogSearchRuleResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2018_04_16.models.LogSearchRuleResource + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.LogSearchRuleResourcePatch(tags=tags, enabled=enabled) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'LogSearchRuleResourcePatch') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('LogSearchRuleResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}'} + + def delete( + self, resource_group_name, rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes a Log Search rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}'} + + def list_by_subscription( + self, filter=None, custom_headers=None, raw=False, **operation_config): + """List the Log Search rules within a subscription group. + + :param filter: The filter to apply on the operation. For more + information please see + https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of LogSearchRuleResource + :rtype: + ~azure.mgmt.monitor.v2018_04_16.models.LogSearchRuleResourcePaged[~azure.mgmt.monitor.v2018_04_16.models.LogSearchRuleResource] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.LogSearchRuleResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/scheduledQueryRules'} + + def list_by_resource_group( + self, resource_group_name, filter=None, custom_headers=None, raw=False, **operation_config): + """List the Log Search rules within a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param filter: The filter to apply on the operation. For more + information please see + https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of LogSearchRuleResource + :rtype: + ~azure.mgmt.monitor.v2018_04_16.models.LogSearchRuleResourcePaged[~azure.mgmt.monitor.v2018_04_16.models.LogSearchRuleResource] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.LogSearchRuleResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/version.py new file mode 100644 index 000000000000..58e12f8d6135 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2018-04-16" + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/__init__.py new file mode 100644 index 000000000000..8e97360e5ffb --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._configuration import MonitorManagementClientConfiguration +from ._monitor_management_client import MonitorManagementClient +__all__ = ['MonitorManagementClient', 'MonitorManagementClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_configuration.py new file mode 100644 index 000000000000..88436f6b4a33 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_configuration.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 msrestazure import AzureConfiguration + +from .version import VERSION + + +class MonitorManagementClientConfiguration(AzureConfiguration): + """Configuration for MonitorManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription Id. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(MonitorManagementClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-monitor/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_monitor_management_client.py new file mode 100644 index 000000000000..1a47a2ad5de8 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_monitor_management_client.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 msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import MonitorManagementClientConfiguration +from .operations import GuestDiagnosticsSettingsAssociationOperations +from .operations import GuestDiagnosticsSettingsOperations +from . import models + + +class MonitorManagementClient(SDKClient): + """Monitor Management Client + + :ivar config: Configuration for client. + :vartype config: MonitorManagementClientConfiguration + + :ivar guest_diagnostics_settings_association: GuestDiagnosticsSettingsAssociation operations + :vartype guest_diagnostics_settings_association: azure.mgmt.monitor.v2018_06_01_preview.operations.GuestDiagnosticsSettingsAssociationOperations + :ivar guest_diagnostics_settings: GuestDiagnosticsSettings operations + :vartype guest_diagnostics_settings: azure.mgmt.monitor.v2018_06_01_preview.operations.GuestDiagnosticsSettingsOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription Id. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = MonitorManagementClientConfiguration(credentials, subscription_id, base_url) + super(MonitorManagementClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2018-06-01-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.guest_diagnostics_settings_association = GuestDiagnosticsSettingsAssociationOperations( + self._client, self.config, self._serialize, self._deserialize) + self.guest_diagnostics_settings = GuestDiagnosticsSettingsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/__init__.py new file mode 100644 index 000000000000..83a56cc856cf --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/__init__.py @@ -0,0 +1,59 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import DataSource + from ._models_py3 import DataSourceConfiguration + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import EtwEventConfiguration + from ._models_py3 import EtwProviderConfiguration + from ._models_py3 import EventLogConfiguration + from ._models_py3 import GuestDiagnosticSettingsAssociationResource + from ._models_py3 import GuestDiagnosticSettingsAssociationResourcePatch + from ._models_py3 import GuestDiagnosticSettingsPatchResource + from ._models_py3 import GuestDiagnosticSettingsResource + from ._models_py3 import PerformanceCounterConfiguration + from ._models_py3 import Resource + from ._models_py3 import SinkConfiguration +except (SyntaxError, ImportError): + from ._models import DataSource + from ._models import DataSourceConfiguration + from ._models import ErrorResponse, ErrorResponseException + from ._models import EtwEventConfiguration + from ._models import EtwProviderConfiguration + from ._models import EventLogConfiguration + from ._models import GuestDiagnosticSettingsAssociationResource + from ._models import GuestDiagnosticSettingsAssociationResourcePatch + from ._models import GuestDiagnosticSettingsPatchResource + from ._models import GuestDiagnosticSettingsResource + from ._models import PerformanceCounterConfiguration + from ._models import Resource + from ._models import SinkConfiguration +from ._paged_models import GuestDiagnosticSettingsAssociationResourcePaged +from ._paged_models import GuestDiagnosticSettingsResourcePaged + +__all__ = [ + 'DataSource', + 'DataSourceConfiguration', + 'ErrorResponse', 'ErrorResponseException', + 'EtwEventConfiguration', + 'EtwProviderConfiguration', + 'EventLogConfiguration', + 'GuestDiagnosticSettingsAssociationResource', + 'GuestDiagnosticSettingsAssociationResourcePatch', + 'GuestDiagnosticSettingsPatchResource', + 'GuestDiagnosticSettingsResource', + 'PerformanceCounterConfiguration', + 'Resource', + 'SinkConfiguration', + 'GuestDiagnosticSettingsAssociationResourcePaged', + 'GuestDiagnosticSettingsResourcePaged', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/_models.py new file mode 100644 index 000000000000..beefd177ba79 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/_models.py @@ -0,0 +1,456 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class DataSource(Model): + """Data source object contains configuration to collect telemetry and one or + more sinks to send that telemetry data to. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. Datasource kind. Possible values include: + 'PerformanceCounter', 'ETWProviders', 'WindowsEventLogs' + :type kind: str or ~azure.mgmt.monitor.v2018_06_01_preview.models.enum + :param configuration: Required. + :type configuration: + ~azure.mgmt.monitor.v2018_06_01_preview.models.DataSourceConfiguration + :param sinks: Required. + :type sinks: + list[~azure.mgmt.monitor.v2018_06_01_preview.models.SinkConfiguration] + """ + + _validation = { + 'kind': {'required': True}, + 'configuration': {'required': True}, + 'sinks': {'required': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'configuration': {'key': 'configuration', 'type': 'DataSourceConfiguration'}, + 'sinks': {'key': 'sinks', 'type': '[SinkConfiguration]'}, + } + + def __init__(self, **kwargs): + super(DataSource, self).__init__(**kwargs) + self.kind = kwargs.get('kind', None) + self.configuration = kwargs.get('configuration', None) + self.sinks = kwargs.get('sinks', None) + + +class DataSourceConfiguration(Model): + """DataSourceConfiguration. + + :param providers: ETW providers configuration + :type providers: + list[~azure.mgmt.monitor.v2018_06_01_preview.models.EtwProviderConfiguration] + :param perf_counters: Performance counter configuration + :type perf_counters: + list[~azure.mgmt.monitor.v2018_06_01_preview.models.PerformanceCounterConfiguration] + :param event_logs: Windows event logs configuration. + :type event_logs: + list[~azure.mgmt.monitor.v2018_06_01_preview.models.EventLogConfiguration] + """ + + _attribute_map = { + 'providers': {'key': 'providers', 'type': '[EtwProviderConfiguration]'}, + 'perf_counters': {'key': 'perfCounters', 'type': '[PerformanceCounterConfiguration]'}, + 'event_logs': {'key': 'eventLogs', 'type': '[EventLogConfiguration]'}, + } + + def __init__(self, **kwargs): + super(DataSourceConfiguration, self).__init__(**kwargs) + self.providers = kwargs.get('providers', None) + self.perf_counters = kwargs.get('perf_counters', None) + self.event_logs = kwargs.get('event_logs', None) + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class EtwEventConfiguration(Model): + """EtwEventConfiguration. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. + :type name: str + :param id: Required. + :type id: int + :param filter: + :type filter: str + """ + + _validation = { + 'name': {'required': True}, + 'id': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'int'}, + 'filter': {'key': 'filter', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(EtwEventConfiguration, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.id = kwargs.get('id', None) + self.filter = kwargs.get('filter', None) + + +class EtwProviderConfiguration(Model): + """EtwProviderConfiguration. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. + :type id: str + :param events: Required. + :type events: + list[~azure.mgmt.monitor.v2018_06_01_preview.models.EtwEventConfiguration] + """ + + _validation = { + 'id': {'required': True}, + 'events': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'events': {'key': 'events', 'type': '[EtwEventConfiguration]'}, + } + + def __init__(self, **kwargs): + super(EtwProviderConfiguration, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.events = kwargs.get('events', None) + + +class EventLogConfiguration(Model): + """EventLogConfiguration. + + All required parameters must be populated in order to send to Azure. + + :param log_name: Required. + :type log_name: str + :param filter: + :type filter: str + """ + + _validation = { + 'log_name': {'required': True}, + } + + _attribute_map = { + 'log_name': {'key': 'logName', 'type': 'str'}, + 'filter': {'key': 'filter', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(EventLogConfiguration, self).__init__(**kwargs) + self.log_name = kwargs.get('log_name', None) + self.filter = kwargs.get('filter', None) + + +class Resource(Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class GuestDiagnosticSettingsAssociationResource(Resource): + """Virtual machine guest diagnostic settings resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param guest_diagnostic_settings_name: Required. The guest diagnostic + settings name. + :type guest_diagnostic_settings_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'guest_diagnostic_settings_name': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'guest_diagnostic_settings_name': {'key': 'properties.guestDiagnosticSettingsName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(GuestDiagnosticSettingsAssociationResource, self).__init__(**kwargs) + self.guest_diagnostic_settings_name = kwargs.get('guest_diagnostic_settings_name', None) + + +class GuestDiagnosticSettingsAssociationResourcePatch(Model): + """Guest diagnostic setting resource for patch operations. + + All required parameters must be populated in order to send to Azure. + + :param tags: Resource tags + :type tags: dict[str, str] + :param guest_diagnostic_settings_name: Required. The guest diagnostic + settings name. + :type guest_diagnostic_settings_name: str + """ + + _validation = { + 'guest_diagnostic_settings_name': {'required': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'guest_diagnostic_settings_name': {'key': 'properties.guestDiagnosticSettingsName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(GuestDiagnosticSettingsAssociationResourcePatch, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.guest_diagnostic_settings_name = kwargs.get('guest_diagnostic_settings_name', None) + + +class GuestDiagnosticSettingsPatchResource(Model): + """An diagnostic settings object for the body of patch operations. + + :param tags: Resource tags + :type tags: dict[str, str] + :param os_type: Operating system type for the configuration. Possible + values include: 'Windows', 'Linux' + :type os_type: str or ~azure.mgmt.monitor.v2018_06_01_preview.models.enum + :param data_sources: the array of data source object which are configured + to collect and send data + :type data_sources: + list[~azure.mgmt.monitor.v2018_06_01_preview.models.DataSource] + :param proxy_setting: + :type proxy_setting: str + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'os_type': {'key': 'properties.osType', 'type': 'str'}, + 'data_sources': {'key': 'properties.dataSources', 'type': '[DataSource]'}, + 'proxy_setting': {'key': 'properties.proxySetting', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(GuestDiagnosticSettingsPatchResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.os_type = kwargs.get('os_type', None) + self.data_sources = kwargs.get('data_sources', None) + self.proxy_setting = kwargs.get('proxy_setting', None) + + +class GuestDiagnosticSettingsResource(Resource): + """Virtual machine guest diagnostics settings resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param os_type: Operating system type for the configuration. Possible + values include: 'Windows', 'Linux' + :type os_type: str or ~azure.mgmt.monitor.v2018_06_01_preview.models.enum + :param data_sources: the array of data source object which are configured + to collect and send data + :type data_sources: + list[~azure.mgmt.monitor.v2018_06_01_preview.models.DataSource] + :param proxy_setting: + :type proxy_setting: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'os_type': {'key': 'properties.osType', 'type': 'str'}, + 'data_sources': {'key': 'properties.dataSources', 'type': '[DataSource]'}, + 'proxy_setting': {'key': 'properties.proxySetting', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(GuestDiagnosticSettingsResource, self).__init__(**kwargs) + self.os_type = kwargs.get('os_type', None) + self.data_sources = kwargs.get('data_sources', None) + self.proxy_setting = kwargs.get('proxy_setting', None) + + +class PerformanceCounterConfiguration(Model): + """PerformanceCounterConfiguration. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. + :type name: str + :param sampling_period: Required. + :type sampling_period: str + :param instance: + :type instance: str + """ + + _validation = { + 'name': {'required': True}, + 'sampling_period': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'sampling_period': {'key': 'samplingPeriod', 'type': 'str'}, + 'instance': {'key': 'instance', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PerformanceCounterConfiguration, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.sampling_period = kwargs.get('sampling_period', None) + self.instance = kwargs.get('instance', None) + + +class SinkConfiguration(Model): + """SinkConfiguration. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. Possible values include: 'EventHub', + 'ApplicationInsights', 'LogAnalytics' + :type kind: str or ~azure.mgmt.monitor.v2018_06_01_preview.models.enum + """ + + _validation = { + 'kind': {'required': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SinkConfiguration, self).__init__(**kwargs) + self.kind = kwargs.get('kind', None) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/_models_py3.py new file mode 100644 index 000000000000..581b4dc3504b --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/_models_py3.py @@ -0,0 +1,456 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class DataSource(Model): + """Data source object contains configuration to collect telemetry and one or + more sinks to send that telemetry data to. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. Datasource kind. Possible values include: + 'PerformanceCounter', 'ETWProviders', 'WindowsEventLogs' + :type kind: str or ~azure.mgmt.monitor.v2018_06_01_preview.models.enum + :param configuration: Required. + :type configuration: + ~azure.mgmt.monitor.v2018_06_01_preview.models.DataSourceConfiguration + :param sinks: Required. + :type sinks: + list[~azure.mgmt.monitor.v2018_06_01_preview.models.SinkConfiguration] + """ + + _validation = { + 'kind': {'required': True}, + 'configuration': {'required': True}, + 'sinks': {'required': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'configuration': {'key': 'configuration', 'type': 'DataSourceConfiguration'}, + 'sinks': {'key': 'sinks', 'type': '[SinkConfiguration]'}, + } + + def __init__(self, *, kind, configuration, sinks, **kwargs) -> None: + super(DataSource, self).__init__(**kwargs) + self.kind = kind + self.configuration = configuration + self.sinks = sinks + + +class DataSourceConfiguration(Model): + """DataSourceConfiguration. + + :param providers: ETW providers configuration + :type providers: + list[~azure.mgmt.monitor.v2018_06_01_preview.models.EtwProviderConfiguration] + :param perf_counters: Performance counter configuration + :type perf_counters: + list[~azure.mgmt.monitor.v2018_06_01_preview.models.PerformanceCounterConfiguration] + :param event_logs: Windows event logs configuration. + :type event_logs: + list[~azure.mgmt.monitor.v2018_06_01_preview.models.EventLogConfiguration] + """ + + _attribute_map = { + 'providers': {'key': 'providers', 'type': '[EtwProviderConfiguration]'}, + 'perf_counters': {'key': 'perfCounters', 'type': '[PerformanceCounterConfiguration]'}, + 'event_logs': {'key': 'eventLogs', 'type': '[EventLogConfiguration]'}, + } + + def __init__(self, *, providers=None, perf_counters=None, event_logs=None, **kwargs) -> None: + super(DataSourceConfiguration, self).__init__(**kwargs) + self.providers = providers + self.perf_counters = perf_counters + self.event_logs = event_logs + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class EtwEventConfiguration(Model): + """EtwEventConfiguration. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. + :type name: str + :param id: Required. + :type id: int + :param filter: + :type filter: str + """ + + _validation = { + 'name': {'required': True}, + 'id': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'int'}, + 'filter': {'key': 'filter', 'type': 'str'}, + } + + def __init__(self, *, name: str, id: int, filter: str=None, **kwargs) -> None: + super(EtwEventConfiguration, self).__init__(**kwargs) + self.name = name + self.id = id + self.filter = filter + + +class EtwProviderConfiguration(Model): + """EtwProviderConfiguration. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. + :type id: str + :param events: Required. + :type events: + list[~azure.mgmt.monitor.v2018_06_01_preview.models.EtwEventConfiguration] + """ + + _validation = { + 'id': {'required': True}, + 'events': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'events': {'key': 'events', 'type': '[EtwEventConfiguration]'}, + } + + def __init__(self, *, id: str, events, **kwargs) -> None: + super(EtwProviderConfiguration, self).__init__(**kwargs) + self.id = id + self.events = events + + +class EventLogConfiguration(Model): + """EventLogConfiguration. + + All required parameters must be populated in order to send to Azure. + + :param log_name: Required. + :type log_name: str + :param filter: + :type filter: str + """ + + _validation = { + 'log_name': {'required': True}, + } + + _attribute_map = { + 'log_name': {'key': 'logName', 'type': 'str'}, + 'filter': {'key': 'filter', 'type': 'str'}, + } + + def __init__(self, *, log_name: str, filter: str=None, **kwargs) -> None: + super(EventLogConfiguration, self).__init__(**kwargs) + self.log_name = log_name + self.filter = filter + + +class Resource(Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, location: str, tags=None, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class GuestDiagnosticSettingsAssociationResource(Resource): + """Virtual machine guest diagnostic settings resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param guest_diagnostic_settings_name: Required. The guest diagnostic + settings name. + :type guest_diagnostic_settings_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'guest_diagnostic_settings_name': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'guest_diagnostic_settings_name': {'key': 'properties.guestDiagnosticSettingsName', 'type': 'str'}, + } + + def __init__(self, *, location: str, guest_diagnostic_settings_name: str, tags=None, **kwargs) -> None: + super(GuestDiagnosticSettingsAssociationResource, self).__init__(location=location, tags=tags, **kwargs) + self.guest_diagnostic_settings_name = guest_diagnostic_settings_name + + +class GuestDiagnosticSettingsAssociationResourcePatch(Model): + """Guest diagnostic setting resource for patch operations. + + All required parameters must be populated in order to send to Azure. + + :param tags: Resource tags + :type tags: dict[str, str] + :param guest_diagnostic_settings_name: Required. The guest diagnostic + settings name. + :type guest_diagnostic_settings_name: str + """ + + _validation = { + 'guest_diagnostic_settings_name': {'required': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'guest_diagnostic_settings_name': {'key': 'properties.guestDiagnosticSettingsName', 'type': 'str'}, + } + + def __init__(self, *, guest_diagnostic_settings_name: str, tags=None, **kwargs) -> None: + super(GuestDiagnosticSettingsAssociationResourcePatch, self).__init__(**kwargs) + self.tags = tags + self.guest_diagnostic_settings_name = guest_diagnostic_settings_name + + +class GuestDiagnosticSettingsPatchResource(Model): + """An diagnostic settings object for the body of patch operations. + + :param tags: Resource tags + :type tags: dict[str, str] + :param os_type: Operating system type for the configuration. Possible + values include: 'Windows', 'Linux' + :type os_type: str or ~azure.mgmt.monitor.v2018_06_01_preview.models.enum + :param data_sources: the array of data source object which are configured + to collect and send data + :type data_sources: + list[~azure.mgmt.monitor.v2018_06_01_preview.models.DataSource] + :param proxy_setting: + :type proxy_setting: str + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'os_type': {'key': 'properties.osType', 'type': 'str'}, + 'data_sources': {'key': 'properties.dataSources', 'type': '[DataSource]'}, + 'proxy_setting': {'key': 'properties.proxySetting', 'type': 'str'}, + } + + def __init__(self, *, tags=None, os_type=None, data_sources=None, proxy_setting: str=None, **kwargs) -> None: + super(GuestDiagnosticSettingsPatchResource, self).__init__(**kwargs) + self.tags = tags + self.os_type = os_type + self.data_sources = data_sources + self.proxy_setting = proxy_setting + + +class GuestDiagnosticSettingsResource(Resource): + """Virtual machine guest diagnostics settings resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param os_type: Operating system type for the configuration. Possible + values include: 'Windows', 'Linux' + :type os_type: str or ~azure.mgmt.monitor.v2018_06_01_preview.models.enum + :param data_sources: the array of data source object which are configured + to collect and send data + :type data_sources: + list[~azure.mgmt.monitor.v2018_06_01_preview.models.DataSource] + :param proxy_setting: + :type proxy_setting: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'os_type': {'key': 'properties.osType', 'type': 'str'}, + 'data_sources': {'key': 'properties.dataSources', 'type': '[DataSource]'}, + 'proxy_setting': {'key': 'properties.proxySetting', 'type': 'str'}, + } + + def __init__(self, *, location: str, tags=None, os_type=None, data_sources=None, proxy_setting: str=None, **kwargs) -> None: + super(GuestDiagnosticSettingsResource, self).__init__(location=location, tags=tags, **kwargs) + self.os_type = os_type + self.data_sources = data_sources + self.proxy_setting = proxy_setting + + +class PerformanceCounterConfiguration(Model): + """PerformanceCounterConfiguration. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. + :type name: str + :param sampling_period: Required. + :type sampling_period: str + :param instance: + :type instance: str + """ + + _validation = { + 'name': {'required': True}, + 'sampling_period': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'sampling_period': {'key': 'samplingPeriod', 'type': 'str'}, + 'instance': {'key': 'instance', 'type': 'str'}, + } + + def __init__(self, *, name: str, sampling_period: str, instance: str=None, **kwargs) -> None: + super(PerformanceCounterConfiguration, self).__init__(**kwargs) + self.name = name + self.sampling_period = sampling_period + self.instance = instance + + +class SinkConfiguration(Model): + """SinkConfiguration. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. Possible values include: 'EventHub', + 'ApplicationInsights', 'LogAnalytics' + :type kind: str or ~azure.mgmt.monitor.v2018_06_01_preview.models.enum + """ + + _validation = { + 'kind': {'required': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__(self, *, kind, **kwargs) -> None: + super(SinkConfiguration, self).__init__(**kwargs) + self.kind = kind diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/_paged_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/_paged_models.py new file mode 100644 index 000000000000..06bfc58882e4 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/_paged_models.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class GuestDiagnosticSettingsAssociationResourcePaged(Paged): + """ + A paging container for iterating over a list of :class:`GuestDiagnosticSettingsAssociationResource ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[GuestDiagnosticSettingsAssociationResource]'} + } + + def __init__(self, *args, **kwargs): + + super(GuestDiagnosticSettingsAssociationResourcePaged, self).__init__(*args, **kwargs) +class GuestDiagnosticSettingsResourcePaged(Paged): + """ + A paging container for iterating over a list of :class:`GuestDiagnosticSettingsResource ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[GuestDiagnosticSettingsResource]'} + } + + def __init__(self, *args, **kwargs): + + super(GuestDiagnosticSettingsResourcePaged, self).__init__(*args, **kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/operations/__init__.py new file mode 100644 index 000000000000..c58a5b65fb0b --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/operations/__init__.py @@ -0,0 +1,18 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._guest_diagnostics_settings_association_operations import GuestDiagnosticsSettingsAssociationOperations +from ._guest_diagnostics_settings_operations import GuestDiagnosticsSettingsOperations + +__all__ = [ + 'GuestDiagnosticsSettingsAssociationOperations', + 'GuestDiagnosticsSettingsOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/operations/_guest_diagnostics_settings_association_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/operations/_guest_diagnostics_settings_association_operations.py new file mode 100644 index 000000000000..ed782032cad4 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/operations/_guest_diagnostics_settings_association_operations.py @@ -0,0 +1,440 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class GuestDiagnosticsSettingsAssociationOperations(object): + """GuestDiagnosticsSettingsAssociationOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2018-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-06-01-preview" + + self.config = config + + def create_or_update( + self, resource_uri, association_name, diagnostic_settings_association, custom_headers=None, raw=False, **operation_config): + """Creates or updates guest diagnostics settings association. + + :param resource_uri: The fully qualified ID of the resource, including + the resource name and resource type. + :type resource_uri: str + :param association_name: The name of the diagnostic settings + association. + :type association_name: str + :param diagnostic_settings_association: The diagnostic settings + association to create or update. + :type diagnostic_settings_association: + ~azure.mgmt.monitor.v2018_06_01_preview.models.GuestDiagnosticSettingsAssociationResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: GuestDiagnosticSettingsAssociationResource or + ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.monitor.v2018_06_01_preview.models.GuestDiagnosticSettingsAssociationResource + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), + 'associationName': self._serialize.url("association_name", association_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(diagnostic_settings_association, 'GuestDiagnosticSettingsAssociationResource') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GuestDiagnosticSettingsAssociationResource', response) + if response.status_code == 201: + deserialized = self._deserialize('GuestDiagnosticSettingsAssociationResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}'} + + def get( + self, resource_uri, association_name, custom_headers=None, raw=False, **operation_config): + """Gets guest diagnostics association settings. + + :param resource_uri: The fully qualified ID of the resource, including + the resource name and resource type. + :type resource_uri: str + :param association_name: The name of the diagnostic settings + association. + :type association_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: GuestDiagnosticSettingsAssociationResource or + ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.monitor.v2018_06_01_preview.models.GuestDiagnosticSettingsAssociationResource + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), + 'associationName': self._serialize.url("association_name", association_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GuestDiagnosticSettingsAssociationResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}'} + + def delete( + self, resource_uri, association_name, custom_headers=None, raw=False, **operation_config): + """Delete guest diagnostics association settings. + + :param resource_uri: The fully qualified ID of the resource, including + the resource name and resource type. + :type resource_uri: str + :param association_name: The name of the diagnostic settings + association. + :type association_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), + 'associationName': self._serialize.url("association_name", association_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}'} + + def update( + self, resource_uri, association_name, guest_diagnostic_settings_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Updates an existing guestDiagnosticsSettingsAssociation Resource. To + update other fields use the CreateOrUpdate method. + + :param resource_uri: The fully qualified ID of the resource, including + the resource name and resource type. + :type resource_uri: str + :param association_name: The name of the diagnostic settings + association. + :type association_name: str + :param guest_diagnostic_settings_name: The guest diagnostic settings + name. + :type guest_diagnostic_settings_name: str + :param tags: Resource tags + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: GuestDiagnosticSettingsAssociationResource or + ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.monitor.v2018_06_01_preview.models.GuestDiagnosticSettingsAssociationResource + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.GuestDiagnosticSettingsAssociationResourcePatch(tags=tags, guest_diagnostic_settings_name=guest_diagnostic_settings_name) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), + 'associationName': self._serialize.url("association_name", association_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'GuestDiagnosticSettingsAssociationResourcePatch') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GuestDiagnosticSettingsAssociationResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}'} + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Get a list of all guest diagnostic settings association in a + subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of + GuestDiagnosticSettingsAssociationResource + :rtype: + ~azure.mgmt.monitor.v2018_06_01_preview.models.GuestDiagnosticSettingsAssociationResourcePaged[~azure.mgmt.monitor.v2018_06_01_preview.models.GuestDiagnosticSettingsAssociationResource] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.GuestDiagnosticSettingsAssociationResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/guestDiagnosticSettingsAssociations'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Get a list of all guest diagnostic settings association in a resource + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of + GuestDiagnosticSettingsAssociationResource + :rtype: + ~azure.mgmt.monitor.v2018_06_01_preview.models.GuestDiagnosticSettingsAssociationResourcePaged[~azure.mgmt.monitor.v2018_06_01_preview.models.GuestDiagnosticSettingsAssociationResource] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.GuestDiagnosticSettingsAssociationResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettingsAssociations'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/operations/_guest_diagnostics_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/operations/_guest_diagnostics_settings_operations.py new file mode 100644 index 000000000000..9459f09a7614 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/operations/_guest_diagnostics_settings_operations.py @@ -0,0 +1,428 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class GuestDiagnosticsSettingsOperations(object): + """GuestDiagnosticsSettingsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2018-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-06-01-preview" + + self.config = config + + def create_or_update( + self, resource_group_name, diagnostic_settings_name, diagnostic_settings, custom_headers=None, raw=False, **operation_config): + """Creates or updates guest diagnostics settings. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param diagnostic_settings_name: The name of the diagnostic setting. + :type diagnostic_settings_name: str + :param diagnostic_settings: The configuration to create or update. + :type diagnostic_settings: + ~azure.mgmt.monitor.v2018_06_01_preview.models.GuestDiagnosticSettingsResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: GuestDiagnosticSettingsResource or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.monitor.v2018_06_01_preview.models.GuestDiagnosticSettingsResource + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'diagnosticSettingsName': self._serialize.url("diagnostic_settings_name", diagnostic_settings_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(diagnostic_settings, 'GuestDiagnosticSettingsResource') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GuestDiagnosticSettingsResource', response) + if response.status_code == 201: + deserialized = self._deserialize('GuestDiagnosticSettingsResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}'} + + def get( + self, resource_group_name, diagnostic_settings_name, custom_headers=None, raw=False, **operation_config): + """Gets guest diagnostics settings. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param diagnostic_settings_name: The name of the diagnostic setting. + :type diagnostic_settings_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: GuestDiagnosticSettingsResource or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.monitor.v2018_06_01_preview.models.GuestDiagnosticSettingsResource + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'diagnosticSettingsName': self._serialize.url("diagnostic_settings_name", diagnostic_settings_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GuestDiagnosticSettingsResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}'} + + def update( + self, resource_group_name, diagnostic_settings_name, parameters, custom_headers=None, raw=False, **operation_config): + """Updates guest diagnostics settings. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param diagnostic_settings_name: The name of the diagnostic setting. + :type diagnostic_settings_name: str + :param parameters: The configuration to patch. + :type parameters: + ~azure.mgmt.monitor.v2018_06_01_preview.models.GuestDiagnosticSettingsPatchResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: GuestDiagnosticSettingsResource or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.monitor.v2018_06_01_preview.models.GuestDiagnosticSettingsResource + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'diagnosticSettingsName': self._serialize.url("diagnostic_settings_name", diagnostic_settings_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'GuestDiagnosticSettingsPatchResource') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GuestDiagnosticSettingsResource', response) + if response.status_code == 201: + deserialized = self._deserialize('GuestDiagnosticSettingsResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}'} + + def delete( + self, resource_group_name, diagnostic_settings_name, custom_headers=None, raw=False, **operation_config): + """Delete guest diagnostics settings. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param diagnostic_settings_name: The name of the diagnostic setting. + :type diagnostic_settings_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'diagnosticSettingsName': self._serialize.url("diagnostic_settings_name", diagnostic_settings_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}'} + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Get a list of all guest diagnostic settings in a subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of GuestDiagnosticSettingsResource + :rtype: + ~azure.mgmt.monitor.v2018_06_01_preview.models.GuestDiagnosticSettingsResourcePaged[~azure.mgmt.monitor.v2018_06_01_preview.models.GuestDiagnosticSettingsResource] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.GuestDiagnosticSettingsResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/guestDiagnosticSettings'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Get a list of all guest diagnostic settings in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of GuestDiagnosticSettingsResource + :rtype: + ~azure.mgmt.monitor.v2018_06_01_preview.models.GuestDiagnosticSettingsResourcePaged[~azure.mgmt.monitor.v2018_06_01_preview.models.GuestDiagnosticSettingsResource] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.GuestDiagnosticSettingsResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/version.py new file mode 100644 index 000000000000..fcb31ad1686d --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2018-06-01-preview" + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/__init__.py new file mode 100644 index 000000000000..8e97360e5ffb --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._configuration import MonitorManagementClientConfiguration +from ._monitor_management_client import MonitorManagementClient +__all__ = ['MonitorManagementClient', 'MonitorManagementClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_configuration.py new file mode 100644 index 000000000000..88436f6b4a33 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_configuration.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 msrestazure import AzureConfiguration + +from .version import VERSION + + +class MonitorManagementClientConfiguration(AzureConfiguration): + """Configuration for MonitorManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription Id. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(MonitorManagementClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-monitor/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_monitor_management_client.py new file mode 100644 index 000000000000..75792fe6bec7 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_monitor_management_client.py @@ -0,0 +1,59 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import MonitorManagementClientConfiguration +from .operations import ActionGroupsOperations +from .operations import MetricBaselineOperations +from .operations import BaselineOperations +from . import models + + +class MonitorManagementClient(SDKClient): + """Monitor Management Client + + :ivar config: Configuration for client. + :vartype config: MonitorManagementClientConfiguration + + :ivar action_groups: ActionGroups operations + :vartype action_groups: azure.mgmt.monitor.v2018_09_01.operations.ActionGroupsOperations + :ivar metric_baseline: MetricBaseline operations + :vartype metric_baseline: azure.mgmt.monitor.v2018_09_01.operations.MetricBaselineOperations + :ivar baseline: Baseline operations + :vartype baseline: azure.mgmt.monitor.v2018_09_01.operations.BaselineOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription Id. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = MonitorManagementClientConfiguration(credentials, subscription_id, base_url) + super(MonitorManagementClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2018-09-01' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.action_groups = ActionGroupsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.metric_baseline = MetricBaselineOperations( + self._client, self.config, self._serialize, self._deserialize) + self.baseline = BaselineOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/__init__.py new file mode 100644 index 000000000000..d33d357e3f5c --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/__init__.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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import ActionGroupPatchBody + from ._models_py3 import ActionGroupResource + from ._models_py3 import ArmRoleReceiver + from ._models_py3 import AutomationRunbookReceiver + from ._models_py3 import AzureAppPushReceiver + from ._models_py3 import AzureFunctionReceiver + from ._models_py3 import Baseline + from ._models_py3 import BaselineMetadataValue + from ._models_py3 import BaselineResponse + from ._models_py3 import CalculateBaselineResponse + from ._models_py3 import EmailReceiver + from ._models_py3 import EnableRequest + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import ItsmReceiver + from ._models_py3 import LocalizableString + from ._models_py3 import LogicAppReceiver + from ._models_py3 import Resource + from ._models_py3 import SmsReceiver + from ._models_py3 import TimeSeriesInformation + from ._models_py3 import VoiceReceiver + from ._models_py3 import WebhookReceiver +except (SyntaxError, ImportError): + from ._models import ActionGroupPatchBody + from ._models import ActionGroupResource + from ._models import ArmRoleReceiver + from ._models import AutomationRunbookReceiver + from ._models import AzureAppPushReceiver + from ._models import AzureFunctionReceiver + from ._models import Baseline + from ._models import BaselineMetadataValue + from ._models import BaselineResponse + from ._models import CalculateBaselineResponse + from ._models import EmailReceiver + from ._models import EnableRequest + from ._models import ErrorResponse, ErrorResponseException + from ._models import ItsmReceiver + from ._models import LocalizableString + from ._models import LogicAppReceiver + from ._models import Resource + from ._models import SmsReceiver + from ._models import TimeSeriesInformation + from ._models import VoiceReceiver + from ._models import WebhookReceiver +from ._paged_models import ActionGroupResourcePaged +from ._monitor_management_client_enums import ( + ReceiverStatus, + Sensitivity, + ResultType, +) + +__all__ = [ + 'ActionGroupPatchBody', + 'ActionGroupResource', + 'ArmRoleReceiver', + 'AutomationRunbookReceiver', + 'AzureAppPushReceiver', + 'AzureFunctionReceiver', + 'Baseline', + 'BaselineMetadataValue', + 'BaselineResponse', + 'CalculateBaselineResponse', + 'EmailReceiver', + 'EnableRequest', + 'ErrorResponse', 'ErrorResponseException', + 'ItsmReceiver', + 'LocalizableString', + 'LogicAppReceiver', + 'Resource', + 'SmsReceiver', + 'TimeSeriesInformation', + 'VoiceReceiver', + 'WebhookReceiver', + 'ActionGroupResourcePaged', + 'ReceiverStatus', + 'Sensitivity', + 'ResultType', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_models.py new file mode 100644 index 000000000000..fbfd1b5ac7d6 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_models.py @@ -0,0 +1,831 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ActionGroupPatchBody(Model): + """An action group object for the body of patch operations. + + :param tags: Resource tags + :type tags: dict[str, str] + :param enabled: Indicates whether this action group is enabled. If an + action group is not enabled, then none of its actions will be activated. + Default value: True . + :type enabled: bool + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(ActionGroupPatchBody, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.enabled = kwargs.get('enabled', True) + + +class Resource(Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class ActionGroupResource(Resource): + """An action group resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param group_short_name: Required. The short name of the action group. + This will be used in SMS messages. + :type group_short_name: str + :param enabled: Required. Indicates whether this action group is enabled. + If an action group is not enabled, then none of its receivers will receive + communications. Default value: True . + :type enabled: bool + :param email_receivers: The list of email receivers that are part of this + action group. + :type email_receivers: + list[~azure.mgmt.monitor.v2018_09_01.models.EmailReceiver] + :param sms_receivers: The list of SMS receivers that are part of this + action group. + :type sms_receivers: + list[~azure.mgmt.monitor.v2018_09_01.models.SmsReceiver] + :param webhook_receivers: The list of webhook receivers that are part of + this action group. + :type webhook_receivers: + list[~azure.mgmt.monitor.v2018_09_01.models.WebhookReceiver] + :param itsm_receivers: The list of ITSM receivers that are part of this + action group. + :type itsm_receivers: + list[~azure.mgmt.monitor.v2018_09_01.models.ItsmReceiver] + :param azure_app_push_receivers: The list of AzureAppPush receivers that + are part of this action group. + :type azure_app_push_receivers: + list[~azure.mgmt.monitor.v2018_09_01.models.AzureAppPushReceiver] + :param automation_runbook_receivers: The list of AutomationRunbook + receivers that are part of this action group. + :type automation_runbook_receivers: + list[~azure.mgmt.monitor.v2018_09_01.models.AutomationRunbookReceiver] + :param voice_receivers: The list of voice receivers that are part of this + action group. + :type voice_receivers: + list[~azure.mgmt.monitor.v2018_09_01.models.VoiceReceiver] + :param logic_app_receivers: The list of logic app receivers that are part + of this action group. + :type logic_app_receivers: + list[~azure.mgmt.monitor.v2018_09_01.models.LogicAppReceiver] + :param azure_function_receivers: The list of azure function receivers that + are part of this action group. + :type azure_function_receivers: + list[~azure.mgmt.monitor.v2018_09_01.models.AzureFunctionReceiver] + :param arm_role_receivers: The list of ARM role receivers that are part of + this action group. Roles are Azure RBAC roles and only built-in roles are + supported. + :type arm_role_receivers: + list[~azure.mgmt.monitor.v2018_09_01.models.ArmRoleReceiver] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'group_short_name': {'required': True, 'max_length': 12}, + 'enabled': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'group_short_name': {'key': 'properties.groupShortName', 'type': 'str'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'email_receivers': {'key': 'properties.emailReceivers', 'type': '[EmailReceiver]'}, + 'sms_receivers': {'key': 'properties.smsReceivers', 'type': '[SmsReceiver]'}, + 'webhook_receivers': {'key': 'properties.webhookReceivers', 'type': '[WebhookReceiver]'}, + 'itsm_receivers': {'key': 'properties.itsmReceivers', 'type': '[ItsmReceiver]'}, + 'azure_app_push_receivers': {'key': 'properties.azureAppPushReceivers', 'type': '[AzureAppPushReceiver]'}, + 'automation_runbook_receivers': {'key': 'properties.automationRunbookReceivers', 'type': '[AutomationRunbookReceiver]'}, + 'voice_receivers': {'key': 'properties.voiceReceivers', 'type': '[VoiceReceiver]'}, + 'logic_app_receivers': {'key': 'properties.logicAppReceivers', 'type': '[LogicAppReceiver]'}, + 'azure_function_receivers': {'key': 'properties.azureFunctionReceivers', 'type': '[AzureFunctionReceiver]'}, + 'arm_role_receivers': {'key': 'properties.armRoleReceivers', 'type': '[ArmRoleReceiver]'}, + } + + def __init__(self, **kwargs): + super(ActionGroupResource, self).__init__(**kwargs) + self.group_short_name = kwargs.get('group_short_name', None) + self.enabled = kwargs.get('enabled', True) + self.email_receivers = kwargs.get('email_receivers', None) + self.sms_receivers = kwargs.get('sms_receivers', None) + self.webhook_receivers = kwargs.get('webhook_receivers', None) + self.itsm_receivers = kwargs.get('itsm_receivers', None) + self.azure_app_push_receivers = kwargs.get('azure_app_push_receivers', None) + self.automation_runbook_receivers = kwargs.get('automation_runbook_receivers', None) + self.voice_receivers = kwargs.get('voice_receivers', None) + self.logic_app_receivers = kwargs.get('logic_app_receivers', None) + self.azure_function_receivers = kwargs.get('azure_function_receivers', None) + self.arm_role_receivers = kwargs.get('arm_role_receivers', None) + + +class ArmRoleReceiver(Model): + """An arm role receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the arm role receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param role_id: Required. The arm role id. + :type role_id: str + """ + + _validation = { + 'name': {'required': True}, + 'role_id': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'role_id': {'key': 'roleId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ArmRoleReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.role_id = kwargs.get('role_id', None) + + +class AutomationRunbookReceiver(Model): + """The Azure Automation Runbook notification receiver. + + All required parameters must be populated in order to send to Azure. + + :param automation_account_id: Required. The Azure automation account Id + which holds this runbook and authenticate to Azure resource. + :type automation_account_id: str + :param runbook_name: Required. The name for this runbook. + :type runbook_name: str + :param webhook_resource_id: Required. The resource id for webhook linked + to this runbook. + :type webhook_resource_id: str + :param is_global_runbook: Required. Indicates whether this instance is + global runbook. + :type is_global_runbook: bool + :param name: Indicates name of the webhook. + :type name: str + :param service_uri: The URI where webhooks should be sent. + :type service_uri: str + """ + + _validation = { + 'automation_account_id': {'required': True}, + 'runbook_name': {'required': True}, + 'webhook_resource_id': {'required': True}, + 'is_global_runbook': {'required': True}, + } + + _attribute_map = { + 'automation_account_id': {'key': 'automationAccountId', 'type': 'str'}, + 'runbook_name': {'key': 'runbookName', 'type': 'str'}, + 'webhook_resource_id': {'key': 'webhookResourceId', 'type': 'str'}, + 'is_global_runbook': {'key': 'isGlobalRunbook', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AutomationRunbookReceiver, self).__init__(**kwargs) + self.automation_account_id = kwargs.get('automation_account_id', None) + self.runbook_name = kwargs.get('runbook_name', None) + self.webhook_resource_id = kwargs.get('webhook_resource_id', None) + self.is_global_runbook = kwargs.get('is_global_runbook', None) + self.name = kwargs.get('name', None) + self.service_uri = kwargs.get('service_uri', None) + + +class AzureAppPushReceiver(Model): + """The Azure mobile App push notification receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the Azure mobile app push receiver. + Names must be unique across all receivers within an action group. + :type name: str + :param email_address: Required. The email address registered for the Azure + mobile app. + :type email_address: str + """ + + _validation = { + 'name': {'required': True}, + 'email_address': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AzureAppPushReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.email_address = kwargs.get('email_address', None) + + +class AzureFunctionReceiver(Model): + """An azure function receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the azure function receiver. Names must + be unique across all receivers within an action group. + :type name: str + :param function_app_resource_id: Required. The azure resource id of the + function app. + :type function_app_resource_id: str + :param function_name: Required. The function name in the function app. + :type function_name: str + :param http_trigger_url: Required. The http trigger url where http request + sent to. + :type http_trigger_url: str + """ + + _validation = { + 'name': {'required': True}, + 'function_app_resource_id': {'required': True}, + 'function_name': {'required': True}, + 'http_trigger_url': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'function_app_resource_id': {'key': 'functionAppResourceId', 'type': 'str'}, + 'function_name': {'key': 'functionName', 'type': 'str'}, + 'http_trigger_url': {'key': 'httpTriggerUrl', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AzureFunctionReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.function_app_resource_id = kwargs.get('function_app_resource_id', None) + self.function_name = kwargs.get('function_name', None) + self.http_trigger_url = kwargs.get('http_trigger_url', None) + + +class Baseline(Model): + """The baseline values for a single sensitivity value. + + All required parameters must be populated in order to send to Azure. + + :param sensitivity: Required. The sensitivity of the baseline. Possible + values include: 'Low', 'Medium', 'High' + :type sensitivity: str or + ~azure.mgmt.monitor.v2018_09_01.models.Sensitivity + :param low_thresholds: Required. The low thresholds of the baseline. + :type low_thresholds: list[float] + :param high_thresholds: Required. The high thresholds of the baseline. + :type high_thresholds: list[float] + """ + + _validation = { + 'sensitivity': {'required': True}, + 'low_thresholds': {'required': True}, + 'high_thresholds': {'required': True}, + } + + _attribute_map = { + 'sensitivity': {'key': 'sensitivity', 'type': 'Sensitivity'}, + 'low_thresholds': {'key': 'lowThresholds', 'type': '[float]'}, + 'high_thresholds': {'key': 'highThresholds', 'type': '[float]'}, + } + + def __init__(self, **kwargs): + super(Baseline, self).__init__(**kwargs) + self.sensitivity = kwargs.get('sensitivity', None) + self.low_thresholds = kwargs.get('low_thresholds', None) + self.high_thresholds = kwargs.get('high_thresholds', None) + + +class BaselineMetadataValue(Model): + """Represents a baseline metadata value. + + :param name: The name of the metadata. + :type name: ~azure.mgmt.monitor.v2018_09_01.models.LocalizableString + :param value: The value of the metadata. + :type value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(BaselineMetadataValue, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.value = kwargs.get('value', None) + + +class BaselineResponse(Model): + """The response to a baseline query. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The metric baseline ID. + :vartype id: str + :ivar type: The resource type of the baseline resource. + :vartype type: str + :ivar name: The name and the display name of the metric, i.e. it is + localizable string. + :vartype name: ~azure.mgmt.monitor.v2018_09_01.models.LocalizableString + :param timespan: The timespan for which the data was retrieved. Its value + consists of two datetimes concatenated, separated by '/'. This may be + adjusted in the future and returned back from what was originally + requested. + :type timespan: str + :param interval: The interval (window size) for which the metric data was + returned in. This may be adjusted in the future and returned back from + what was originally requested. This is not present if a metadata request + was made. + :type interval: timedelta + :param aggregation: The aggregation type of the metric. + :type aggregation: str + :param timestamps: The array of timestamps of the baselines. + :type timestamps: list[datetime] + :param baseline: The baseline values for each sensitivity. + :type baseline: list[~azure.mgmt.monitor.v2018_09_01.models.Baseline] + :param metadata: The baseline metadata values. + :type metadata: + list[~azure.mgmt.monitor.v2018_09_01.models.BaselineMetadataValue] + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'timespan': {'key': 'properties.timespan', 'type': 'str'}, + 'interval': {'key': 'properties.interval', 'type': 'duration'}, + 'aggregation': {'key': 'properties.aggregation', 'type': 'str'}, + 'timestamps': {'key': 'properties.timestamps', 'type': '[iso-8601]'}, + 'baseline': {'key': 'properties.baseline', 'type': '[Baseline]'}, + 'metadata': {'key': 'properties.metadata', 'type': '[BaselineMetadataValue]'}, + } + + def __init__(self, **kwargs): + super(BaselineResponse, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.timespan = kwargs.get('timespan', None) + self.interval = kwargs.get('interval', None) + self.aggregation = kwargs.get('aggregation', None) + self.timestamps = kwargs.get('timestamps', None) + self.baseline = kwargs.get('baseline', None) + self.metadata = kwargs.get('metadata', None) + + +class CalculateBaselineResponse(Model): + """The response to a calculate baseline call. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The resource type of the baseline resource. + :type type: str + :param timestamps: The array of timestamps of the baselines. + :type timestamps: list[datetime] + :param baseline: Required. The baseline values for each sensitivity. + :type baseline: list[~azure.mgmt.monitor.v2018_09_01.models.Baseline] + """ + + _validation = { + 'type': {'required': True}, + 'baseline': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, + 'baseline': {'key': 'baseline', 'type': '[Baseline]'}, + } + + def __init__(self, **kwargs): + super(CalculateBaselineResponse, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.timestamps = kwargs.get('timestamps', None) + self.baseline = kwargs.get('baseline', None) + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class EmailReceiver(Model): + """An email receiver. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the email receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param email_address: Required. The email address of this receiver. + :type email_address: str + :ivar status: The receiver status of the e-mail. Possible values include: + 'NotSpecified', 'Enabled', 'Disabled' + :vartype status: str or + ~azure.mgmt.monitor.v2018_09_01.models.ReceiverStatus + """ + + _validation = { + 'name': {'required': True}, + 'email_address': {'required': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'ReceiverStatus'}, + } + + def __init__(self, **kwargs): + super(EmailReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.email_address = kwargs.get('email_address', None) + self.status = None + + +class EnableRequest(Model): + """Describes a receiver that should be resubscribed. + + All required parameters must be populated in order to send to Azure. + + :param receiver_name: Required. The name of the receiver to resubscribe. + :type receiver_name: str + """ + + _validation = { + 'receiver_name': {'required': True}, + } + + _attribute_map = { + 'receiver_name': {'key': 'receiverName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(EnableRequest, self).__init__(**kwargs) + self.receiver_name = kwargs.get('receiver_name', None) + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class ItsmReceiver(Model): + """An Itsm receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the Itsm receiver. Names must be unique + across all receivers within an action group. + :type name: str + :param workspace_id: Required. OMS LA instance identifier. + :type workspace_id: str + :param connection_id: Required. Unique identification of ITSM connection + among multiple defined in above workspace. + :type connection_id: str + :param ticket_configuration: Required. JSON blob for the configurations of + the ITSM action. CreateMultipleWorkItems option will be part of this blob + as well. + :type ticket_configuration: str + :param region: Required. Region in which workspace resides. Supported + values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' + :type region: str + """ + + _validation = { + 'name': {'required': True}, + 'workspace_id': {'required': True}, + 'connection_id': {'required': True}, + 'ticket_configuration': {'required': True}, + 'region': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, + 'connection_id': {'key': 'connectionId', 'type': 'str'}, + 'ticket_configuration': {'key': 'ticketConfiguration', 'type': 'str'}, + 'region': {'key': 'region', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ItsmReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.workspace_id = kwargs.get('workspace_id', None) + self.connection_id = kwargs.get('connection_id', None) + self.ticket_configuration = kwargs.get('ticket_configuration', None) + self.region = kwargs.get('region', None) + + +class LocalizableString(Model): + """The localizable string class. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. The invariant value. + :type value: str + :param localized_value: The locale specific value. + :type localized_value: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(LocalizableString, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.localized_value = kwargs.get('localized_value', None) + + +class LogicAppReceiver(Model): + """A logic app receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the logic app receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param resource_id: Required. The azure resource id of the logic app + receiver. + :type resource_id: str + :param callback_url: Required. The callback url where http request sent + to. + :type callback_url: str + """ + + _validation = { + 'name': {'required': True}, + 'resource_id': {'required': True}, + 'callback_url': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'callback_url': {'key': 'callbackUrl', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(LogicAppReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.resource_id = kwargs.get('resource_id', None) + self.callback_url = kwargs.get('callback_url', None) + + +class SmsReceiver(Model): + """An SMS receiver. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the SMS receiver. Names must be unique + across all receivers within an action group. + :type name: str + :param country_code: Required. The country code of the SMS receiver. + :type country_code: str + :param phone_number: Required. The phone number of the SMS receiver. + :type phone_number: str + :ivar status: The status of the receiver. Possible values include: + 'NotSpecified', 'Enabled', 'Disabled' + :vartype status: str or + ~azure.mgmt.monitor.v2018_09_01.models.ReceiverStatus + """ + + _validation = { + 'name': {'required': True}, + 'country_code': {'required': True}, + 'phone_number': {'required': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'phone_number': {'key': 'phoneNumber', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'ReceiverStatus'}, + } + + def __init__(self, **kwargs): + super(SmsReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.country_code = kwargs.get('country_code', None) + self.phone_number = kwargs.get('phone_number', None) + self.status = None + + +class TimeSeriesInformation(Model): + """The time series info needed for calculating the baseline. + + All required parameters must be populated in order to send to Azure. + + :param sensitivities: Required. The list of sensitivities for calculating + the baseline. + :type sensitivities: list[str] + :param values: Required. The metric values to calculate the baseline. + :type values: list[float] + :param timestamps: The array of timestamps of the baselines. + :type timestamps: list[datetime] + """ + + _validation = { + 'sensitivities': {'required': True}, + 'values': {'required': True}, + } + + _attribute_map = { + 'sensitivities': {'key': 'sensitivities', 'type': '[str]'}, + 'values': {'key': 'values', 'type': '[float]'}, + 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, + } + + def __init__(self, **kwargs): + super(TimeSeriesInformation, self).__init__(**kwargs) + self.sensitivities = kwargs.get('sensitivities', None) + self.values = kwargs.get('values', None) + self.timestamps = kwargs.get('timestamps', None) + + +class VoiceReceiver(Model): + """A voice receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the voice receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param country_code: Required. The country code of the voice receiver. + :type country_code: str + :param phone_number: Required. The phone number of the voice receiver. + :type phone_number: str + """ + + _validation = { + 'name': {'required': True}, + 'country_code': {'required': True}, + 'phone_number': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'phone_number': {'key': 'phoneNumber', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(VoiceReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.country_code = kwargs.get('country_code', None) + self.phone_number = kwargs.get('phone_number', None) + + +class WebhookReceiver(Model): + """A webhook receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the webhook receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param service_uri: Required. The URI where webhooks should be sent. + :type service_uri: str + """ + + _validation = { + 'name': {'required': True}, + 'service_uri': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(WebhookReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.service_uri = kwargs.get('service_uri', None) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_models_py3.py new file mode 100644 index 000000000000..bb659cd2432e --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_models_py3.py @@ -0,0 +1,831 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ActionGroupPatchBody(Model): + """An action group object for the body of patch operations. + + :param tags: Resource tags + :type tags: dict[str, str] + :param enabled: Indicates whether this action group is enabled. If an + action group is not enabled, then none of its actions will be activated. + Default value: True . + :type enabled: bool + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + } + + def __init__(self, *, tags=None, enabled: bool=True, **kwargs) -> None: + super(ActionGroupPatchBody, self).__init__(**kwargs) + self.tags = tags + self.enabled = enabled + + +class Resource(Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, location: str, tags=None, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class ActionGroupResource(Resource): + """An action group resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param group_short_name: Required. The short name of the action group. + This will be used in SMS messages. + :type group_short_name: str + :param enabled: Required. Indicates whether this action group is enabled. + If an action group is not enabled, then none of its receivers will receive + communications. Default value: True . + :type enabled: bool + :param email_receivers: The list of email receivers that are part of this + action group. + :type email_receivers: + list[~azure.mgmt.monitor.v2018_09_01.models.EmailReceiver] + :param sms_receivers: The list of SMS receivers that are part of this + action group. + :type sms_receivers: + list[~azure.mgmt.monitor.v2018_09_01.models.SmsReceiver] + :param webhook_receivers: The list of webhook receivers that are part of + this action group. + :type webhook_receivers: + list[~azure.mgmt.monitor.v2018_09_01.models.WebhookReceiver] + :param itsm_receivers: The list of ITSM receivers that are part of this + action group. + :type itsm_receivers: + list[~azure.mgmt.monitor.v2018_09_01.models.ItsmReceiver] + :param azure_app_push_receivers: The list of AzureAppPush receivers that + are part of this action group. + :type azure_app_push_receivers: + list[~azure.mgmt.monitor.v2018_09_01.models.AzureAppPushReceiver] + :param automation_runbook_receivers: The list of AutomationRunbook + receivers that are part of this action group. + :type automation_runbook_receivers: + list[~azure.mgmt.monitor.v2018_09_01.models.AutomationRunbookReceiver] + :param voice_receivers: The list of voice receivers that are part of this + action group. + :type voice_receivers: + list[~azure.mgmt.monitor.v2018_09_01.models.VoiceReceiver] + :param logic_app_receivers: The list of logic app receivers that are part + of this action group. + :type logic_app_receivers: + list[~azure.mgmt.monitor.v2018_09_01.models.LogicAppReceiver] + :param azure_function_receivers: The list of azure function receivers that + are part of this action group. + :type azure_function_receivers: + list[~azure.mgmt.monitor.v2018_09_01.models.AzureFunctionReceiver] + :param arm_role_receivers: The list of ARM role receivers that are part of + this action group. Roles are Azure RBAC roles and only built-in roles are + supported. + :type arm_role_receivers: + list[~azure.mgmt.monitor.v2018_09_01.models.ArmRoleReceiver] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'group_short_name': {'required': True, 'max_length': 12}, + 'enabled': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'group_short_name': {'key': 'properties.groupShortName', 'type': 'str'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'email_receivers': {'key': 'properties.emailReceivers', 'type': '[EmailReceiver]'}, + 'sms_receivers': {'key': 'properties.smsReceivers', 'type': '[SmsReceiver]'}, + 'webhook_receivers': {'key': 'properties.webhookReceivers', 'type': '[WebhookReceiver]'}, + 'itsm_receivers': {'key': 'properties.itsmReceivers', 'type': '[ItsmReceiver]'}, + 'azure_app_push_receivers': {'key': 'properties.azureAppPushReceivers', 'type': '[AzureAppPushReceiver]'}, + 'automation_runbook_receivers': {'key': 'properties.automationRunbookReceivers', 'type': '[AutomationRunbookReceiver]'}, + 'voice_receivers': {'key': 'properties.voiceReceivers', 'type': '[VoiceReceiver]'}, + 'logic_app_receivers': {'key': 'properties.logicAppReceivers', 'type': '[LogicAppReceiver]'}, + 'azure_function_receivers': {'key': 'properties.azureFunctionReceivers', 'type': '[AzureFunctionReceiver]'}, + 'arm_role_receivers': {'key': 'properties.armRoleReceivers', 'type': '[ArmRoleReceiver]'}, + } + + def __init__(self, *, location: str, group_short_name: str, tags=None, enabled: bool=True, email_receivers=None, sms_receivers=None, webhook_receivers=None, itsm_receivers=None, azure_app_push_receivers=None, automation_runbook_receivers=None, voice_receivers=None, logic_app_receivers=None, azure_function_receivers=None, arm_role_receivers=None, **kwargs) -> None: + super(ActionGroupResource, self).__init__(location=location, tags=tags, **kwargs) + self.group_short_name = group_short_name + self.enabled = enabled + self.email_receivers = email_receivers + self.sms_receivers = sms_receivers + self.webhook_receivers = webhook_receivers + self.itsm_receivers = itsm_receivers + self.azure_app_push_receivers = azure_app_push_receivers + self.automation_runbook_receivers = automation_runbook_receivers + self.voice_receivers = voice_receivers + self.logic_app_receivers = logic_app_receivers + self.azure_function_receivers = azure_function_receivers + self.arm_role_receivers = arm_role_receivers + + +class ArmRoleReceiver(Model): + """An arm role receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the arm role receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param role_id: Required. The arm role id. + :type role_id: str + """ + + _validation = { + 'name': {'required': True}, + 'role_id': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'role_id': {'key': 'roleId', 'type': 'str'}, + } + + def __init__(self, *, name: str, role_id: str, **kwargs) -> None: + super(ArmRoleReceiver, self).__init__(**kwargs) + self.name = name + self.role_id = role_id + + +class AutomationRunbookReceiver(Model): + """The Azure Automation Runbook notification receiver. + + All required parameters must be populated in order to send to Azure. + + :param automation_account_id: Required. The Azure automation account Id + which holds this runbook and authenticate to Azure resource. + :type automation_account_id: str + :param runbook_name: Required. The name for this runbook. + :type runbook_name: str + :param webhook_resource_id: Required. The resource id for webhook linked + to this runbook. + :type webhook_resource_id: str + :param is_global_runbook: Required. Indicates whether this instance is + global runbook. + :type is_global_runbook: bool + :param name: Indicates name of the webhook. + :type name: str + :param service_uri: The URI where webhooks should be sent. + :type service_uri: str + """ + + _validation = { + 'automation_account_id': {'required': True}, + 'runbook_name': {'required': True}, + 'webhook_resource_id': {'required': True}, + 'is_global_runbook': {'required': True}, + } + + _attribute_map = { + 'automation_account_id': {'key': 'automationAccountId', 'type': 'str'}, + 'runbook_name': {'key': 'runbookName', 'type': 'str'}, + 'webhook_resource_id': {'key': 'webhookResourceId', 'type': 'str'}, + 'is_global_runbook': {'key': 'isGlobalRunbook', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + } + + def __init__(self, *, automation_account_id: str, runbook_name: str, webhook_resource_id: str, is_global_runbook: bool, name: str=None, service_uri: str=None, **kwargs) -> None: + super(AutomationRunbookReceiver, self).__init__(**kwargs) + self.automation_account_id = automation_account_id + self.runbook_name = runbook_name + self.webhook_resource_id = webhook_resource_id + self.is_global_runbook = is_global_runbook + self.name = name + self.service_uri = service_uri + + +class AzureAppPushReceiver(Model): + """The Azure mobile App push notification receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the Azure mobile app push receiver. + Names must be unique across all receivers within an action group. + :type name: str + :param email_address: Required. The email address registered for the Azure + mobile app. + :type email_address: str + """ + + _validation = { + 'name': {'required': True}, + 'email_address': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + } + + def __init__(self, *, name: str, email_address: str, **kwargs) -> None: + super(AzureAppPushReceiver, self).__init__(**kwargs) + self.name = name + self.email_address = email_address + + +class AzureFunctionReceiver(Model): + """An azure function receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the azure function receiver. Names must + be unique across all receivers within an action group. + :type name: str + :param function_app_resource_id: Required. The azure resource id of the + function app. + :type function_app_resource_id: str + :param function_name: Required. The function name in the function app. + :type function_name: str + :param http_trigger_url: Required. The http trigger url where http request + sent to. + :type http_trigger_url: str + """ + + _validation = { + 'name': {'required': True}, + 'function_app_resource_id': {'required': True}, + 'function_name': {'required': True}, + 'http_trigger_url': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'function_app_resource_id': {'key': 'functionAppResourceId', 'type': 'str'}, + 'function_name': {'key': 'functionName', 'type': 'str'}, + 'http_trigger_url': {'key': 'httpTriggerUrl', 'type': 'str'}, + } + + def __init__(self, *, name: str, function_app_resource_id: str, function_name: str, http_trigger_url: str, **kwargs) -> None: + super(AzureFunctionReceiver, self).__init__(**kwargs) + self.name = name + self.function_app_resource_id = function_app_resource_id + self.function_name = function_name + self.http_trigger_url = http_trigger_url + + +class Baseline(Model): + """The baseline values for a single sensitivity value. + + All required parameters must be populated in order to send to Azure. + + :param sensitivity: Required. The sensitivity of the baseline. Possible + values include: 'Low', 'Medium', 'High' + :type sensitivity: str or + ~azure.mgmt.monitor.v2018_09_01.models.Sensitivity + :param low_thresholds: Required. The low thresholds of the baseline. + :type low_thresholds: list[float] + :param high_thresholds: Required. The high thresholds of the baseline. + :type high_thresholds: list[float] + """ + + _validation = { + 'sensitivity': {'required': True}, + 'low_thresholds': {'required': True}, + 'high_thresholds': {'required': True}, + } + + _attribute_map = { + 'sensitivity': {'key': 'sensitivity', 'type': 'Sensitivity'}, + 'low_thresholds': {'key': 'lowThresholds', 'type': '[float]'}, + 'high_thresholds': {'key': 'highThresholds', 'type': '[float]'}, + } + + def __init__(self, *, sensitivity, low_thresholds, high_thresholds, **kwargs) -> None: + super(Baseline, self).__init__(**kwargs) + self.sensitivity = sensitivity + self.low_thresholds = low_thresholds + self.high_thresholds = high_thresholds + + +class BaselineMetadataValue(Model): + """Represents a baseline metadata value. + + :param name: The name of the metadata. + :type name: ~azure.mgmt.monitor.v2018_09_01.models.LocalizableString + :param value: The value of the metadata. + :type value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, *, name=None, value: str=None, **kwargs) -> None: + super(BaselineMetadataValue, self).__init__(**kwargs) + self.name = name + self.value = value + + +class BaselineResponse(Model): + """The response to a baseline query. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The metric baseline ID. + :vartype id: str + :ivar type: The resource type of the baseline resource. + :vartype type: str + :ivar name: The name and the display name of the metric, i.e. it is + localizable string. + :vartype name: ~azure.mgmt.monitor.v2018_09_01.models.LocalizableString + :param timespan: The timespan for which the data was retrieved. Its value + consists of two datetimes concatenated, separated by '/'. This may be + adjusted in the future and returned back from what was originally + requested. + :type timespan: str + :param interval: The interval (window size) for which the metric data was + returned in. This may be adjusted in the future and returned back from + what was originally requested. This is not present if a metadata request + was made. + :type interval: timedelta + :param aggregation: The aggregation type of the metric. + :type aggregation: str + :param timestamps: The array of timestamps of the baselines. + :type timestamps: list[datetime] + :param baseline: The baseline values for each sensitivity. + :type baseline: list[~azure.mgmt.monitor.v2018_09_01.models.Baseline] + :param metadata: The baseline metadata values. + :type metadata: + list[~azure.mgmt.monitor.v2018_09_01.models.BaselineMetadataValue] + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'timespan': {'key': 'properties.timespan', 'type': 'str'}, + 'interval': {'key': 'properties.interval', 'type': 'duration'}, + 'aggregation': {'key': 'properties.aggregation', 'type': 'str'}, + 'timestamps': {'key': 'properties.timestamps', 'type': '[iso-8601]'}, + 'baseline': {'key': 'properties.baseline', 'type': '[Baseline]'}, + 'metadata': {'key': 'properties.metadata', 'type': '[BaselineMetadataValue]'}, + } + + def __init__(self, *, timespan: str=None, interval=None, aggregation: str=None, timestamps=None, baseline=None, metadata=None, **kwargs) -> None: + super(BaselineResponse, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.timespan = timespan + self.interval = interval + self.aggregation = aggregation + self.timestamps = timestamps + self.baseline = baseline + self.metadata = metadata + + +class CalculateBaselineResponse(Model): + """The response to a calculate baseline call. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The resource type of the baseline resource. + :type type: str + :param timestamps: The array of timestamps of the baselines. + :type timestamps: list[datetime] + :param baseline: Required. The baseline values for each sensitivity. + :type baseline: list[~azure.mgmt.monitor.v2018_09_01.models.Baseline] + """ + + _validation = { + 'type': {'required': True}, + 'baseline': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, + 'baseline': {'key': 'baseline', 'type': '[Baseline]'}, + } + + def __init__(self, *, type: str, baseline, timestamps=None, **kwargs) -> None: + super(CalculateBaselineResponse, self).__init__(**kwargs) + self.type = type + self.timestamps = timestamps + self.baseline = baseline + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class EmailReceiver(Model): + """An email receiver. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the email receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param email_address: Required. The email address of this receiver. + :type email_address: str + :ivar status: The receiver status of the e-mail. Possible values include: + 'NotSpecified', 'Enabled', 'Disabled' + :vartype status: str or + ~azure.mgmt.monitor.v2018_09_01.models.ReceiverStatus + """ + + _validation = { + 'name': {'required': True}, + 'email_address': {'required': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'ReceiverStatus'}, + } + + def __init__(self, *, name: str, email_address: str, **kwargs) -> None: + super(EmailReceiver, self).__init__(**kwargs) + self.name = name + self.email_address = email_address + self.status = None + + +class EnableRequest(Model): + """Describes a receiver that should be resubscribed. + + All required parameters must be populated in order to send to Azure. + + :param receiver_name: Required. The name of the receiver to resubscribe. + :type receiver_name: str + """ + + _validation = { + 'receiver_name': {'required': True}, + } + + _attribute_map = { + 'receiver_name': {'key': 'receiverName', 'type': 'str'}, + } + + def __init__(self, *, receiver_name: str, **kwargs) -> None: + super(EnableRequest, self).__init__(**kwargs) + self.receiver_name = receiver_name + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class ItsmReceiver(Model): + """An Itsm receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the Itsm receiver. Names must be unique + across all receivers within an action group. + :type name: str + :param workspace_id: Required. OMS LA instance identifier. + :type workspace_id: str + :param connection_id: Required. Unique identification of ITSM connection + among multiple defined in above workspace. + :type connection_id: str + :param ticket_configuration: Required. JSON blob for the configurations of + the ITSM action. CreateMultipleWorkItems option will be part of this blob + as well. + :type ticket_configuration: str + :param region: Required. Region in which workspace resides. Supported + values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' + :type region: str + """ + + _validation = { + 'name': {'required': True}, + 'workspace_id': {'required': True}, + 'connection_id': {'required': True}, + 'ticket_configuration': {'required': True}, + 'region': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, + 'connection_id': {'key': 'connectionId', 'type': 'str'}, + 'ticket_configuration': {'key': 'ticketConfiguration', 'type': 'str'}, + 'region': {'key': 'region', 'type': 'str'}, + } + + def __init__(self, *, name: str, workspace_id: str, connection_id: str, ticket_configuration: str, region: str, **kwargs) -> None: + super(ItsmReceiver, self).__init__(**kwargs) + self.name = name + self.workspace_id = workspace_id + self.connection_id = connection_id + self.ticket_configuration = ticket_configuration + self.region = region + + +class LocalizableString(Model): + """The localizable string class. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. The invariant value. + :type value: str + :param localized_value: The locale specific value. + :type localized_value: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__(self, *, value: str, localized_value: str=None, **kwargs) -> None: + super(LocalizableString, self).__init__(**kwargs) + self.value = value + self.localized_value = localized_value + + +class LogicAppReceiver(Model): + """A logic app receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the logic app receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param resource_id: Required. The azure resource id of the logic app + receiver. + :type resource_id: str + :param callback_url: Required. The callback url where http request sent + to. + :type callback_url: str + """ + + _validation = { + 'name': {'required': True}, + 'resource_id': {'required': True}, + 'callback_url': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'callback_url': {'key': 'callbackUrl', 'type': 'str'}, + } + + def __init__(self, *, name: str, resource_id: str, callback_url: str, **kwargs) -> None: + super(LogicAppReceiver, self).__init__(**kwargs) + self.name = name + self.resource_id = resource_id + self.callback_url = callback_url + + +class SmsReceiver(Model): + """An SMS receiver. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the SMS receiver. Names must be unique + across all receivers within an action group. + :type name: str + :param country_code: Required. The country code of the SMS receiver. + :type country_code: str + :param phone_number: Required. The phone number of the SMS receiver. + :type phone_number: str + :ivar status: The status of the receiver. Possible values include: + 'NotSpecified', 'Enabled', 'Disabled' + :vartype status: str or + ~azure.mgmt.monitor.v2018_09_01.models.ReceiverStatus + """ + + _validation = { + 'name': {'required': True}, + 'country_code': {'required': True}, + 'phone_number': {'required': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'phone_number': {'key': 'phoneNumber', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'ReceiverStatus'}, + } + + def __init__(self, *, name: str, country_code: str, phone_number: str, **kwargs) -> None: + super(SmsReceiver, self).__init__(**kwargs) + self.name = name + self.country_code = country_code + self.phone_number = phone_number + self.status = None + + +class TimeSeriesInformation(Model): + """The time series info needed for calculating the baseline. + + All required parameters must be populated in order to send to Azure. + + :param sensitivities: Required. The list of sensitivities for calculating + the baseline. + :type sensitivities: list[str] + :param values: Required. The metric values to calculate the baseline. + :type values: list[float] + :param timestamps: The array of timestamps of the baselines. + :type timestamps: list[datetime] + """ + + _validation = { + 'sensitivities': {'required': True}, + 'values': {'required': True}, + } + + _attribute_map = { + 'sensitivities': {'key': 'sensitivities', 'type': '[str]'}, + 'values': {'key': 'values', 'type': '[float]'}, + 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, + } + + def __init__(self, *, sensitivities, values, timestamps=None, **kwargs) -> None: + super(TimeSeriesInformation, self).__init__(**kwargs) + self.sensitivities = sensitivities + self.values = values + self.timestamps = timestamps + + +class VoiceReceiver(Model): + """A voice receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the voice receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param country_code: Required. The country code of the voice receiver. + :type country_code: str + :param phone_number: Required. The phone number of the voice receiver. + :type phone_number: str + """ + + _validation = { + 'name': {'required': True}, + 'country_code': {'required': True}, + 'phone_number': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'phone_number': {'key': 'phoneNumber', 'type': 'str'}, + } + + def __init__(self, *, name: str, country_code: str, phone_number: str, **kwargs) -> None: + super(VoiceReceiver, self).__init__(**kwargs) + self.name = name + self.country_code = country_code + self.phone_number = phone_number + + +class WebhookReceiver(Model): + """A webhook receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the webhook receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param service_uri: Required. The URI where webhooks should be sent. + :type service_uri: str + """ + + _validation = { + 'name': {'required': True}, + 'service_uri': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + } + + def __init__(self, *, name: str, service_uri: str, **kwargs) -> None: + super(WebhookReceiver, self).__init__(**kwargs) + self.name = name + self.service_uri = service_uri diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_monitor_management_client_enums.py new file mode 100644 index 000000000000..e87f9f003a4f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_monitor_management_client_enums.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum + + +class ReceiverStatus(str, Enum): + + not_specified = "NotSpecified" + enabled = "Enabled" + disabled = "Disabled" + + +class Sensitivity(str, Enum): + + low = "Low" + medium = "Medium" + high = "High" + + +class ResultType(str, Enum): + + data = "Data" + metadata = "Metadata" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_paged_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_paged_models.py new file mode 100644 index 000000000000..0bc070d8bf21 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_paged_models.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class ActionGroupResourcePaged(Paged): + """ + A paging container for iterating over a list of :class:`ActionGroupResource ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ActionGroupResource]'} + } + + def __init__(self, *args, **kwargs): + + super(ActionGroupResourcePaged, self).__init__(*args, **kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/__init__.py new file mode 100644 index 000000000000..0fe00c09ddf6 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/__init__.py @@ -0,0 +1,20 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._action_groups_operations import ActionGroupsOperations +from ._metric_baseline_operations import MetricBaselineOperations +from ._baseline_operations import BaselineOperations + +__all__ = [ + 'ActionGroupsOperations', + 'MetricBaselineOperations', + 'BaselineOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_action_groups_operations.py new file mode 100644 index 000000000000..ca82cfcb0fe0 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_action_groups_operations.py @@ -0,0 +1,488 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class ActionGroupsOperations(object): + """ActionGroupsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2018-09-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-09-01" + + self.config = config + + def create_or_update( + self, resource_group_name, action_group_name, action_group, custom_headers=None, raw=False, **operation_config): + """Create a new action group or update an existing one. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param action_group_name: The name of the action group. + :type action_group_name: str + :param action_group: The action group to create or use for the update. + :type action_group: + ~azure.mgmt.monitor.v2018_09_01.models.ActionGroupResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ActionGroupResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2018_09_01.models.ActionGroupResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(action_group, 'ActionGroupResource') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ActionGroupResource', response) + if response.status_code == 201: + deserialized = self._deserialize('ActionGroupResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} + + def get( + self, resource_group_name, action_group_name, custom_headers=None, raw=False, **operation_config): + """Get an action group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param action_group_name: The name of the action group. + :type action_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ActionGroupResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2018_09_01.models.ActionGroupResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ActionGroupResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} + + def delete( + self, resource_group_name, action_group_name, custom_headers=None, raw=False, **operation_config): + """Delete an action group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param action_group_name: The name of the action group. + :type action_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} + + def update( + self, resource_group_name, action_group_name, tags=None, enabled=True, custom_headers=None, raw=False, **operation_config): + """Updates an existing action group's tags. To update other fields use the + CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param action_group_name: The name of the action group. + :type action_group_name: str + :param tags: Resource tags + :type tags: dict[str, str] + :param enabled: Indicates whether this action group is enabled. If an + action group is not enabled, then none of its actions will be + activated. + :type enabled: bool + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ActionGroupResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2018_09_01.models.ActionGroupResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + action_group_patch = models.ActionGroupPatchBody(tags=tags, enabled=enabled) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(action_group_patch, 'ActionGroupPatchBody') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ActionGroupResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} + + def list_by_subscription_id( + self, custom_headers=None, raw=False, **operation_config): + """Get a list of all action groups in a subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ActionGroupResource + :rtype: + ~azure.mgmt.monitor.v2018_09_01.models.ActionGroupResourcePaged[~azure.mgmt.monitor.v2018_09_01.models.ActionGroupResource] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription_id.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ActionGroupResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Get a list of all action groups in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ActionGroupResource + :rtype: + ~azure.mgmt.monitor.v2018_09_01.models.ActionGroupResourcePaged[~azure.mgmt.monitor.v2018_09_01.models.ActionGroupResource] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ActionGroupResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups'} + + def enable_receiver( + self, resource_group_name, action_group_name, receiver_name, custom_headers=None, raw=False, **operation_config): + """Enable a receiver in an action group. This changes the receiver's + status from Disabled to Enabled. This operation is only supported for + Email or SMS receivers. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param action_group_name: The name of the action group. + :type action_group_name: str + :param receiver_name: The name of the receiver to resubscribe. + :type receiver_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + enable_request = models.EnableRequest(receiver_name=receiver_name) + + # Construct URL + url = self.enable_receiver.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(enable_request, 'EnableRequest') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 409]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + enable_receiver.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_baseline_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_baseline_operations.py new file mode 100644 index 000000000000..b6794fcb5bd3 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_baseline_operations.py @@ -0,0 +1,141 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class BaselineOperations(object): + """BaselineOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2018-09-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-09-01" + + self.config = config + + def get( + self, resource_uri, metricnames=None, timespan=None, interval=None, aggregation=None, sensitivities=None, result_type=None, metricnamespace=None, filter=None, custom_headers=None, raw=False, **operation_config): + """**Gets the baseline values for a resource**. + + :param resource_uri: The identifier of the resource. It has the + following structure: + subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. + For example: + subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + :type resource_uri: str + :param metricnames: The names of the metrics (comma separated) to + retrieve. + :type metricnames: str + :param timespan: The timespan of the query. It is a string with the + following format 'startDateTime_ISO/endDateTime_ISO'. + :type timespan: str + :param interval: The interval (i.e. timegrain) of the query. + :type interval: timedelta + :param aggregation: The aggregation type of the metric to retrieve the + baseline for. + :type aggregation: str + :param sensitivities: The list of sensitivities (comma separated) to + retrieve. + :type sensitivities: str + :param result_type: Allows retrieving only metadata of the baseline. + On data request all information is retrieved. Possible values include: + 'Data', 'Metadata' + :type result_type: str or + ~azure.mgmt.monitor.v2018_09_01.models.ResultType + :param metricnamespace: Metric namespace to query metric definitions + for. + :type metricnamespace: str + :param filter: The **$filter** is used to describe a set of dimensions + with their concrete values which produce a specific metric's time + series, in which a baseline is requested for. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: BaselineResponse or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2018_09_01.models.BaselineResponse or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if metricnames is not None: + query_parameters['metricnames'] = self._serialize.query("metricnames", metricnames, 'str') + if timespan is not None: + query_parameters['timespan'] = self._serialize.query("timespan", timespan, 'str') + if interval is not None: + query_parameters['interval'] = self._serialize.query("interval", interval, 'duration') + if aggregation is not None: + query_parameters['aggregation'] = self._serialize.query("aggregation", aggregation, 'str') + if sensitivities is not None: + query_parameters['sensitivities'] = self._serialize.query("sensitivities", sensitivities, 'str') + if result_type is not None: + query_parameters['resultType'] = self._serialize.query("result_type", result_type, 'ResultType') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if metricnamespace is not None: + query_parameters['metricnamespace'] = self._serialize.query("metricnamespace", metricnamespace, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('BaselineResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/baseline'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_metric_baseline_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_metric_baseline_operations.py new file mode 100644 index 000000000000..2ec956a6e4d8 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_metric_baseline_operations.py @@ -0,0 +1,209 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class MetricBaselineOperations(object): + """MetricBaselineOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2018-09-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-09-01" + + self.config = config + + def get( + self, resource_uri, metric_name, timespan=None, interval=None, aggregation=None, sensitivities=None, result_type=None, metricnamespace=None, filter=None, custom_headers=None, raw=False, **operation_config): + """**Gets the baseline values for a specific metric**. + + :param resource_uri: The identifier of the resource. It has the + following structure: + subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. + For example: + subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + :type resource_uri: str + :param metric_name: The name of the metric to retrieve the baseline + for. + :type metric_name: str + :param timespan: The timespan of the query. It is a string with the + following format 'startDateTime_ISO/endDateTime_ISO'. + :type timespan: str + :param interval: The interval (i.e. timegrain) of the query. + :type interval: timedelta + :param aggregation: The aggregation type of the metric to retrieve the + baseline for. + :type aggregation: str + :param sensitivities: The list of sensitivities (comma separated) to + retrieve. + :type sensitivities: str + :param result_type: Allows retrieving only metadata of the baseline. + On data request all information is retrieved. Possible values include: + 'Data', 'Metadata' + :type result_type: str or + ~azure.mgmt.monitor.v2018_09_01.models.ResultType + :param metricnamespace: Metric namespace to query metric definitions + for. + :type metricnamespace: str + :param filter: The **$filter** is used to describe a set of dimensions + with their concrete values which produce a specific metric's time + series, in which a baseline is requested for. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: BaselineResponse or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2018_09_01.models.BaselineResponse or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), + 'metricName': self._serialize.url("metric_name", metric_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if timespan is not None: + query_parameters['timespan'] = self._serialize.query("timespan", timespan, 'str') + if interval is not None: + query_parameters['interval'] = self._serialize.query("interval", interval, 'duration') + if aggregation is not None: + query_parameters['aggregation'] = self._serialize.query("aggregation", aggregation, 'str') + if sensitivities is not None: + query_parameters['sensitivities'] = self._serialize.query("sensitivities", sensitivities, 'str') + if result_type is not None: + query_parameters['resultType'] = self._serialize.query("result_type", result_type, 'ResultType') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if metricnamespace is not None: + query_parameters['metricnamespace'] = self._serialize.query("metricnamespace", metricnamespace, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('BaselineResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/baseline/{metricName}'} + + def calculate_baseline( + self, resource_uri, time_series_information, custom_headers=None, raw=False, **operation_config): + """**Lists the baseline values for a resource**. + + :param resource_uri: The identifier of the resource. It has the + following structure: + subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. + For example: + subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + :type resource_uri: str + :param time_series_information: Information that need to be specified + to calculate a baseline on a time series. + :type time_series_information: + ~azure.mgmt.monitor.v2018_09_01.models.TimeSeriesInformation + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: CalculateBaselineResponse or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.monitor.v2018_09_01.models.CalculateBaselineResponse or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.calculate_baseline.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(time_series_information, 'TimeSeriesInformation') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CalculateBaselineResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + calculate_baseline.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/calculatebaseline'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/version.py new file mode 100644 index 000000000000..c9a9b899085f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2018-09-01" + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/__init__.py new file mode 100644 index 000000000000..8e97360e5ffb --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._configuration import MonitorManagementClientConfiguration +from ._monitor_management_client import MonitorManagementClient +__all__ = ['MonitorManagementClient', 'MonitorManagementClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_configuration.py new file mode 100644 index 000000000000..9b4e1e19d961 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_configuration.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +from msrestazure import AzureConfiguration + +from .version import VERSION + + +class MonitorManagementClientConfiguration(AzureConfiguration): + """Configuration for MonitorManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param str base_url: Service URL + """ + + def __init__( + self, credentials, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(MonitorManagementClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-monitor/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_monitor_management_client.py new file mode 100644 index 000000000000..2f3e68d60cda --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_monitor_management_client.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 msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import MonitorManagementClientConfiguration +from .operations import VMInsightsOperations +from . import models + + +class MonitorManagementClient(SDKClient): + """Monitor Management Client + + :ivar config: Configuration for client. + :vartype config: MonitorManagementClientConfiguration + + :ivar vm_insights: VMInsights operations + :vartype vm_insights: azure.mgmt.monitor.v2018_11_27_preview.operations.VMInsightsOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param str base_url: Service URL + """ + + def __init__( + self, credentials, base_url=None): + + self.config = MonitorManagementClientConfiguration(credentials, base_url) + super(MonitorManagementClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2018-11-27-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.vm_insights = VMInsightsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/__init__.py new file mode 100644 index 000000000000..a3d31bc9d9e3 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/__init__.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import DataContainer + from ._models_py3 import Error + from ._models_py3 import ProxyResource + from ._models_py3 import ResponseWithError, ResponseWithErrorException + from ._models_py3 import VMInsightsOnboardingStatus + from ._models_py3 import WorkspaceInfo +except (SyntaxError, ImportError): + from ._models import DataContainer + from ._models import Error + from ._models import ProxyResource + from ._models import ResponseWithError, ResponseWithErrorException + from ._models import VMInsightsOnboardingStatus + from ._models import WorkspaceInfo +from ._monitor_management_client_enums import ( + OnboardingStatus, + DataStatus, +) + +__all__ = [ + 'DataContainer', + 'Error', + 'ProxyResource', + 'ResponseWithError', 'ResponseWithErrorException', + 'VMInsightsOnboardingStatus', + 'WorkspaceInfo', + 'OnboardingStatus', + 'DataStatus', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/_models.py new file mode 100644 index 000000000000..178a4b593ac2 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/_models.py @@ -0,0 +1,232 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class DataContainer(Model): + """Information about a container with data for a given resource. + + All required parameters must be populated in order to send to Azure. + + :param workspace: Required. Log Analytics workspace information. + :type workspace: + ~azure.mgmt.monitor.v2018_11_27_preview.models.WorkspaceInfo + """ + + _validation = { + 'workspace': {'required': True}, + } + + _attribute_map = { + 'workspace': {'key': 'workspace', 'type': 'WorkspaceInfo'}, + } + + def __init__(self, **kwargs): + super(DataContainer, self).__init__(**kwargs) + self.workspace = kwargs.get('workspace', None) + + +class Error(Model): + """Error details. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. Error code identifying the specific error. + :type code: str + :param message: Error message in the caller's locale. + :type message: str + """ + + _validation = { + 'code': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Error, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class ProxyResource(Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ProxyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ResponseWithError(Model): + """An error response from the API. + + All required parameters must be populated in order to send to Azure. + + :param error: Required. Error information. + :type error: ~azure.mgmt.monitor.v2018_11_27_preview.models.Error + """ + + _validation = { + 'error': {'required': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'Error'}, + } + + def __init__(self, **kwargs): + super(ResponseWithError, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ResponseWithErrorException(HttpOperationError): + """Server responsed with exception of type: 'ResponseWithError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ResponseWithErrorException, self).__init__(deserialize, response, 'ResponseWithError', *args) + + +class VMInsightsOnboardingStatus(ProxyResource): + """VM Insights onboarding status for a resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param resource_id: Required. Azure Resource Manager identifier of the + resource whose onboarding status is being represented. + :type resource_id: str + :param onboarding_status: Required. The onboarding status for the + resource. Note that, a higher level scope, e.g., resource group or + subscription, is considered onboarded if at least one resource under it is + onboarded. Possible values include: 'onboarded', 'notOnboarded', 'unknown' + :type onboarding_status: str or + ~azure.mgmt.monitor.v2018_11_27_preview.models.OnboardingStatus + :param data_status: Required. The status of VM Insights data from the + resource. When reported as `present` the data array will contain + information about the data containers to which data for the specified + resource is being routed. Possible values include: 'present', 'notPresent' + :type data_status: str or + ~azure.mgmt.monitor.v2018_11_27_preview.models.DataStatus + :param data: Containers that currently store VM Insights data for the + specified resource. + :type data: + list[~azure.mgmt.monitor.v2018_11_27_preview.models.DataContainer] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource_id': {'required': True}, + 'onboarding_status': {'required': True}, + 'data_status': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, + 'onboarding_status': {'key': 'properties.onboardingStatus', 'type': 'str'}, + 'data_status': {'key': 'properties.dataStatus', 'type': 'str'}, + 'data': {'key': 'properties.data', 'type': '[DataContainer]'}, + } + + def __init__(self, **kwargs): + super(VMInsightsOnboardingStatus, self).__init__(**kwargs) + self.resource_id = kwargs.get('resource_id', None) + self.onboarding_status = kwargs.get('onboarding_status', None) + self.data_status = kwargs.get('data_status', None) + self.data = kwargs.get('data', None) + + +class WorkspaceInfo(Model): + """Information about a Log Analytics Workspace. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Azure Resource Manager identifier of the Log + Analytics Workspace. + :type id: str + :param location: Required. Location of the Log Analytics workspace. + :type location: str + :param customer_id: Required. Log Analytics workspace identifier. + :type customer_id: str + """ + + _validation = { + 'id': {'required': True}, + 'location': {'required': True}, + 'customer_id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'customer_id': {'key': 'properties.customerId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(WorkspaceInfo, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.location = kwargs.get('location', None) + self.customer_id = kwargs.get('customer_id', None) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/_models_py3.py new file mode 100644 index 000000000000..bc1328ecc290 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/_models_py3.py @@ -0,0 +1,232 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class DataContainer(Model): + """Information about a container with data for a given resource. + + All required parameters must be populated in order to send to Azure. + + :param workspace: Required. Log Analytics workspace information. + :type workspace: + ~azure.mgmt.monitor.v2018_11_27_preview.models.WorkspaceInfo + """ + + _validation = { + 'workspace': {'required': True}, + } + + _attribute_map = { + 'workspace': {'key': 'workspace', 'type': 'WorkspaceInfo'}, + } + + def __init__(self, *, workspace, **kwargs) -> None: + super(DataContainer, self).__init__(**kwargs) + self.workspace = workspace + + +class Error(Model): + """Error details. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. Error code identifying the specific error. + :type code: str + :param message: Error message in the caller's locale. + :type message: str + """ + + _validation = { + 'code': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code: str, message: str=None, **kwargs) -> None: + super(Error, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ProxyResource(Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(ProxyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ResponseWithError(Model): + """An error response from the API. + + All required parameters must be populated in order to send to Azure. + + :param error: Required. Error information. + :type error: ~azure.mgmt.monitor.v2018_11_27_preview.models.Error + """ + + _validation = { + 'error': {'required': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'Error'}, + } + + def __init__(self, *, error, **kwargs) -> None: + super(ResponseWithError, self).__init__(**kwargs) + self.error = error + + +class ResponseWithErrorException(HttpOperationError): + """Server responsed with exception of type: 'ResponseWithError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ResponseWithErrorException, self).__init__(deserialize, response, 'ResponseWithError', *args) + + +class VMInsightsOnboardingStatus(ProxyResource): + """VM Insights onboarding status for a resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param resource_id: Required. Azure Resource Manager identifier of the + resource whose onboarding status is being represented. + :type resource_id: str + :param onboarding_status: Required. The onboarding status for the + resource. Note that, a higher level scope, e.g., resource group or + subscription, is considered onboarded if at least one resource under it is + onboarded. Possible values include: 'onboarded', 'notOnboarded', 'unknown' + :type onboarding_status: str or + ~azure.mgmt.monitor.v2018_11_27_preview.models.OnboardingStatus + :param data_status: Required. The status of VM Insights data from the + resource. When reported as `present` the data array will contain + information about the data containers to which data for the specified + resource is being routed. Possible values include: 'present', 'notPresent' + :type data_status: str or + ~azure.mgmt.monitor.v2018_11_27_preview.models.DataStatus + :param data: Containers that currently store VM Insights data for the + specified resource. + :type data: + list[~azure.mgmt.monitor.v2018_11_27_preview.models.DataContainer] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'resource_id': {'required': True}, + 'onboarding_status': {'required': True}, + 'data_status': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, + 'onboarding_status': {'key': 'properties.onboardingStatus', 'type': 'str'}, + 'data_status': {'key': 'properties.dataStatus', 'type': 'str'}, + 'data': {'key': 'properties.data', 'type': '[DataContainer]'}, + } + + def __init__(self, *, resource_id: str, onboarding_status, data_status, data=None, **kwargs) -> None: + super(VMInsightsOnboardingStatus, self).__init__(**kwargs) + self.resource_id = resource_id + self.onboarding_status = onboarding_status + self.data_status = data_status + self.data = data + + +class WorkspaceInfo(Model): + """Information about a Log Analytics Workspace. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Azure Resource Manager identifier of the Log + Analytics Workspace. + :type id: str + :param location: Required. Location of the Log Analytics workspace. + :type location: str + :param customer_id: Required. Log Analytics workspace identifier. + :type customer_id: str + """ + + _validation = { + 'id': {'required': True}, + 'location': {'required': True}, + 'customer_id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'customer_id': {'key': 'properties.customerId', 'type': 'str'}, + } + + def __init__(self, *, id: str, location: str, customer_id: str, **kwargs) -> None: + super(WorkspaceInfo, self).__init__(**kwargs) + self.id = id + self.location = location + self.customer_id = customer_id diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/_monitor_management_client_enums.py new file mode 100644 index 000000000000..67bcd77ab6c0 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/_monitor_management_client_enums.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum + + +class OnboardingStatus(str, Enum): + + onboarded = "onboarded" + not_onboarded = "notOnboarded" + unknown = "unknown" + + +class DataStatus(str, Enum): + + present = "present" + not_present = "notPresent" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/operations/__init__.py new file mode 100644 index 000000000000..a01083602ff1 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/operations/__init__.py @@ -0,0 +1,16 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._vm_insights_operations import VMInsightsOperations + +__all__ = [ + 'VMInsightsOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/operations/_vm_insights_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/operations/_vm_insights_operations.py new file mode 100644 index 000000000000..acb4f51a2ad1 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/operations/_vm_insights_operations.py @@ -0,0 +1,98 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class VMInsightsOperations(object): + """VMInsightsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: API version. Constant value: "2018-11-27-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-11-27-preview" + + self.config = config + + def get_onboarding_status( + self, resource_uri, custom_headers=None, raw=False, **operation_config): + """Retrieves the VM Insights onboarding status for the specified resource + or resource scope. + + :param resource_uri: The fully qualified Azure Resource manager + identifier of the resource, or scope, whose status to retrieve. + :type resource_uri: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: VMInsightsOnboardingStatus or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.monitor.v2018_11_27_preview.models.VMInsightsOnboardingStatus + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ResponseWithErrorException` + """ + # Construct URL + url = self.get_onboarding_status.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ResponseWithErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('VMInsightsOnboardingStatus', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_onboarding_status.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/version.py new file mode 100644 index 000000000000..595c82f043fe --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2018-11-27-preview" + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/__init__.py new file mode 100644 index 000000000000..8e97360e5ffb --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._configuration import MonitorManagementClientConfiguration +from ._monitor_management_client import MonitorManagementClient +__all__ = ['MonitorManagementClient', 'MonitorManagementClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_configuration.py new file mode 100644 index 000000000000..88436f6b4a33 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_configuration.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 msrestazure import AzureConfiguration + +from .version import VERSION + + +class MonitorManagementClientConfiguration(AzureConfiguration): + """Configuration for MonitorManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription Id. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(MonitorManagementClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-monitor/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_monitor_management_client.py new file mode 100644 index 000000000000..78be926c1751 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_monitor_management_client.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 msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import MonitorManagementClientConfiguration +from .operations import ActionGroupsOperations +from .operations import BaselinesOperations +from . import models + + +class MonitorManagementClient(SDKClient): + """Monitor Management Client + + :ivar config: Configuration for client. + :vartype config: MonitorManagementClientConfiguration + + :ivar action_groups: ActionGroups operations + :vartype action_groups: azure.mgmt.monitor.v2019_03_01.operations.ActionGroupsOperations + :ivar baselines: Baselines operations + :vartype baselines: azure.mgmt.monitor.v2019_03_01.operations.BaselinesOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription Id. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = MonitorManagementClientConfiguration(credentials, subscription_id, base_url) + super(MonitorManagementClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2019-03-01' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.action_groups = ActionGroupsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.baselines = BaselinesOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/__init__.py new file mode 100644 index 000000000000..59cc4a9f82dc --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/__init__.py @@ -0,0 +1,88 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import ActionGroupPatchBody + from ._models_py3 import ActionGroupResource + from ._models_py3 import ArmRoleReceiver + from ._models_py3 import AutomationRunbookReceiver + from ._models_py3 import AzureAppPushReceiver + from ._models_py3 import AzureFunctionReceiver + from ._models_py3 import BaselineMetadata + from ._models_py3 import EmailReceiver + from ._models_py3 import EnableRequest + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import ItsmReceiver + from ._models_py3 import LogicAppReceiver + from ._models_py3 import MetricSingleDimension + from ._models_py3 import Resource + from ._models_py3 import SingleBaseline + from ._models_py3 import SingleMetricBaseline + from ._models_py3 import SmsReceiver + from ._models_py3 import TimeSeriesBaseline + from ._models_py3 import VoiceReceiver + from ._models_py3 import WebhookReceiver +except (SyntaxError, ImportError): + from ._models import ActionGroupPatchBody + from ._models import ActionGroupResource + from ._models import ArmRoleReceiver + from ._models import AutomationRunbookReceiver + from ._models import AzureAppPushReceiver + from ._models import AzureFunctionReceiver + from ._models import BaselineMetadata + from ._models import EmailReceiver + from ._models import EnableRequest + from ._models import ErrorResponse, ErrorResponseException + from ._models import ItsmReceiver + from ._models import LogicAppReceiver + from ._models import MetricSingleDimension + from ._models import Resource + from ._models import SingleBaseline + from ._models import SingleMetricBaseline + from ._models import SmsReceiver + from ._models import TimeSeriesBaseline + from ._models import VoiceReceiver + from ._models import WebhookReceiver +from ._paged_models import ActionGroupResourcePaged +from ._paged_models import SingleMetricBaselinePaged +from ._monitor_management_client_enums import ( + ReceiverStatus, + BaselineSensitivity, + ResultType, +) + +__all__ = [ + 'ActionGroupPatchBody', + 'ActionGroupResource', + 'ArmRoleReceiver', + 'AutomationRunbookReceiver', + 'AzureAppPushReceiver', + 'AzureFunctionReceiver', + 'BaselineMetadata', + 'EmailReceiver', + 'EnableRequest', + 'ErrorResponse', 'ErrorResponseException', + 'ItsmReceiver', + 'LogicAppReceiver', + 'MetricSingleDimension', + 'Resource', + 'SingleBaseline', + 'SingleMetricBaseline', + 'SmsReceiver', + 'TimeSeriesBaseline', + 'VoiceReceiver', + 'WebhookReceiver', + 'ActionGroupResourcePaged', + 'SingleMetricBaselinePaged', + 'ReceiverStatus', + 'BaselineSensitivity', + 'ResultType', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/_models.py new file mode 100644 index 000000000000..1c3da8789de3 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/_models.py @@ -0,0 +1,849 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ActionGroupPatchBody(Model): + """An action group object for the body of patch operations. + + :param tags: Resource tags + :type tags: dict[str, str] + :param enabled: Indicates whether this action group is enabled. If an + action group is not enabled, then none of its actions will be activated. + Default value: True . + :type enabled: bool + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(ActionGroupPatchBody, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.enabled = kwargs.get('enabled', True) + + +class Resource(Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class ActionGroupResource(Resource): + """An action group resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param group_short_name: Required. The short name of the action group. + This will be used in SMS messages. + :type group_short_name: str + :param enabled: Required. Indicates whether this action group is enabled. + If an action group is not enabled, then none of its receivers will receive + communications. Default value: True . + :type enabled: bool + :param email_receivers: The list of email receivers that are part of this + action group. + :type email_receivers: + list[~azure.mgmt.monitor.v2019_03_01.models.EmailReceiver] + :param sms_receivers: The list of SMS receivers that are part of this + action group. + :type sms_receivers: + list[~azure.mgmt.monitor.v2019_03_01.models.SmsReceiver] + :param webhook_receivers: The list of webhook receivers that are part of + this action group. + :type webhook_receivers: + list[~azure.mgmt.monitor.v2019_03_01.models.WebhookReceiver] + :param itsm_receivers: The list of ITSM receivers that are part of this + action group. + :type itsm_receivers: + list[~azure.mgmt.monitor.v2019_03_01.models.ItsmReceiver] + :param azure_app_push_receivers: The list of AzureAppPush receivers that + are part of this action group. + :type azure_app_push_receivers: + list[~azure.mgmt.monitor.v2019_03_01.models.AzureAppPushReceiver] + :param automation_runbook_receivers: The list of AutomationRunbook + receivers that are part of this action group. + :type automation_runbook_receivers: + list[~azure.mgmt.monitor.v2019_03_01.models.AutomationRunbookReceiver] + :param voice_receivers: The list of voice receivers that are part of this + action group. + :type voice_receivers: + list[~azure.mgmt.monitor.v2019_03_01.models.VoiceReceiver] + :param logic_app_receivers: The list of logic app receivers that are part + of this action group. + :type logic_app_receivers: + list[~azure.mgmt.monitor.v2019_03_01.models.LogicAppReceiver] + :param azure_function_receivers: The list of azure function receivers that + are part of this action group. + :type azure_function_receivers: + list[~azure.mgmt.monitor.v2019_03_01.models.AzureFunctionReceiver] + :param arm_role_receivers: The list of ARM role receivers that are part of + this action group. Roles are Azure RBAC roles and only built-in roles are + supported. + :type arm_role_receivers: + list[~azure.mgmt.monitor.v2019_03_01.models.ArmRoleReceiver] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'group_short_name': {'required': True, 'max_length': 12}, + 'enabled': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'group_short_name': {'key': 'properties.groupShortName', 'type': 'str'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'email_receivers': {'key': 'properties.emailReceivers', 'type': '[EmailReceiver]'}, + 'sms_receivers': {'key': 'properties.smsReceivers', 'type': '[SmsReceiver]'}, + 'webhook_receivers': {'key': 'properties.webhookReceivers', 'type': '[WebhookReceiver]'}, + 'itsm_receivers': {'key': 'properties.itsmReceivers', 'type': '[ItsmReceiver]'}, + 'azure_app_push_receivers': {'key': 'properties.azureAppPushReceivers', 'type': '[AzureAppPushReceiver]'}, + 'automation_runbook_receivers': {'key': 'properties.automationRunbookReceivers', 'type': '[AutomationRunbookReceiver]'}, + 'voice_receivers': {'key': 'properties.voiceReceivers', 'type': '[VoiceReceiver]'}, + 'logic_app_receivers': {'key': 'properties.logicAppReceivers', 'type': '[LogicAppReceiver]'}, + 'azure_function_receivers': {'key': 'properties.azureFunctionReceivers', 'type': '[AzureFunctionReceiver]'}, + 'arm_role_receivers': {'key': 'properties.armRoleReceivers', 'type': '[ArmRoleReceiver]'}, + } + + def __init__(self, **kwargs): + super(ActionGroupResource, self).__init__(**kwargs) + self.group_short_name = kwargs.get('group_short_name', None) + self.enabled = kwargs.get('enabled', True) + self.email_receivers = kwargs.get('email_receivers', None) + self.sms_receivers = kwargs.get('sms_receivers', None) + self.webhook_receivers = kwargs.get('webhook_receivers', None) + self.itsm_receivers = kwargs.get('itsm_receivers', None) + self.azure_app_push_receivers = kwargs.get('azure_app_push_receivers', None) + self.automation_runbook_receivers = kwargs.get('automation_runbook_receivers', None) + self.voice_receivers = kwargs.get('voice_receivers', None) + self.logic_app_receivers = kwargs.get('logic_app_receivers', None) + self.azure_function_receivers = kwargs.get('azure_function_receivers', None) + self.arm_role_receivers = kwargs.get('arm_role_receivers', None) + + +class ArmRoleReceiver(Model): + """An arm role receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the arm role receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param role_id: Required. The arm role id. + :type role_id: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool + """ + + _validation = { + 'name': {'required': True}, + 'role_id': {'required': True}, + 'use_common_alert_schema': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'role_id': {'key': 'roleId', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(ArmRoleReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.role_id = kwargs.get('role_id', None) + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', None) + + +class AutomationRunbookReceiver(Model): + """The Azure Automation Runbook notification receiver. + + All required parameters must be populated in order to send to Azure. + + :param automation_account_id: Required. The Azure automation account Id + which holds this runbook and authenticate to Azure resource. + :type automation_account_id: str + :param runbook_name: Required. The name for this runbook. + :type runbook_name: str + :param webhook_resource_id: Required. The resource id for webhook linked + to this runbook. + :type webhook_resource_id: str + :param is_global_runbook: Required. Indicates whether this instance is + global runbook. + :type is_global_runbook: bool + :param name: Indicates name of the webhook. + :type name: str + :param service_uri: The URI where webhooks should be sent. + :type service_uri: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool + """ + + _validation = { + 'automation_account_id': {'required': True}, + 'runbook_name': {'required': True}, + 'webhook_resource_id': {'required': True}, + 'is_global_runbook': {'required': True}, + 'use_common_alert_schema': {'required': True}, + } + + _attribute_map = { + 'automation_account_id': {'key': 'automationAccountId', 'type': 'str'}, + 'runbook_name': {'key': 'runbookName', 'type': 'str'}, + 'webhook_resource_id': {'key': 'webhookResourceId', 'type': 'str'}, + 'is_global_runbook': {'key': 'isGlobalRunbook', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(AutomationRunbookReceiver, self).__init__(**kwargs) + self.automation_account_id = kwargs.get('automation_account_id', None) + self.runbook_name = kwargs.get('runbook_name', None) + self.webhook_resource_id = kwargs.get('webhook_resource_id', None) + self.is_global_runbook = kwargs.get('is_global_runbook', None) + self.name = kwargs.get('name', None) + self.service_uri = kwargs.get('service_uri', None) + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', None) + + +class AzureAppPushReceiver(Model): + """The Azure mobile App push notification receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the Azure mobile app push receiver. + Names must be unique across all receivers within an action group. + :type name: str + :param email_address: Required. The email address registered for the Azure + mobile app. + :type email_address: str + """ + + _validation = { + 'name': {'required': True}, + 'email_address': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AzureAppPushReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.email_address = kwargs.get('email_address', None) + + +class AzureFunctionReceiver(Model): + """An azure function receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the azure function receiver. Names must + be unique across all receivers within an action group. + :type name: str + :param function_app_resource_id: Required. The azure resource id of the + function app. + :type function_app_resource_id: str + :param function_name: Required. The function name in the function app. + :type function_name: str + :param http_trigger_url: Required. The http trigger url where http request + sent to. + :type http_trigger_url: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool + """ + + _validation = { + 'name': {'required': True}, + 'function_app_resource_id': {'required': True}, + 'function_name': {'required': True}, + 'http_trigger_url': {'required': True}, + 'use_common_alert_schema': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'function_app_resource_id': {'key': 'functionAppResourceId', 'type': 'str'}, + 'function_name': {'key': 'functionName', 'type': 'str'}, + 'http_trigger_url': {'key': 'httpTriggerUrl', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(AzureFunctionReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.function_app_resource_id = kwargs.get('function_app_resource_id', None) + self.function_name = kwargs.get('function_name', None) + self.http_trigger_url = kwargs.get('http_trigger_url', None) + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', None) + + +class BaselineMetadata(Model): + """Represents a baseline metadata value. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the baseline metadata. + :type name: str + :param value: Required. Value of the baseline metadata. + :type value: str + """ + + _validation = { + 'name': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(BaselineMetadata, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.value = kwargs.get('value', None) + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class EmailReceiver(Model): + """An email receiver. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the email receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param email_address: Required. The email address of this receiver. + :type email_address: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool + :ivar status: The receiver status of the e-mail. Possible values include: + 'NotSpecified', 'Enabled', 'Disabled' + :vartype status: str or + ~azure.mgmt.monitor.v2019_03_01.models.ReceiverStatus + """ + + _validation = { + 'name': {'required': True}, + 'email_address': {'required': True}, + 'use_common_alert_schema': {'required': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, + 'status': {'key': 'status', 'type': 'ReceiverStatus'}, + } + + def __init__(self, **kwargs): + super(EmailReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.email_address = kwargs.get('email_address', None) + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', None) + self.status = None + + +class EnableRequest(Model): + """Describes a receiver that should be resubscribed. + + All required parameters must be populated in order to send to Azure. + + :param receiver_name: Required. The name of the receiver to resubscribe. + :type receiver_name: str + """ + + _validation = { + 'receiver_name': {'required': True}, + } + + _attribute_map = { + 'receiver_name': {'key': 'receiverName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(EnableRequest, self).__init__(**kwargs) + self.receiver_name = kwargs.get('receiver_name', None) + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class ItsmReceiver(Model): + """An Itsm receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the Itsm receiver. Names must be unique + across all receivers within an action group. + :type name: str + :param workspace_id: Required. OMS LA instance identifier. + :type workspace_id: str + :param connection_id: Required. Unique identification of ITSM connection + among multiple defined in above workspace. + :type connection_id: str + :param ticket_configuration: Required. JSON blob for the configurations of + the ITSM action. CreateMultipleWorkItems option will be part of this blob + as well. + :type ticket_configuration: str + :param region: Required. Region in which workspace resides. Supported + values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' + :type region: str + """ + + _validation = { + 'name': {'required': True}, + 'workspace_id': {'required': True}, + 'connection_id': {'required': True}, + 'ticket_configuration': {'required': True}, + 'region': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, + 'connection_id': {'key': 'connectionId', 'type': 'str'}, + 'ticket_configuration': {'key': 'ticketConfiguration', 'type': 'str'}, + 'region': {'key': 'region', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ItsmReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.workspace_id = kwargs.get('workspace_id', None) + self.connection_id = kwargs.get('connection_id', None) + self.ticket_configuration = kwargs.get('ticket_configuration', None) + self.region = kwargs.get('region', None) + + +class LogicAppReceiver(Model): + """A logic app receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the logic app receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param resource_id: Required. The azure resource id of the logic app + receiver. + :type resource_id: str + :param callback_url: Required. The callback url where http request sent + to. + :type callback_url: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool + """ + + _validation = { + 'name': {'required': True}, + 'resource_id': {'required': True}, + 'callback_url': {'required': True}, + 'use_common_alert_schema': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'callback_url': {'key': 'callbackUrl', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(LogicAppReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.resource_id = kwargs.get('resource_id', None) + self.callback_url = kwargs.get('callback_url', None) + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', None) + + +class MetricSingleDimension(Model): + """The metric dimension name and value. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the dimension. + :type name: str + :param value: Required. Value of the dimension. + :type value: str + """ + + _validation = { + 'name': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MetricSingleDimension, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.value = kwargs.get('value', None) + + +class SingleBaseline(Model): + """The baseline values for a single sensitivity value. + + All required parameters must be populated in order to send to Azure. + + :param sensitivity: Required. the sensitivity of the baseline. Possible + values include: 'Low', 'Medium', 'High' + :type sensitivity: str or + ~azure.mgmt.monitor.v2019_03_01.models.BaselineSensitivity + :param low_thresholds: Required. The low thresholds of the baseline. + :type low_thresholds: list[float] + :param high_thresholds: Required. The high thresholds of the baseline. + :type high_thresholds: list[float] + """ + + _validation = { + 'sensitivity': {'required': True}, + 'low_thresholds': {'required': True}, + 'high_thresholds': {'required': True}, + } + + _attribute_map = { + 'sensitivity': {'key': 'sensitivity', 'type': 'str'}, + 'low_thresholds': {'key': 'lowThresholds', 'type': '[float]'}, + 'high_thresholds': {'key': 'highThresholds', 'type': '[float]'}, + } + + def __init__(self, **kwargs): + super(SingleBaseline, self).__init__(**kwargs) + self.sensitivity = kwargs.get('sensitivity', None) + self.low_thresholds = kwargs.get('low_thresholds', None) + self.high_thresholds = kwargs.get('high_thresholds', None) + + +class SingleMetricBaseline(Model): + """The baseline results of a single metric. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The metric baseline Id. + :type id: str + :param type: Required. The resource type of the metric baseline resource. + :type type: str + :param name: Required. The name of the metric for which the baselines were + retrieved. + :type name: str + :param timespan: Required. The timespan for which the data was retrieved. + Its value consists of two datetimes concatenated, separated by '/'. This + may be adjusted in the future and returned back from what was originally + requested. + :type timespan: str + :param interval: Required. The interval (window size) for which the metric + data was returned in. This may be adjusted in the future and returned + back from what was originally requested. This is not present if a + metadata request was made. + :type interval: timedelta + :param namespace: The namespace of the metrics been queried. + :type namespace: str + :param baselines: Required. The baseline for each time series that was + queried. + :type baselines: + list[~azure.mgmt.monitor.v2019_03_01.models.TimeSeriesBaseline] + """ + + _validation = { + 'id': {'required': True}, + 'type': {'required': True}, + 'name': {'required': True}, + 'timespan': {'required': True}, + 'interval': {'required': True}, + 'baselines': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'timespan': {'key': 'properties.timespan', 'type': 'str'}, + 'interval': {'key': 'properties.interval', 'type': 'duration'}, + 'namespace': {'key': 'properties.namespace', 'type': 'str'}, + 'baselines': {'key': 'properties.baselines', 'type': '[TimeSeriesBaseline]'}, + } + + def __init__(self, **kwargs): + super(SingleMetricBaseline, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.type = kwargs.get('type', None) + self.name = kwargs.get('name', None) + self.timespan = kwargs.get('timespan', None) + self.interval = kwargs.get('interval', None) + self.namespace = kwargs.get('namespace', None) + self.baselines = kwargs.get('baselines', None) + + +class SmsReceiver(Model): + """An SMS receiver. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the SMS receiver. Names must be unique + across all receivers within an action group. + :type name: str + :param country_code: Required. The country code of the SMS receiver. + :type country_code: str + :param phone_number: Required. The phone number of the SMS receiver. + :type phone_number: str + :ivar status: The status of the receiver. Possible values include: + 'NotSpecified', 'Enabled', 'Disabled' + :vartype status: str or + ~azure.mgmt.monitor.v2019_03_01.models.ReceiverStatus + """ + + _validation = { + 'name': {'required': True}, + 'country_code': {'required': True}, + 'phone_number': {'required': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'phone_number': {'key': 'phoneNumber', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'ReceiverStatus'}, + } + + def __init__(self, **kwargs): + super(SmsReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.country_code = kwargs.get('country_code', None) + self.phone_number = kwargs.get('phone_number', None) + self.status = None + + +class TimeSeriesBaseline(Model): + """The baseline values for a single time series. + + All required parameters must be populated in order to send to Azure. + + :param aggregation: Required. The aggregation type of the metric. + :type aggregation: str + :param dimensions: The dimensions of this time series. + :type dimensions: + list[~azure.mgmt.monitor.v2019_03_01.models.MetricSingleDimension] + :param timestamps: Required. The list of timestamps of the baselines. + :type timestamps: list[datetime] + :param data: Required. The baseline values for each sensitivity. + :type data: list[~azure.mgmt.monitor.v2019_03_01.models.SingleBaseline] + :param metadata: The baseline metadata values. + :type metadata: + list[~azure.mgmt.monitor.v2019_03_01.models.BaselineMetadata] + """ + + _validation = { + 'aggregation': {'required': True}, + 'timestamps': {'required': True}, + 'data': {'required': True}, + } + + _attribute_map = { + 'aggregation': {'key': 'aggregation', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[MetricSingleDimension]'}, + 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, + 'data': {'key': 'data', 'type': '[SingleBaseline]'}, + 'metadata': {'key': 'metadata', 'type': '[BaselineMetadata]'}, + } + + def __init__(self, **kwargs): + super(TimeSeriesBaseline, self).__init__(**kwargs) + self.aggregation = kwargs.get('aggregation', None) + self.dimensions = kwargs.get('dimensions', None) + self.timestamps = kwargs.get('timestamps', None) + self.data = kwargs.get('data', None) + self.metadata = kwargs.get('metadata', None) + + +class VoiceReceiver(Model): + """A voice receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the voice receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param country_code: Required. The country code of the voice receiver. + :type country_code: str + :param phone_number: Required. The phone number of the voice receiver. + :type phone_number: str + """ + + _validation = { + 'name': {'required': True}, + 'country_code': {'required': True}, + 'phone_number': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'phone_number': {'key': 'phoneNumber', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(VoiceReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.country_code = kwargs.get('country_code', None) + self.phone_number = kwargs.get('phone_number', None) + + +class WebhookReceiver(Model): + """A webhook receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the webhook receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param service_uri: Required. The URI where webhooks should be sent. + :type service_uri: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool + """ + + _validation = { + 'name': {'required': True}, + 'service_uri': {'required': True}, + 'use_common_alert_schema': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(WebhookReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.service_uri = kwargs.get('service_uri', None) + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', None) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/_models_py3.py new file mode 100644 index 000000000000..79b588cc841f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/_models_py3.py @@ -0,0 +1,849 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ActionGroupPatchBody(Model): + """An action group object for the body of patch operations. + + :param tags: Resource tags + :type tags: dict[str, str] + :param enabled: Indicates whether this action group is enabled. If an + action group is not enabled, then none of its actions will be activated. + Default value: True . + :type enabled: bool + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + } + + def __init__(self, *, tags=None, enabled: bool=True, **kwargs) -> None: + super(ActionGroupPatchBody, self).__init__(**kwargs) + self.tags = tags + self.enabled = enabled + + +class Resource(Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, location: str, tags=None, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class ActionGroupResource(Resource): + """An action group resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param group_short_name: Required. The short name of the action group. + This will be used in SMS messages. + :type group_short_name: str + :param enabled: Required. Indicates whether this action group is enabled. + If an action group is not enabled, then none of its receivers will receive + communications. Default value: True . + :type enabled: bool + :param email_receivers: The list of email receivers that are part of this + action group. + :type email_receivers: + list[~azure.mgmt.monitor.v2019_03_01.models.EmailReceiver] + :param sms_receivers: The list of SMS receivers that are part of this + action group. + :type sms_receivers: + list[~azure.mgmt.monitor.v2019_03_01.models.SmsReceiver] + :param webhook_receivers: The list of webhook receivers that are part of + this action group. + :type webhook_receivers: + list[~azure.mgmt.monitor.v2019_03_01.models.WebhookReceiver] + :param itsm_receivers: The list of ITSM receivers that are part of this + action group. + :type itsm_receivers: + list[~azure.mgmt.monitor.v2019_03_01.models.ItsmReceiver] + :param azure_app_push_receivers: The list of AzureAppPush receivers that + are part of this action group. + :type azure_app_push_receivers: + list[~azure.mgmt.monitor.v2019_03_01.models.AzureAppPushReceiver] + :param automation_runbook_receivers: The list of AutomationRunbook + receivers that are part of this action group. + :type automation_runbook_receivers: + list[~azure.mgmt.monitor.v2019_03_01.models.AutomationRunbookReceiver] + :param voice_receivers: The list of voice receivers that are part of this + action group. + :type voice_receivers: + list[~azure.mgmt.monitor.v2019_03_01.models.VoiceReceiver] + :param logic_app_receivers: The list of logic app receivers that are part + of this action group. + :type logic_app_receivers: + list[~azure.mgmt.monitor.v2019_03_01.models.LogicAppReceiver] + :param azure_function_receivers: The list of azure function receivers that + are part of this action group. + :type azure_function_receivers: + list[~azure.mgmt.monitor.v2019_03_01.models.AzureFunctionReceiver] + :param arm_role_receivers: The list of ARM role receivers that are part of + this action group. Roles are Azure RBAC roles and only built-in roles are + supported. + :type arm_role_receivers: + list[~azure.mgmt.monitor.v2019_03_01.models.ArmRoleReceiver] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'group_short_name': {'required': True, 'max_length': 12}, + 'enabled': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'group_short_name': {'key': 'properties.groupShortName', 'type': 'str'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'email_receivers': {'key': 'properties.emailReceivers', 'type': '[EmailReceiver]'}, + 'sms_receivers': {'key': 'properties.smsReceivers', 'type': '[SmsReceiver]'}, + 'webhook_receivers': {'key': 'properties.webhookReceivers', 'type': '[WebhookReceiver]'}, + 'itsm_receivers': {'key': 'properties.itsmReceivers', 'type': '[ItsmReceiver]'}, + 'azure_app_push_receivers': {'key': 'properties.azureAppPushReceivers', 'type': '[AzureAppPushReceiver]'}, + 'automation_runbook_receivers': {'key': 'properties.automationRunbookReceivers', 'type': '[AutomationRunbookReceiver]'}, + 'voice_receivers': {'key': 'properties.voiceReceivers', 'type': '[VoiceReceiver]'}, + 'logic_app_receivers': {'key': 'properties.logicAppReceivers', 'type': '[LogicAppReceiver]'}, + 'azure_function_receivers': {'key': 'properties.azureFunctionReceivers', 'type': '[AzureFunctionReceiver]'}, + 'arm_role_receivers': {'key': 'properties.armRoleReceivers', 'type': '[ArmRoleReceiver]'}, + } + + def __init__(self, *, location: str, group_short_name: str, tags=None, enabled: bool=True, email_receivers=None, sms_receivers=None, webhook_receivers=None, itsm_receivers=None, azure_app_push_receivers=None, automation_runbook_receivers=None, voice_receivers=None, logic_app_receivers=None, azure_function_receivers=None, arm_role_receivers=None, **kwargs) -> None: + super(ActionGroupResource, self).__init__(location=location, tags=tags, **kwargs) + self.group_short_name = group_short_name + self.enabled = enabled + self.email_receivers = email_receivers + self.sms_receivers = sms_receivers + self.webhook_receivers = webhook_receivers + self.itsm_receivers = itsm_receivers + self.azure_app_push_receivers = azure_app_push_receivers + self.automation_runbook_receivers = automation_runbook_receivers + self.voice_receivers = voice_receivers + self.logic_app_receivers = logic_app_receivers + self.azure_function_receivers = azure_function_receivers + self.arm_role_receivers = arm_role_receivers + + +class ArmRoleReceiver(Model): + """An arm role receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the arm role receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param role_id: Required. The arm role id. + :type role_id: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool + """ + + _validation = { + 'name': {'required': True}, + 'role_id': {'required': True}, + 'use_common_alert_schema': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'role_id': {'key': 'roleId', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, + } + + def __init__(self, *, name: str, role_id: str, use_common_alert_schema: bool, **kwargs) -> None: + super(ArmRoleReceiver, self).__init__(**kwargs) + self.name = name + self.role_id = role_id + self.use_common_alert_schema = use_common_alert_schema + + +class AutomationRunbookReceiver(Model): + """The Azure Automation Runbook notification receiver. + + All required parameters must be populated in order to send to Azure. + + :param automation_account_id: Required. The Azure automation account Id + which holds this runbook and authenticate to Azure resource. + :type automation_account_id: str + :param runbook_name: Required. The name for this runbook. + :type runbook_name: str + :param webhook_resource_id: Required. The resource id for webhook linked + to this runbook. + :type webhook_resource_id: str + :param is_global_runbook: Required. Indicates whether this instance is + global runbook. + :type is_global_runbook: bool + :param name: Indicates name of the webhook. + :type name: str + :param service_uri: The URI where webhooks should be sent. + :type service_uri: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool + """ + + _validation = { + 'automation_account_id': {'required': True}, + 'runbook_name': {'required': True}, + 'webhook_resource_id': {'required': True}, + 'is_global_runbook': {'required': True}, + 'use_common_alert_schema': {'required': True}, + } + + _attribute_map = { + 'automation_account_id': {'key': 'automationAccountId', 'type': 'str'}, + 'runbook_name': {'key': 'runbookName', 'type': 'str'}, + 'webhook_resource_id': {'key': 'webhookResourceId', 'type': 'str'}, + 'is_global_runbook': {'key': 'isGlobalRunbook', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, + } + + def __init__(self, *, automation_account_id: str, runbook_name: str, webhook_resource_id: str, is_global_runbook: bool, use_common_alert_schema: bool, name: str=None, service_uri: str=None, **kwargs) -> None: + super(AutomationRunbookReceiver, self).__init__(**kwargs) + self.automation_account_id = automation_account_id + self.runbook_name = runbook_name + self.webhook_resource_id = webhook_resource_id + self.is_global_runbook = is_global_runbook + self.name = name + self.service_uri = service_uri + self.use_common_alert_schema = use_common_alert_schema + + +class AzureAppPushReceiver(Model): + """The Azure mobile App push notification receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the Azure mobile app push receiver. + Names must be unique across all receivers within an action group. + :type name: str + :param email_address: Required. The email address registered for the Azure + mobile app. + :type email_address: str + """ + + _validation = { + 'name': {'required': True}, + 'email_address': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + } + + def __init__(self, *, name: str, email_address: str, **kwargs) -> None: + super(AzureAppPushReceiver, self).__init__(**kwargs) + self.name = name + self.email_address = email_address + + +class AzureFunctionReceiver(Model): + """An azure function receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the azure function receiver. Names must + be unique across all receivers within an action group. + :type name: str + :param function_app_resource_id: Required. The azure resource id of the + function app. + :type function_app_resource_id: str + :param function_name: Required. The function name in the function app. + :type function_name: str + :param http_trigger_url: Required. The http trigger url where http request + sent to. + :type http_trigger_url: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool + """ + + _validation = { + 'name': {'required': True}, + 'function_app_resource_id': {'required': True}, + 'function_name': {'required': True}, + 'http_trigger_url': {'required': True}, + 'use_common_alert_schema': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'function_app_resource_id': {'key': 'functionAppResourceId', 'type': 'str'}, + 'function_name': {'key': 'functionName', 'type': 'str'}, + 'http_trigger_url': {'key': 'httpTriggerUrl', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, + } + + def __init__(self, *, name: str, function_app_resource_id: str, function_name: str, http_trigger_url: str, use_common_alert_schema: bool, **kwargs) -> None: + super(AzureFunctionReceiver, self).__init__(**kwargs) + self.name = name + self.function_app_resource_id = function_app_resource_id + self.function_name = function_name + self.http_trigger_url = http_trigger_url + self.use_common_alert_schema = use_common_alert_schema + + +class BaselineMetadata(Model): + """Represents a baseline metadata value. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the baseline metadata. + :type name: str + :param value: Required. Value of the baseline metadata. + :type value: str + """ + + _validation = { + 'name': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, *, name: str, value: str, **kwargs) -> None: + super(BaselineMetadata, self).__init__(**kwargs) + self.name = name + self.value = value + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class EmailReceiver(Model): + """An email receiver. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the email receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param email_address: Required. The email address of this receiver. + :type email_address: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool + :ivar status: The receiver status of the e-mail. Possible values include: + 'NotSpecified', 'Enabled', 'Disabled' + :vartype status: str or + ~azure.mgmt.monitor.v2019_03_01.models.ReceiverStatus + """ + + _validation = { + 'name': {'required': True}, + 'email_address': {'required': True}, + 'use_common_alert_schema': {'required': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, + 'status': {'key': 'status', 'type': 'ReceiverStatus'}, + } + + def __init__(self, *, name: str, email_address: str, use_common_alert_schema: bool, **kwargs) -> None: + super(EmailReceiver, self).__init__(**kwargs) + self.name = name + self.email_address = email_address + self.use_common_alert_schema = use_common_alert_schema + self.status = None + + +class EnableRequest(Model): + """Describes a receiver that should be resubscribed. + + All required parameters must be populated in order to send to Azure. + + :param receiver_name: Required. The name of the receiver to resubscribe. + :type receiver_name: str + """ + + _validation = { + 'receiver_name': {'required': True}, + } + + _attribute_map = { + 'receiver_name': {'key': 'receiverName', 'type': 'str'}, + } + + def __init__(self, *, receiver_name: str, **kwargs) -> None: + super(EnableRequest, self).__init__(**kwargs) + self.receiver_name = receiver_name + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class ItsmReceiver(Model): + """An Itsm receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the Itsm receiver. Names must be unique + across all receivers within an action group. + :type name: str + :param workspace_id: Required. OMS LA instance identifier. + :type workspace_id: str + :param connection_id: Required. Unique identification of ITSM connection + among multiple defined in above workspace. + :type connection_id: str + :param ticket_configuration: Required. JSON blob for the configurations of + the ITSM action. CreateMultipleWorkItems option will be part of this blob + as well. + :type ticket_configuration: str + :param region: Required. Region in which workspace resides. Supported + values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' + :type region: str + """ + + _validation = { + 'name': {'required': True}, + 'workspace_id': {'required': True}, + 'connection_id': {'required': True}, + 'ticket_configuration': {'required': True}, + 'region': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, + 'connection_id': {'key': 'connectionId', 'type': 'str'}, + 'ticket_configuration': {'key': 'ticketConfiguration', 'type': 'str'}, + 'region': {'key': 'region', 'type': 'str'}, + } + + def __init__(self, *, name: str, workspace_id: str, connection_id: str, ticket_configuration: str, region: str, **kwargs) -> None: + super(ItsmReceiver, self).__init__(**kwargs) + self.name = name + self.workspace_id = workspace_id + self.connection_id = connection_id + self.ticket_configuration = ticket_configuration + self.region = region + + +class LogicAppReceiver(Model): + """A logic app receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the logic app receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param resource_id: Required. The azure resource id of the logic app + receiver. + :type resource_id: str + :param callback_url: Required. The callback url where http request sent + to. + :type callback_url: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool + """ + + _validation = { + 'name': {'required': True}, + 'resource_id': {'required': True}, + 'callback_url': {'required': True}, + 'use_common_alert_schema': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'callback_url': {'key': 'callbackUrl', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, + } + + def __init__(self, *, name: str, resource_id: str, callback_url: str, use_common_alert_schema: bool, **kwargs) -> None: + super(LogicAppReceiver, self).__init__(**kwargs) + self.name = name + self.resource_id = resource_id + self.callback_url = callback_url + self.use_common_alert_schema = use_common_alert_schema + + +class MetricSingleDimension(Model): + """The metric dimension name and value. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the dimension. + :type name: str + :param value: Required. Value of the dimension. + :type value: str + """ + + _validation = { + 'name': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, *, name: str, value: str, **kwargs) -> None: + super(MetricSingleDimension, self).__init__(**kwargs) + self.name = name + self.value = value + + +class SingleBaseline(Model): + """The baseline values for a single sensitivity value. + + All required parameters must be populated in order to send to Azure. + + :param sensitivity: Required. the sensitivity of the baseline. Possible + values include: 'Low', 'Medium', 'High' + :type sensitivity: str or + ~azure.mgmt.monitor.v2019_03_01.models.BaselineSensitivity + :param low_thresholds: Required. The low thresholds of the baseline. + :type low_thresholds: list[float] + :param high_thresholds: Required. The high thresholds of the baseline. + :type high_thresholds: list[float] + """ + + _validation = { + 'sensitivity': {'required': True}, + 'low_thresholds': {'required': True}, + 'high_thresholds': {'required': True}, + } + + _attribute_map = { + 'sensitivity': {'key': 'sensitivity', 'type': 'str'}, + 'low_thresholds': {'key': 'lowThresholds', 'type': '[float]'}, + 'high_thresholds': {'key': 'highThresholds', 'type': '[float]'}, + } + + def __init__(self, *, sensitivity, low_thresholds, high_thresholds, **kwargs) -> None: + super(SingleBaseline, self).__init__(**kwargs) + self.sensitivity = sensitivity + self.low_thresholds = low_thresholds + self.high_thresholds = high_thresholds + + +class SingleMetricBaseline(Model): + """The baseline results of a single metric. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The metric baseline Id. + :type id: str + :param type: Required. The resource type of the metric baseline resource. + :type type: str + :param name: Required. The name of the metric for which the baselines were + retrieved. + :type name: str + :param timespan: Required. The timespan for which the data was retrieved. + Its value consists of two datetimes concatenated, separated by '/'. This + may be adjusted in the future and returned back from what was originally + requested. + :type timespan: str + :param interval: Required. The interval (window size) for which the metric + data was returned in. This may be adjusted in the future and returned + back from what was originally requested. This is not present if a + metadata request was made. + :type interval: timedelta + :param namespace: The namespace of the metrics been queried. + :type namespace: str + :param baselines: Required. The baseline for each time series that was + queried. + :type baselines: + list[~azure.mgmt.monitor.v2019_03_01.models.TimeSeriesBaseline] + """ + + _validation = { + 'id': {'required': True}, + 'type': {'required': True}, + 'name': {'required': True}, + 'timespan': {'required': True}, + 'interval': {'required': True}, + 'baselines': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'timespan': {'key': 'properties.timespan', 'type': 'str'}, + 'interval': {'key': 'properties.interval', 'type': 'duration'}, + 'namespace': {'key': 'properties.namespace', 'type': 'str'}, + 'baselines': {'key': 'properties.baselines', 'type': '[TimeSeriesBaseline]'}, + } + + def __init__(self, *, id: str, type: str, name: str, timespan: str, interval, baselines, namespace: str=None, **kwargs) -> None: + super(SingleMetricBaseline, self).__init__(**kwargs) + self.id = id + self.type = type + self.name = name + self.timespan = timespan + self.interval = interval + self.namespace = namespace + self.baselines = baselines + + +class SmsReceiver(Model): + """An SMS receiver. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the SMS receiver. Names must be unique + across all receivers within an action group. + :type name: str + :param country_code: Required. The country code of the SMS receiver. + :type country_code: str + :param phone_number: Required. The phone number of the SMS receiver. + :type phone_number: str + :ivar status: The status of the receiver. Possible values include: + 'NotSpecified', 'Enabled', 'Disabled' + :vartype status: str or + ~azure.mgmt.monitor.v2019_03_01.models.ReceiverStatus + """ + + _validation = { + 'name': {'required': True}, + 'country_code': {'required': True}, + 'phone_number': {'required': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'phone_number': {'key': 'phoneNumber', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'ReceiverStatus'}, + } + + def __init__(self, *, name: str, country_code: str, phone_number: str, **kwargs) -> None: + super(SmsReceiver, self).__init__(**kwargs) + self.name = name + self.country_code = country_code + self.phone_number = phone_number + self.status = None + + +class TimeSeriesBaseline(Model): + """The baseline values for a single time series. + + All required parameters must be populated in order to send to Azure. + + :param aggregation: Required. The aggregation type of the metric. + :type aggregation: str + :param dimensions: The dimensions of this time series. + :type dimensions: + list[~azure.mgmt.monitor.v2019_03_01.models.MetricSingleDimension] + :param timestamps: Required. The list of timestamps of the baselines. + :type timestamps: list[datetime] + :param data: Required. The baseline values for each sensitivity. + :type data: list[~azure.mgmt.monitor.v2019_03_01.models.SingleBaseline] + :param metadata: The baseline metadata values. + :type metadata: + list[~azure.mgmt.monitor.v2019_03_01.models.BaselineMetadata] + """ + + _validation = { + 'aggregation': {'required': True}, + 'timestamps': {'required': True}, + 'data': {'required': True}, + } + + _attribute_map = { + 'aggregation': {'key': 'aggregation', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[MetricSingleDimension]'}, + 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, + 'data': {'key': 'data', 'type': '[SingleBaseline]'}, + 'metadata': {'key': 'metadata', 'type': '[BaselineMetadata]'}, + } + + def __init__(self, *, aggregation: str, timestamps, data, dimensions=None, metadata=None, **kwargs) -> None: + super(TimeSeriesBaseline, self).__init__(**kwargs) + self.aggregation = aggregation + self.dimensions = dimensions + self.timestamps = timestamps + self.data = data + self.metadata = metadata + + +class VoiceReceiver(Model): + """A voice receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the voice receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param country_code: Required. The country code of the voice receiver. + :type country_code: str + :param phone_number: Required. The phone number of the voice receiver. + :type phone_number: str + """ + + _validation = { + 'name': {'required': True}, + 'country_code': {'required': True}, + 'phone_number': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'phone_number': {'key': 'phoneNumber', 'type': 'str'}, + } + + def __init__(self, *, name: str, country_code: str, phone_number: str, **kwargs) -> None: + super(VoiceReceiver, self).__init__(**kwargs) + self.name = name + self.country_code = country_code + self.phone_number = phone_number + + +class WebhookReceiver(Model): + """A webhook receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the webhook receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param service_uri: Required. The URI where webhooks should be sent. + :type service_uri: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool + """ + + _validation = { + 'name': {'required': True}, + 'service_uri': {'required': True}, + 'use_common_alert_schema': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, + } + + def __init__(self, *, name: str, service_uri: str, use_common_alert_schema: bool, **kwargs) -> None: + super(WebhookReceiver, self).__init__(**kwargs) + self.name = name + self.service_uri = service_uri + self.use_common_alert_schema = use_common_alert_schema diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/_monitor_management_client_enums.py new file mode 100644 index 000000000000..fe6f17773f36 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/_monitor_management_client_enums.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum + + +class ReceiverStatus(str, Enum): + + not_specified = "NotSpecified" + enabled = "Enabled" + disabled = "Disabled" + + +class BaselineSensitivity(str, Enum): + + low = "Low" + medium = "Medium" + high = "High" + + +class ResultType(str, Enum): + + data = "Data" + metadata = "Metadata" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/_paged_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/_paged_models.py new file mode 100644 index 000000000000..4626390123d2 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/_paged_models.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class ActionGroupResourcePaged(Paged): + """ + A paging container for iterating over a list of :class:`ActionGroupResource ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ActionGroupResource]'} + } + + def __init__(self, *args, **kwargs): + + super(ActionGroupResourcePaged, self).__init__(*args, **kwargs) +class SingleMetricBaselinePaged(Paged): + """ + A paging container for iterating over a list of :class:`SingleMetricBaseline ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[SingleMetricBaseline]'} + } + + def __init__(self, *args, **kwargs): + + super(SingleMetricBaselinePaged, self).__init__(*args, **kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/__init__.py new file mode 100644 index 000000000000..a23e07bef470 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/__init__.py @@ -0,0 +1,18 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._action_groups_operations import ActionGroupsOperations +from ._baselines_operations import BaselinesOperations + +__all__ = [ + 'ActionGroupsOperations', + 'BaselinesOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/_action_groups_operations.py new file mode 100644 index 000000000000..4282a204aa9d --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/_action_groups_operations.py @@ -0,0 +1,488 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class ActionGroupsOperations(object): + """ActionGroupsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2019-03-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-03-01" + + self.config = config + + def create_or_update( + self, resource_group_name, action_group_name, action_group, custom_headers=None, raw=False, **operation_config): + """Create a new action group or update an existing one. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param action_group_name: The name of the action group. + :type action_group_name: str + :param action_group: The action group to create or use for the update. + :type action_group: + ~azure.mgmt.monitor.v2019_03_01.models.ActionGroupResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ActionGroupResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2019_03_01.models.ActionGroupResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(action_group, 'ActionGroupResource') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ActionGroupResource', response) + if response.status_code == 201: + deserialized = self._deserialize('ActionGroupResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} + + def get( + self, resource_group_name, action_group_name, custom_headers=None, raw=False, **operation_config): + """Get an action group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param action_group_name: The name of the action group. + :type action_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ActionGroupResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2019_03_01.models.ActionGroupResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ActionGroupResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} + + def delete( + self, resource_group_name, action_group_name, custom_headers=None, raw=False, **operation_config): + """Delete an action group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param action_group_name: The name of the action group. + :type action_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} + + def update( + self, resource_group_name, action_group_name, tags=None, enabled=True, custom_headers=None, raw=False, **operation_config): + """Updates an existing action group's tags. To update other fields use the + CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param action_group_name: The name of the action group. + :type action_group_name: str + :param tags: Resource tags + :type tags: dict[str, str] + :param enabled: Indicates whether this action group is enabled. If an + action group is not enabled, then none of its actions will be + activated. + :type enabled: bool + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ActionGroupResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2019_03_01.models.ActionGroupResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + action_group_patch = models.ActionGroupPatchBody(tags=tags, enabled=enabled) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(action_group_patch, 'ActionGroupPatchBody') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ActionGroupResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} + + def list_by_subscription_id( + self, custom_headers=None, raw=False, **operation_config): + """Get a list of all action groups in a subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ActionGroupResource + :rtype: + ~azure.mgmt.monitor.v2019_03_01.models.ActionGroupResourcePaged[~azure.mgmt.monitor.v2019_03_01.models.ActionGroupResource] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription_id.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ActionGroupResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Get a list of all action groups in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ActionGroupResource + :rtype: + ~azure.mgmt.monitor.v2019_03_01.models.ActionGroupResourcePaged[~azure.mgmt.monitor.v2019_03_01.models.ActionGroupResource] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ActionGroupResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups'} + + def enable_receiver( + self, resource_group_name, action_group_name, receiver_name, custom_headers=None, raw=False, **operation_config): + """Enable a receiver in an action group. This changes the receiver's + status from Disabled to Enabled. This operation is only supported for + Email or SMS receivers. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param action_group_name: The name of the action group. + :type action_group_name: str + :param receiver_name: The name of the receiver to resubscribe. + :type receiver_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + enable_request = models.EnableRequest(receiver_name=receiver_name) + + # Construct URL + url = self.enable_receiver.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(enable_request, 'EnableRequest') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 409]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + enable_receiver.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/_baselines_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/_baselines_operations.py new file mode 100644 index 000000000000..3451d65c20b7 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/_baselines_operations.py @@ -0,0 +1,155 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class BaselinesOperations(object): + """BaselinesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2019-03-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-03-01" + + self.config = config + + def list( + self, resource_uri, metricnames=None, metricnamespace=None, timespan=None, interval=None, aggregation=None, sensitivities=None, filter=None, result_type=None, custom_headers=None, raw=False, **operation_config): + """**Lists the metric baseline values for a resource**. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param metricnames: The names of the metrics (comma separated) to + retrieve. + :type metricnames: str + :param metricnamespace: Metric namespace to query metric definitions + for. + :type metricnamespace: str + :param timespan: The timespan of the query. It is a string with the + following format 'startDateTime_ISO/endDateTime_ISO'. + :type timespan: str + :param interval: The interval (i.e. timegrain) of the query. + :type interval: timedelta + :param aggregation: The list of aggregation types (comma separated) to + retrieve. + :type aggregation: str + :param sensitivities: The list of sensitivities (comma separated) to + retrieve. + :type sensitivities: str + :param filter: The **$filter** is used to reduce the set of metric + data returned.
Example:
Metric contains metadata A, B and + C.
- Return all time series of C where A = a1 and B = b1 or + b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq + ‘*’**
- Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C + eq ‘*’ or B = ‘b2’**
This is invalid because the logical or + operator cannot separate two different metadata names.
- Return all + time series where A = a1, B = b1 and C = c1:
**$filter=A eq ‘a1’ + and B eq ‘b1’ and C eq ‘c1’**
- Return all time series where A = + a1
**$filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**. + :type filter: str + :param result_type: Allows retrieving only metadata of the baseline. + On data request all information is retrieved. Possible values include: + 'Data', 'Metadata' + :type result_type: str or + ~azure.mgmt.monitor.v2019_03_01.models.ResultType + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of SingleMetricBaseline + :rtype: + ~azure.mgmt.monitor.v2019_03_01.models.SingleMetricBaselinePaged[~azure.mgmt.monitor.v2019_03_01.models.SingleMetricBaseline] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if metricnames is not None: + query_parameters['metricnames'] = self._serialize.query("metricnames", metricnames, 'str') + if metricnamespace is not None: + query_parameters['metricnamespace'] = self._serialize.query("metricnamespace", metricnamespace, 'str') + if timespan is not None: + query_parameters['timespan'] = self._serialize.query("timespan", timespan, 'str') + if interval is not None: + query_parameters['interval'] = self._serialize.query("interval", interval, 'duration') + if aggregation is not None: + query_parameters['aggregation'] = self._serialize.query("aggregation", aggregation, 'str') + if sensitivities is not None: + query_parameters['sensitivities'] = self._serialize.query("sensitivities", sensitivities, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if result_type is not None: + query_parameters['resultType'] = self._serialize.query("result_type", result_type, 'ResultType') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.SingleMetricBaselinePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metricBaselines'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/version.py new file mode 100644 index 000000000000..9f6882014656 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2019-03-01" + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/__init__.py new file mode 100644 index 000000000000..8e97360e5ffb --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._configuration import MonitorManagementClientConfiguration +from ._monitor_management_client import MonitorManagementClient +__all__ = ['MonitorManagementClient', 'MonitorManagementClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_configuration.py new file mode 100644 index 000000000000..88436f6b4a33 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_configuration.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 msrestazure import AzureConfiguration + +from .version import VERSION + + +class MonitorManagementClientConfiguration(AzureConfiguration): + """Configuration for MonitorManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription Id. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(MonitorManagementClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-monitor/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_monitor_management_client.py new file mode 100644 index 000000000000..07cd3a3adee8 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_monitor_management_client.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 msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import MonitorManagementClientConfiguration +from .operations import ActionGroupsOperations +from . import models + + +class MonitorManagementClient(SDKClient): + """Monitor Management Client + + :ivar config: Configuration for client. + :vartype config: MonitorManagementClientConfiguration + + :ivar action_groups: ActionGroups operations + :vartype action_groups: azure.mgmt.monitor.v2019_06_01.operations.ActionGroupsOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription Id. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = MonitorManagementClientConfiguration(credentials, subscription_id, base_url) + super(MonitorManagementClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2019-06-01' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.action_groups = ActionGroupsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/__init__.py new file mode 100644 index 000000000000..169ca7d55299 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/__init__.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import ActionGroupPatchBody + from ._models_py3 import ActionGroupResource + from ._models_py3 import ArmRoleReceiver + from ._models_py3 import AutomationRunbookReceiver + from ._models_py3 import AzureAppPushReceiver + from ._models_py3 import AzureFunctionReceiver + from ._models_py3 import EmailReceiver + from ._models_py3 import EnableRequest + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import ItsmReceiver + from ._models_py3 import LogicAppReceiver + from ._models_py3 import Resource + from ._models_py3 import SmsReceiver + from ._models_py3 import VoiceReceiver + from ._models_py3 import WebhookReceiver +except (SyntaxError, ImportError): + from ._models import ActionGroupPatchBody + from ._models import ActionGroupResource + from ._models import ArmRoleReceiver + from ._models import AutomationRunbookReceiver + from ._models import AzureAppPushReceiver + from ._models import AzureFunctionReceiver + from ._models import EmailReceiver + from ._models import EnableRequest + from ._models import ErrorResponse, ErrorResponseException + from ._models import ItsmReceiver + from ._models import LogicAppReceiver + from ._models import Resource + from ._models import SmsReceiver + from ._models import VoiceReceiver + from ._models import WebhookReceiver +from ._paged_models import ActionGroupResourcePaged +from ._monitor_management_client_enums import ( + ReceiverStatus, +) + +__all__ = [ + 'ActionGroupPatchBody', + 'ActionGroupResource', + 'ArmRoleReceiver', + 'AutomationRunbookReceiver', + 'AzureAppPushReceiver', + 'AzureFunctionReceiver', + 'EmailReceiver', + 'EnableRequest', + 'ErrorResponse', 'ErrorResponseException', + 'ItsmReceiver', + 'LogicAppReceiver', + 'Resource', + 'SmsReceiver', + 'VoiceReceiver', + 'WebhookReceiver', + 'ActionGroupResourcePaged', + 'ReceiverStatus', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/_models.py new file mode 100644 index 000000000000..de68ac9ec348 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/_models.py @@ -0,0 +1,676 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ActionGroupPatchBody(Model): + """An action group object for the body of patch operations. + + :param tags: Resource tags + :type tags: dict[str, str] + :param enabled: Indicates whether this action group is enabled. If an + action group is not enabled, then none of its actions will be activated. + Default value: True . + :type enabled: bool + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(ActionGroupPatchBody, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.enabled = kwargs.get('enabled', True) + + +class Resource(Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class ActionGroupResource(Resource): + """An action group resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param group_short_name: Required. The short name of the action group. + This will be used in SMS messages. + :type group_short_name: str + :param enabled: Required. Indicates whether this action group is enabled. + If an action group is not enabled, then none of its receivers will receive + communications. Default value: True . + :type enabled: bool + :param email_receivers: The list of email receivers that are part of this + action group. + :type email_receivers: + list[~azure.mgmt.monitor.v2019_06_01.models.EmailReceiver] + :param sms_receivers: The list of SMS receivers that are part of this + action group. + :type sms_receivers: + list[~azure.mgmt.monitor.v2019_06_01.models.SmsReceiver] + :param webhook_receivers: The list of webhook receivers that are part of + this action group. + :type webhook_receivers: + list[~azure.mgmt.monitor.v2019_06_01.models.WebhookReceiver] + :param itsm_receivers: The list of ITSM receivers that are part of this + action group. + :type itsm_receivers: + list[~azure.mgmt.monitor.v2019_06_01.models.ItsmReceiver] + :param azure_app_push_receivers: The list of AzureAppPush receivers that + are part of this action group. + :type azure_app_push_receivers: + list[~azure.mgmt.monitor.v2019_06_01.models.AzureAppPushReceiver] + :param automation_runbook_receivers: The list of AutomationRunbook + receivers that are part of this action group. + :type automation_runbook_receivers: + list[~azure.mgmt.monitor.v2019_06_01.models.AutomationRunbookReceiver] + :param voice_receivers: The list of voice receivers that are part of this + action group. + :type voice_receivers: + list[~azure.mgmt.monitor.v2019_06_01.models.VoiceReceiver] + :param logic_app_receivers: The list of logic app receivers that are part + of this action group. + :type logic_app_receivers: + list[~azure.mgmt.monitor.v2019_06_01.models.LogicAppReceiver] + :param azure_function_receivers: The list of azure function receivers that + are part of this action group. + :type azure_function_receivers: + list[~azure.mgmt.monitor.v2019_06_01.models.AzureFunctionReceiver] + :param arm_role_receivers: The list of ARM role receivers that are part of + this action group. Roles are Azure RBAC roles and only built-in roles are + supported. + :type arm_role_receivers: + list[~azure.mgmt.monitor.v2019_06_01.models.ArmRoleReceiver] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'group_short_name': {'required': True, 'max_length': 12}, + 'enabled': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'group_short_name': {'key': 'properties.groupShortName', 'type': 'str'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'email_receivers': {'key': 'properties.emailReceivers', 'type': '[EmailReceiver]'}, + 'sms_receivers': {'key': 'properties.smsReceivers', 'type': '[SmsReceiver]'}, + 'webhook_receivers': {'key': 'properties.webhookReceivers', 'type': '[WebhookReceiver]'}, + 'itsm_receivers': {'key': 'properties.itsmReceivers', 'type': '[ItsmReceiver]'}, + 'azure_app_push_receivers': {'key': 'properties.azureAppPushReceivers', 'type': '[AzureAppPushReceiver]'}, + 'automation_runbook_receivers': {'key': 'properties.automationRunbookReceivers', 'type': '[AutomationRunbookReceiver]'}, + 'voice_receivers': {'key': 'properties.voiceReceivers', 'type': '[VoiceReceiver]'}, + 'logic_app_receivers': {'key': 'properties.logicAppReceivers', 'type': '[LogicAppReceiver]'}, + 'azure_function_receivers': {'key': 'properties.azureFunctionReceivers', 'type': '[AzureFunctionReceiver]'}, + 'arm_role_receivers': {'key': 'properties.armRoleReceivers', 'type': '[ArmRoleReceiver]'}, + } + + def __init__(self, **kwargs): + super(ActionGroupResource, self).__init__(**kwargs) + self.group_short_name = kwargs.get('group_short_name', None) + self.enabled = kwargs.get('enabled', True) + self.email_receivers = kwargs.get('email_receivers', None) + self.sms_receivers = kwargs.get('sms_receivers', None) + self.webhook_receivers = kwargs.get('webhook_receivers', None) + self.itsm_receivers = kwargs.get('itsm_receivers', None) + self.azure_app_push_receivers = kwargs.get('azure_app_push_receivers', None) + self.automation_runbook_receivers = kwargs.get('automation_runbook_receivers', None) + self.voice_receivers = kwargs.get('voice_receivers', None) + self.logic_app_receivers = kwargs.get('logic_app_receivers', None) + self.azure_function_receivers = kwargs.get('azure_function_receivers', None) + self.arm_role_receivers = kwargs.get('arm_role_receivers', None) + + +class ArmRoleReceiver(Model): + """An arm role receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the arm role receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param role_id: Required. The arm role id. + :type role_id: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool + """ + + _validation = { + 'name': {'required': True}, + 'role_id': {'required': True}, + 'use_common_alert_schema': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'role_id': {'key': 'roleId', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(ArmRoleReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.role_id = kwargs.get('role_id', None) + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', None) + + +class AutomationRunbookReceiver(Model): + """The Azure Automation Runbook notification receiver. + + All required parameters must be populated in order to send to Azure. + + :param automation_account_id: Required. The Azure automation account Id + which holds this runbook and authenticate to Azure resource. + :type automation_account_id: str + :param runbook_name: Required. The name for this runbook. + :type runbook_name: str + :param webhook_resource_id: Required. The resource id for webhook linked + to this runbook. + :type webhook_resource_id: str + :param is_global_runbook: Required. Indicates whether this instance is + global runbook. + :type is_global_runbook: bool + :param name: Indicates name of the webhook. + :type name: str + :param service_uri: The URI where webhooks should be sent. + :type service_uri: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool + """ + + _validation = { + 'automation_account_id': {'required': True}, + 'runbook_name': {'required': True}, + 'webhook_resource_id': {'required': True}, + 'is_global_runbook': {'required': True}, + 'use_common_alert_schema': {'required': True}, + } + + _attribute_map = { + 'automation_account_id': {'key': 'automationAccountId', 'type': 'str'}, + 'runbook_name': {'key': 'runbookName', 'type': 'str'}, + 'webhook_resource_id': {'key': 'webhookResourceId', 'type': 'str'}, + 'is_global_runbook': {'key': 'isGlobalRunbook', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(AutomationRunbookReceiver, self).__init__(**kwargs) + self.automation_account_id = kwargs.get('automation_account_id', None) + self.runbook_name = kwargs.get('runbook_name', None) + self.webhook_resource_id = kwargs.get('webhook_resource_id', None) + self.is_global_runbook = kwargs.get('is_global_runbook', None) + self.name = kwargs.get('name', None) + self.service_uri = kwargs.get('service_uri', None) + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', None) + + +class AzureAppPushReceiver(Model): + """The Azure mobile App push notification receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the Azure mobile app push receiver. + Names must be unique across all receivers within an action group. + :type name: str + :param email_address: Required. The email address registered for the Azure + mobile app. + :type email_address: str + """ + + _validation = { + 'name': {'required': True}, + 'email_address': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AzureAppPushReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.email_address = kwargs.get('email_address', None) + + +class AzureFunctionReceiver(Model): + """An azure function receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the azure function receiver. Names must + be unique across all receivers within an action group. + :type name: str + :param function_app_resource_id: Required. The azure resource id of the + function app. + :type function_app_resource_id: str + :param function_name: Required. The function name in the function app. + :type function_name: str + :param http_trigger_url: Required. The http trigger url where http request + sent to. + :type http_trigger_url: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool + """ + + _validation = { + 'name': {'required': True}, + 'function_app_resource_id': {'required': True}, + 'function_name': {'required': True}, + 'http_trigger_url': {'required': True}, + 'use_common_alert_schema': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'function_app_resource_id': {'key': 'functionAppResourceId', 'type': 'str'}, + 'function_name': {'key': 'functionName', 'type': 'str'}, + 'http_trigger_url': {'key': 'httpTriggerUrl', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(AzureFunctionReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.function_app_resource_id = kwargs.get('function_app_resource_id', None) + self.function_name = kwargs.get('function_name', None) + self.http_trigger_url = kwargs.get('http_trigger_url', None) + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', None) + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class EmailReceiver(Model): + """An email receiver. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the email receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param email_address: Required. The email address of this receiver. + :type email_address: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool + :ivar status: The receiver status of the e-mail. Possible values include: + 'NotSpecified', 'Enabled', 'Disabled' + :vartype status: str or + ~azure.mgmt.monitor.v2019_06_01.models.ReceiverStatus + """ + + _validation = { + 'name': {'required': True}, + 'email_address': {'required': True}, + 'use_common_alert_schema': {'required': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, + 'status': {'key': 'status', 'type': 'ReceiverStatus'}, + } + + def __init__(self, **kwargs): + super(EmailReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.email_address = kwargs.get('email_address', None) + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', None) + self.status = None + + +class EnableRequest(Model): + """Describes a receiver that should be resubscribed. + + All required parameters must be populated in order to send to Azure. + + :param receiver_name: Required. The name of the receiver to resubscribe. + :type receiver_name: str + """ + + _validation = { + 'receiver_name': {'required': True}, + } + + _attribute_map = { + 'receiver_name': {'key': 'receiverName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(EnableRequest, self).__init__(**kwargs) + self.receiver_name = kwargs.get('receiver_name', None) + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class ItsmReceiver(Model): + """An Itsm receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the Itsm receiver. Names must be unique + across all receivers within an action group. + :type name: str + :param workspace_id: Required. OMS LA instance identifier. + :type workspace_id: str + :param connection_id: Required. Unique identification of ITSM connection + among multiple defined in above workspace. + :type connection_id: str + :param ticket_configuration: Required. JSON blob for the configurations of + the ITSM action. CreateMultipleWorkItems option will be part of this blob + as well. + :type ticket_configuration: str + :param region: Required. Region in which workspace resides. Supported + values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' + :type region: str + """ + + _validation = { + 'name': {'required': True}, + 'workspace_id': {'required': True}, + 'connection_id': {'required': True}, + 'ticket_configuration': {'required': True}, + 'region': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, + 'connection_id': {'key': 'connectionId', 'type': 'str'}, + 'ticket_configuration': {'key': 'ticketConfiguration', 'type': 'str'}, + 'region': {'key': 'region', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ItsmReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.workspace_id = kwargs.get('workspace_id', None) + self.connection_id = kwargs.get('connection_id', None) + self.ticket_configuration = kwargs.get('ticket_configuration', None) + self.region = kwargs.get('region', None) + + +class LogicAppReceiver(Model): + """A logic app receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the logic app receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param resource_id: Required. The azure resource id of the logic app + receiver. + :type resource_id: str + :param callback_url: Required. The callback url where http request sent + to. + :type callback_url: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool + """ + + _validation = { + 'name': {'required': True}, + 'resource_id': {'required': True}, + 'callback_url': {'required': True}, + 'use_common_alert_schema': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'callback_url': {'key': 'callbackUrl', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(LogicAppReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.resource_id = kwargs.get('resource_id', None) + self.callback_url = kwargs.get('callback_url', None) + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', None) + + +class SmsReceiver(Model): + """An SMS receiver. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the SMS receiver. Names must be unique + across all receivers within an action group. + :type name: str + :param country_code: Required. The country code of the SMS receiver. + :type country_code: str + :param phone_number: Required. The phone number of the SMS receiver. + :type phone_number: str + :ivar status: The status of the receiver. Possible values include: + 'NotSpecified', 'Enabled', 'Disabled' + :vartype status: str or + ~azure.mgmt.monitor.v2019_06_01.models.ReceiverStatus + """ + + _validation = { + 'name': {'required': True}, + 'country_code': {'required': True}, + 'phone_number': {'required': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'phone_number': {'key': 'phoneNumber', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'ReceiverStatus'}, + } + + def __init__(self, **kwargs): + super(SmsReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.country_code = kwargs.get('country_code', None) + self.phone_number = kwargs.get('phone_number', None) + self.status = None + + +class VoiceReceiver(Model): + """A voice receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the voice receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param country_code: Required. The country code of the voice receiver. + :type country_code: str + :param phone_number: Required. The phone number of the voice receiver. + :type phone_number: str + """ + + _validation = { + 'name': {'required': True}, + 'country_code': {'required': True}, + 'phone_number': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'phone_number': {'key': 'phoneNumber', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(VoiceReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.country_code = kwargs.get('country_code', None) + self.phone_number = kwargs.get('phone_number', None) + + +class WebhookReceiver(Model): + """A webhook receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the webhook receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param service_uri: Required. The URI where webhooks should be sent. + :type service_uri: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool + :param use_aad_auth: Indicates whether or not use AAD authentication. + Default value: False . + :type use_aad_auth: bool + :param object_id: Indicates the webhook app object Id for aad auth. + :type object_id: str + :param identifier_uri: Indicates the identifier uri for aad auth. + :type identifier_uri: str + :param tenant_id: Indicates the tenant id for aad auth. + :type tenant_id: str + """ + + _validation = { + 'name': {'required': True}, + 'service_uri': {'required': True}, + 'use_common_alert_schema': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, + 'use_aad_auth': {'key': 'useAadAuth', 'type': 'bool'}, + 'object_id': {'key': 'objectId', 'type': 'str'}, + 'identifier_uri': {'key': 'identifierUri', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(WebhookReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.service_uri = kwargs.get('service_uri', None) + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', None) + self.use_aad_auth = kwargs.get('use_aad_auth', False) + self.object_id = kwargs.get('object_id', None) + self.identifier_uri = kwargs.get('identifier_uri', None) + self.tenant_id = kwargs.get('tenant_id', None) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/_models_py3.py new file mode 100644 index 000000000000..132f0a8cc2d7 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/_models_py3.py @@ -0,0 +1,676 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ActionGroupPatchBody(Model): + """An action group object for the body of patch operations. + + :param tags: Resource tags + :type tags: dict[str, str] + :param enabled: Indicates whether this action group is enabled. If an + action group is not enabled, then none of its actions will be activated. + Default value: True . + :type enabled: bool + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + } + + def __init__(self, *, tags=None, enabled: bool=True, **kwargs) -> None: + super(ActionGroupPatchBody, self).__init__(**kwargs) + self.tags = tags + self.enabled = enabled + + +class Resource(Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, location: str, tags=None, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class ActionGroupResource(Resource): + """An action group resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param group_short_name: Required. The short name of the action group. + This will be used in SMS messages. + :type group_short_name: str + :param enabled: Required. Indicates whether this action group is enabled. + If an action group is not enabled, then none of its receivers will receive + communications. Default value: True . + :type enabled: bool + :param email_receivers: The list of email receivers that are part of this + action group. + :type email_receivers: + list[~azure.mgmt.monitor.v2019_06_01.models.EmailReceiver] + :param sms_receivers: The list of SMS receivers that are part of this + action group. + :type sms_receivers: + list[~azure.mgmt.monitor.v2019_06_01.models.SmsReceiver] + :param webhook_receivers: The list of webhook receivers that are part of + this action group. + :type webhook_receivers: + list[~azure.mgmt.monitor.v2019_06_01.models.WebhookReceiver] + :param itsm_receivers: The list of ITSM receivers that are part of this + action group. + :type itsm_receivers: + list[~azure.mgmt.monitor.v2019_06_01.models.ItsmReceiver] + :param azure_app_push_receivers: The list of AzureAppPush receivers that + are part of this action group. + :type azure_app_push_receivers: + list[~azure.mgmt.monitor.v2019_06_01.models.AzureAppPushReceiver] + :param automation_runbook_receivers: The list of AutomationRunbook + receivers that are part of this action group. + :type automation_runbook_receivers: + list[~azure.mgmt.monitor.v2019_06_01.models.AutomationRunbookReceiver] + :param voice_receivers: The list of voice receivers that are part of this + action group. + :type voice_receivers: + list[~azure.mgmt.monitor.v2019_06_01.models.VoiceReceiver] + :param logic_app_receivers: The list of logic app receivers that are part + of this action group. + :type logic_app_receivers: + list[~azure.mgmt.monitor.v2019_06_01.models.LogicAppReceiver] + :param azure_function_receivers: The list of azure function receivers that + are part of this action group. + :type azure_function_receivers: + list[~azure.mgmt.monitor.v2019_06_01.models.AzureFunctionReceiver] + :param arm_role_receivers: The list of ARM role receivers that are part of + this action group. Roles are Azure RBAC roles and only built-in roles are + supported. + :type arm_role_receivers: + list[~azure.mgmt.monitor.v2019_06_01.models.ArmRoleReceiver] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'group_short_name': {'required': True, 'max_length': 12}, + 'enabled': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'group_short_name': {'key': 'properties.groupShortName', 'type': 'str'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'email_receivers': {'key': 'properties.emailReceivers', 'type': '[EmailReceiver]'}, + 'sms_receivers': {'key': 'properties.smsReceivers', 'type': '[SmsReceiver]'}, + 'webhook_receivers': {'key': 'properties.webhookReceivers', 'type': '[WebhookReceiver]'}, + 'itsm_receivers': {'key': 'properties.itsmReceivers', 'type': '[ItsmReceiver]'}, + 'azure_app_push_receivers': {'key': 'properties.azureAppPushReceivers', 'type': '[AzureAppPushReceiver]'}, + 'automation_runbook_receivers': {'key': 'properties.automationRunbookReceivers', 'type': '[AutomationRunbookReceiver]'}, + 'voice_receivers': {'key': 'properties.voiceReceivers', 'type': '[VoiceReceiver]'}, + 'logic_app_receivers': {'key': 'properties.logicAppReceivers', 'type': '[LogicAppReceiver]'}, + 'azure_function_receivers': {'key': 'properties.azureFunctionReceivers', 'type': '[AzureFunctionReceiver]'}, + 'arm_role_receivers': {'key': 'properties.armRoleReceivers', 'type': '[ArmRoleReceiver]'}, + } + + def __init__(self, *, location: str, group_short_name: str, tags=None, enabled: bool=True, email_receivers=None, sms_receivers=None, webhook_receivers=None, itsm_receivers=None, azure_app_push_receivers=None, automation_runbook_receivers=None, voice_receivers=None, logic_app_receivers=None, azure_function_receivers=None, arm_role_receivers=None, **kwargs) -> None: + super(ActionGroupResource, self).__init__(location=location, tags=tags, **kwargs) + self.group_short_name = group_short_name + self.enabled = enabled + self.email_receivers = email_receivers + self.sms_receivers = sms_receivers + self.webhook_receivers = webhook_receivers + self.itsm_receivers = itsm_receivers + self.azure_app_push_receivers = azure_app_push_receivers + self.automation_runbook_receivers = automation_runbook_receivers + self.voice_receivers = voice_receivers + self.logic_app_receivers = logic_app_receivers + self.azure_function_receivers = azure_function_receivers + self.arm_role_receivers = arm_role_receivers + + +class ArmRoleReceiver(Model): + """An arm role receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the arm role receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param role_id: Required. The arm role id. + :type role_id: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool + """ + + _validation = { + 'name': {'required': True}, + 'role_id': {'required': True}, + 'use_common_alert_schema': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'role_id': {'key': 'roleId', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, + } + + def __init__(self, *, name: str, role_id: str, use_common_alert_schema: bool, **kwargs) -> None: + super(ArmRoleReceiver, self).__init__(**kwargs) + self.name = name + self.role_id = role_id + self.use_common_alert_schema = use_common_alert_schema + + +class AutomationRunbookReceiver(Model): + """The Azure Automation Runbook notification receiver. + + All required parameters must be populated in order to send to Azure. + + :param automation_account_id: Required. The Azure automation account Id + which holds this runbook and authenticate to Azure resource. + :type automation_account_id: str + :param runbook_name: Required. The name for this runbook. + :type runbook_name: str + :param webhook_resource_id: Required. The resource id for webhook linked + to this runbook. + :type webhook_resource_id: str + :param is_global_runbook: Required. Indicates whether this instance is + global runbook. + :type is_global_runbook: bool + :param name: Indicates name of the webhook. + :type name: str + :param service_uri: The URI where webhooks should be sent. + :type service_uri: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool + """ + + _validation = { + 'automation_account_id': {'required': True}, + 'runbook_name': {'required': True}, + 'webhook_resource_id': {'required': True}, + 'is_global_runbook': {'required': True}, + 'use_common_alert_schema': {'required': True}, + } + + _attribute_map = { + 'automation_account_id': {'key': 'automationAccountId', 'type': 'str'}, + 'runbook_name': {'key': 'runbookName', 'type': 'str'}, + 'webhook_resource_id': {'key': 'webhookResourceId', 'type': 'str'}, + 'is_global_runbook': {'key': 'isGlobalRunbook', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, + } + + def __init__(self, *, automation_account_id: str, runbook_name: str, webhook_resource_id: str, is_global_runbook: bool, use_common_alert_schema: bool, name: str=None, service_uri: str=None, **kwargs) -> None: + super(AutomationRunbookReceiver, self).__init__(**kwargs) + self.automation_account_id = automation_account_id + self.runbook_name = runbook_name + self.webhook_resource_id = webhook_resource_id + self.is_global_runbook = is_global_runbook + self.name = name + self.service_uri = service_uri + self.use_common_alert_schema = use_common_alert_schema + + +class AzureAppPushReceiver(Model): + """The Azure mobile App push notification receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the Azure mobile app push receiver. + Names must be unique across all receivers within an action group. + :type name: str + :param email_address: Required. The email address registered for the Azure + mobile app. + :type email_address: str + """ + + _validation = { + 'name': {'required': True}, + 'email_address': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + } + + def __init__(self, *, name: str, email_address: str, **kwargs) -> None: + super(AzureAppPushReceiver, self).__init__(**kwargs) + self.name = name + self.email_address = email_address + + +class AzureFunctionReceiver(Model): + """An azure function receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the azure function receiver. Names must + be unique across all receivers within an action group. + :type name: str + :param function_app_resource_id: Required. The azure resource id of the + function app. + :type function_app_resource_id: str + :param function_name: Required. The function name in the function app. + :type function_name: str + :param http_trigger_url: Required. The http trigger url where http request + sent to. + :type http_trigger_url: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool + """ + + _validation = { + 'name': {'required': True}, + 'function_app_resource_id': {'required': True}, + 'function_name': {'required': True}, + 'http_trigger_url': {'required': True}, + 'use_common_alert_schema': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'function_app_resource_id': {'key': 'functionAppResourceId', 'type': 'str'}, + 'function_name': {'key': 'functionName', 'type': 'str'}, + 'http_trigger_url': {'key': 'httpTriggerUrl', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, + } + + def __init__(self, *, name: str, function_app_resource_id: str, function_name: str, http_trigger_url: str, use_common_alert_schema: bool, **kwargs) -> None: + super(AzureFunctionReceiver, self).__init__(**kwargs) + self.name = name + self.function_app_resource_id = function_app_resource_id + self.function_name = function_name + self.http_trigger_url = http_trigger_url + self.use_common_alert_schema = use_common_alert_schema + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class EmailReceiver(Model): + """An email receiver. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the email receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param email_address: Required. The email address of this receiver. + :type email_address: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool + :ivar status: The receiver status of the e-mail. Possible values include: + 'NotSpecified', 'Enabled', 'Disabled' + :vartype status: str or + ~azure.mgmt.monitor.v2019_06_01.models.ReceiverStatus + """ + + _validation = { + 'name': {'required': True}, + 'email_address': {'required': True}, + 'use_common_alert_schema': {'required': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, + 'status': {'key': 'status', 'type': 'ReceiverStatus'}, + } + + def __init__(self, *, name: str, email_address: str, use_common_alert_schema: bool, **kwargs) -> None: + super(EmailReceiver, self).__init__(**kwargs) + self.name = name + self.email_address = email_address + self.use_common_alert_schema = use_common_alert_schema + self.status = None + + +class EnableRequest(Model): + """Describes a receiver that should be resubscribed. + + All required parameters must be populated in order to send to Azure. + + :param receiver_name: Required. The name of the receiver to resubscribe. + :type receiver_name: str + """ + + _validation = { + 'receiver_name': {'required': True}, + } + + _attribute_map = { + 'receiver_name': {'key': 'receiverName', 'type': 'str'}, + } + + def __init__(self, *, receiver_name: str, **kwargs) -> None: + super(EnableRequest, self).__init__(**kwargs) + self.receiver_name = receiver_name + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class ItsmReceiver(Model): + """An Itsm receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the Itsm receiver. Names must be unique + across all receivers within an action group. + :type name: str + :param workspace_id: Required. OMS LA instance identifier. + :type workspace_id: str + :param connection_id: Required. Unique identification of ITSM connection + among multiple defined in above workspace. + :type connection_id: str + :param ticket_configuration: Required. JSON blob for the configurations of + the ITSM action. CreateMultipleWorkItems option will be part of this blob + as well. + :type ticket_configuration: str + :param region: Required. Region in which workspace resides. Supported + values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' + :type region: str + """ + + _validation = { + 'name': {'required': True}, + 'workspace_id': {'required': True}, + 'connection_id': {'required': True}, + 'ticket_configuration': {'required': True}, + 'region': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, + 'connection_id': {'key': 'connectionId', 'type': 'str'}, + 'ticket_configuration': {'key': 'ticketConfiguration', 'type': 'str'}, + 'region': {'key': 'region', 'type': 'str'}, + } + + def __init__(self, *, name: str, workspace_id: str, connection_id: str, ticket_configuration: str, region: str, **kwargs) -> None: + super(ItsmReceiver, self).__init__(**kwargs) + self.name = name + self.workspace_id = workspace_id + self.connection_id = connection_id + self.ticket_configuration = ticket_configuration + self.region = region + + +class LogicAppReceiver(Model): + """A logic app receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the logic app receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param resource_id: Required. The azure resource id of the logic app + receiver. + :type resource_id: str + :param callback_url: Required. The callback url where http request sent + to. + :type callback_url: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool + """ + + _validation = { + 'name': {'required': True}, + 'resource_id': {'required': True}, + 'callback_url': {'required': True}, + 'use_common_alert_schema': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'callback_url': {'key': 'callbackUrl', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, + } + + def __init__(self, *, name: str, resource_id: str, callback_url: str, use_common_alert_schema: bool, **kwargs) -> None: + super(LogicAppReceiver, self).__init__(**kwargs) + self.name = name + self.resource_id = resource_id + self.callback_url = callback_url + self.use_common_alert_schema = use_common_alert_schema + + +class SmsReceiver(Model): + """An SMS receiver. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the SMS receiver. Names must be unique + across all receivers within an action group. + :type name: str + :param country_code: Required. The country code of the SMS receiver. + :type country_code: str + :param phone_number: Required. The phone number of the SMS receiver. + :type phone_number: str + :ivar status: The status of the receiver. Possible values include: + 'NotSpecified', 'Enabled', 'Disabled' + :vartype status: str or + ~azure.mgmt.monitor.v2019_06_01.models.ReceiverStatus + """ + + _validation = { + 'name': {'required': True}, + 'country_code': {'required': True}, + 'phone_number': {'required': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'phone_number': {'key': 'phoneNumber', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'ReceiverStatus'}, + } + + def __init__(self, *, name: str, country_code: str, phone_number: str, **kwargs) -> None: + super(SmsReceiver, self).__init__(**kwargs) + self.name = name + self.country_code = country_code + self.phone_number = phone_number + self.status = None + + +class VoiceReceiver(Model): + """A voice receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the voice receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param country_code: Required. The country code of the voice receiver. + :type country_code: str + :param phone_number: Required. The phone number of the voice receiver. + :type phone_number: str + """ + + _validation = { + 'name': {'required': True}, + 'country_code': {'required': True}, + 'phone_number': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'phone_number': {'key': 'phoneNumber', 'type': 'str'}, + } + + def __init__(self, *, name: str, country_code: str, phone_number: str, **kwargs) -> None: + super(VoiceReceiver, self).__init__(**kwargs) + self.name = name + self.country_code = country_code + self.phone_number = phone_number + + +class WebhookReceiver(Model): + """A webhook receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the webhook receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param service_uri: Required. The URI where webhooks should be sent. + :type service_uri: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool + :param use_aad_auth: Indicates whether or not use AAD authentication. + Default value: False . + :type use_aad_auth: bool + :param object_id: Indicates the webhook app object Id for aad auth. + :type object_id: str + :param identifier_uri: Indicates the identifier uri for aad auth. + :type identifier_uri: str + :param tenant_id: Indicates the tenant id for aad auth. + :type tenant_id: str + """ + + _validation = { + 'name': {'required': True}, + 'service_uri': {'required': True}, + 'use_common_alert_schema': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, + 'use_aad_auth': {'key': 'useAadAuth', 'type': 'bool'}, + 'object_id': {'key': 'objectId', 'type': 'str'}, + 'identifier_uri': {'key': 'identifierUri', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + } + + def __init__(self, *, name: str, service_uri: str, use_common_alert_schema: bool, use_aad_auth: bool=False, object_id: str=None, identifier_uri: str=None, tenant_id: str=None, **kwargs) -> None: + super(WebhookReceiver, self).__init__(**kwargs) + self.name = name + self.service_uri = service_uri + self.use_common_alert_schema = use_common_alert_schema + self.use_aad_auth = use_aad_auth + self.object_id = object_id + self.identifier_uri = identifier_uri + self.tenant_id = tenant_id diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/_monitor_management_client_enums.py new file mode 100644 index 000000000000..b6d8fd20db3d --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/_monitor_management_client_enums.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum + + +class ReceiverStatus(str, Enum): + + not_specified = "NotSpecified" + enabled = "Enabled" + disabled = "Disabled" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/_paged_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/_paged_models.py new file mode 100644 index 000000000000..b047627173b5 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/_paged_models.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class ActionGroupResourcePaged(Paged): + """ + A paging container for iterating over a list of :class:`ActionGroupResource ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ActionGroupResource]'} + } + + def __init__(self, *args, **kwargs): + + super(ActionGroupResourcePaged, self).__init__(*args, **kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/operations/__init__.py new file mode 100644 index 000000000000..58f2b2e95c6b --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/operations/__init__.py @@ -0,0 +1,16 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._action_groups_operations import ActionGroupsOperations + +__all__ = [ + 'ActionGroupsOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/operations/_action_groups_operations.py new file mode 100644 index 000000000000..b793ea1b1c3f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/operations/_action_groups_operations.py @@ -0,0 +1,488 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class ActionGroupsOperations(object): + """ActionGroupsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2019-06-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-06-01" + + self.config = config + + def create_or_update( + self, resource_group_name, action_group_name, action_group, custom_headers=None, raw=False, **operation_config): + """Create a new action group or update an existing one. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param action_group_name: The name of the action group. + :type action_group_name: str + :param action_group: The action group to create or use for the update. + :type action_group: + ~azure.mgmt.monitor.v2019_06_01.models.ActionGroupResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ActionGroupResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2019_06_01.models.ActionGroupResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(action_group, 'ActionGroupResource') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ActionGroupResource', response) + if response.status_code == 201: + deserialized = self._deserialize('ActionGroupResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} + + def get( + self, resource_group_name, action_group_name, custom_headers=None, raw=False, **operation_config): + """Get an action group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param action_group_name: The name of the action group. + :type action_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ActionGroupResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2019_06_01.models.ActionGroupResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ActionGroupResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} + + def delete( + self, resource_group_name, action_group_name, custom_headers=None, raw=False, **operation_config): + """Delete an action group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param action_group_name: The name of the action group. + :type action_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} + + def update( + self, resource_group_name, action_group_name, tags=None, enabled=True, custom_headers=None, raw=False, **operation_config): + """Updates an existing action group's tags. To update other fields use the + CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param action_group_name: The name of the action group. + :type action_group_name: str + :param tags: Resource tags + :type tags: dict[str, str] + :param enabled: Indicates whether this action group is enabled. If an + action group is not enabled, then none of its actions will be + activated. + :type enabled: bool + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ActionGroupResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.v2019_06_01.models.ActionGroupResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + action_group_patch = models.ActionGroupPatchBody(tags=tags, enabled=enabled) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(action_group_patch, 'ActionGroupPatchBody') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ActionGroupResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} + + def list_by_subscription_id( + self, custom_headers=None, raw=False, **operation_config): + """Get a list of all action groups in a subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ActionGroupResource + :rtype: + ~azure.mgmt.monitor.v2019_06_01.models.ActionGroupResourcePaged[~azure.mgmt.monitor.v2019_06_01.models.ActionGroupResource] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription_id.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ActionGroupResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Get a list of all action groups in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ActionGroupResource + :rtype: + ~azure.mgmt.monitor.v2019_06_01.models.ActionGroupResourcePaged[~azure.mgmt.monitor.v2019_06_01.models.ActionGroupResource] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ActionGroupResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups'} + + def enable_receiver( + self, resource_group_name, action_group_name, receiver_name, custom_headers=None, raw=False, **operation_config): + """Enable a receiver in an action group. This changes the receiver's + status from Disabled to Enabled. This operation is only supported for + Email or SMS receivers. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param action_group_name: The name of the action group. + :type action_group_name: str + :param receiver_name: The name of the receiver to resubscribe. + :type receiver_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + enable_request = models.EnableRequest(receiver_name=receiver_name) + + # Construct URL + url = self.enable_receiver.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(enable_request, 'EnableRequest') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 409]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + enable_receiver.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/version.py new file mode 100644 index 000000000000..4174449873ab --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2019-06-01" +