From 97566d6a568a06807471ac1f279b6d305ee9130e Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 30 Mar 2022 08:36:49 +0000 Subject: [PATCH] CodeGen from PR 18065 in Azure/azure-rest-api-specs Update readme.go.md (#18065) * Update readme.go.md Enable 2021-05-01-preview diagnostic setting api for Go * Added 2202-03 tag and update go file * Add output folder * Add 'package-2022-03' to directives condition * Update package-2022-03 resources (DCR, DCRA, DCE) * Set Monitor to package-2022-03 * Split packages 1 * Split packages 1 (fix on go output folder) * Split packages second attempt * Split packages third attempt * Split packages four attempt * Split packages fifth attempt * Fix folders * fixing go output folder * fix * test * namespace * fix namespace Co-authored-by: ArcturusZhang Co-authored-by: Jorge Herrera <69991673+herreraj-ms@users.noreply.github.com> Co-authored-by: Jorge Herrera --- .../mgmt/2020-10-01/activitylogs/CHANGELOG.md | 2 + .../mgmt/2020-10-01/activitylogs/_meta.json | 11 + .../2020-10-01/activitylogs}/activitylogs.go | 52 +- .../activitylogsapi/interfaces.go | 43 + .../mgmt/2020-10-01/activitylogs/alerts.go} | 298 +- .../mgmt/2020-10-01/activitylogs/client.go | 41 + .../mgmt/2020-10-01/activitylogs/enums.go | 28 + .../mgmt/2020-10-01/activitylogs/models.go | 703 ++ .../activitylogs}/tenantactivitylogs.go | 16 +- .../mgmt/2020-10-01/activitylogs}/version.go | 4 +- .../mgmt/2020-10-01/insights/CHANGELOG.md | 2 +- .../mgmt/2020-10-01/insights/_meta.json | 6 +- .../2020-10-01/insights/activitylogalerts.go | 15 +- .../scheduledqueryrules/CHANGELOG.md | 2 + .../2021-08-01/scheduledqueryrules/_meta.json | 11 + .../2021-08-01/scheduledqueryrules/client.go | 41 + .../2021-08-01/scheduledqueryrules/enums.go | 98 + .../2021-08-01/scheduledqueryrules/models.go | 671 ++ .../scheduledqueryrules.go | 309 +- .../scheduledqueryrulesapi/interfaces.go | 27 + .../2021-08-01/scheduledqueryrules/version.go | 19 + .../monitorlegacy/CHANGELOG.md | 2 + .../monitorlegacy/_meta.json | 11 + .../monitorlegacy}/alertruleincidents.go | 18 +- .../monitorlegacy}/alertrules.go | 50 +- .../monitorlegacy/client.go | 41 + .../2016-03-01-preview/monitorlegacy/enums.go | 132 + .../monitorlegacy}/eventcategories.go | 10 +- .../monitorlegacy}/logprofiles.go | 52 +- .../monitorlegacy/models.go | 1678 ++++ .../monitorlegacyapi/interfaces.go | 58 + .../monitorlegacy/version.go | 19 + .../monitorlegacy}/vminsights.go | 8 +- .../2017-05-01-preview/insights/CHANGELOG.md | 72 +- .../2017-05-01-preview/insights/_meta.json | 2 +- .../insights/actiongroups.go | 68 +- .../insights/activitylogalerts.go | 57 +- .../insights/activitylogs.go | 9 +- .../insights/alertruleincidents.go | 23 +- .../2017-05-01-preview/insights/alertrules.go | 71 +- .../insights/autoscalesettings.go | 71 +- .../insights/diagnosticsettings.go | 8 +- .../insights/diagnosticsettingscategory.go | 4 +- .../mgmt/2017-05-01-preview/insights/enums.go | 35 +- .../insights/eventcategories.go | 2 +- .../insights/insightsapi/interfaces.go | 8 - .../insights/logprofiles.go | 38 +- .../insights/metricbaseline.go | 217 - .../2017-05-01-preview/insights/models.go | 224 +- .../2017-05-01-preview/insights/operations.go | 2 +- .../insights/tenantactivitylogs.go | 2 +- .../mgmt/2018-03-01/insights/CHANGELOG.md | 158 +- .../mgmt/2018-03-01/insights/_meta.json | 2 +- .../mgmt/2018-03-01/insights/actiongroups.go | 68 +- .../2018-03-01/insights/activitylogalerts.go | 57 +- .../mgmt/2018-03-01/insights/activitylogs.go | 9 +- .../2018-03-01/insights/alertruleincidents.go | 23 +- .../mgmt/2018-03-01/insights/alertrules.go | 71 +- .../2018-03-01/insights/autoscalesettings.go | 71 +- .../2018-03-01/insights/diagnosticsettings.go | 8 +- .../insights/diagnosticsettingscategory.go | 4 +- .../monitor/mgmt/2018-03-01/insights/enums.go | 151 +- .../2018-03-01/insights/eventcategories.go | 2 +- .../insights/insightsapi/interfaces.go | 8 - .../mgmt/2018-03-01/insights/logprofiles.go | 38 +- .../mgmt/2018-03-01/insights/metricalerts.go | 61 +- .../2018-03-01/insights/metricalertsstatus.go | 23 +- .../2018-03-01/insights/metricbaseline.go | 217 - .../2018-03-01/insights/metricdefinitions.go | 2 +- .../mgmt/2018-03-01/insights/metrics.go | 22 +- .../mgmt/2018-03-01/insights/models.go | 707 +- .../mgmt/2018-03-01/insights/operations.go | 2 +- .../insights/scheduledqueryrules.go | 69 +- .../2018-03-01/insights/tenantactivitylogs.go | 2 +- .../mgmt/2018-09-01/insights/CHANGELOG.md | 191 +- .../mgmt/2018-09-01/insights/_meta.json | 2 +- .../mgmt/2018-09-01/insights/actiongroups.go | 68 +- .../2018-09-01/insights/activitylogalerts.go | 57 +- .../mgmt/2018-09-01/insights/activitylogs.go | 9 +- .../2018-09-01/insights/alertruleincidents.go | 23 +- .../mgmt/2018-09-01/insights/alertrules.go | 71 +- .../2018-09-01/insights/autoscalesettings.go | 71 +- .../insights/baselines.go | 9 +- .../2018-09-01/insights/diagnosticsettings.go | 8 +- .../insights/diagnosticsettingscategory.go | 4 +- .../monitor/mgmt/2018-09-01/insights/enums.go | 182 +- .../2018-09-01/insights/eventcategories.go | 2 +- .../insights/insightsapi/interfaces.go | 16 +- .../mgmt/2018-09-01/insights/logprofiles.go | 38 +- .../mgmt/2018-09-01/insights/metricalerts.go | 61 +- .../2018-09-01/insights/metricalertsstatus.go | 23 +- .../2018-09-01/insights/metricbaseline.go | 217 - .../2018-09-01/insights/metricdefinitions.go | 2 +- .../mgmt/2018-09-01/insights/metrics.go | 22 +- .../mgmt/2018-09-01/insights/models.go | 793 +- .../mgmt/2018-09-01/insights/operations.go | 2 +- .../insights/scheduledqueryrules.go | 69 +- .../2018-09-01/insights/tenantactivitylogs.go | 2 +- .../2018-11-01-preview/insights/CHANGELOG.md | 163 +- .../2018-11-01-preview/insights/_meta.json | 2 +- .../insights/actiongroups.go | 68 +- .../insights/activitylogalerts.go | 57 +- .../insights/activitylogs.go | 9 +- .../insights/alertruleincidents.go | 23 +- .../2018-11-01-preview/insights/alertrules.go | 71 +- .../insights/autoscalesettings.go | 71 +- .../insights/diagnosticsettings.go | 8 +- .../insights/diagnosticsettingscategory.go | 4 +- .../mgmt/2018-11-01-preview/insights/enums.go | 168 +- .../insights/eventcategories.go | 2 +- .../insights/insightsapi/interfaces.go | 8 - .../insights/logprofiles.go | 38 +- .../insights/metricalerts.go | 61 +- .../insights/metricalertsstatus.go | 23 +- .../insights/metricbaseline.go | 217 - .../insights/metricdefinitions.go | 2 +- .../2018-11-01-preview/insights/metrics.go | 22 +- .../2018-11-01-preview/insights/models.go | 713 +- .../2018-11-01-preview/insights/operations.go | 2 +- .../insights/scheduledqueryrules.go | 69 +- .../insights/tenantactivitylogs.go | 2 +- .../mgmt/2019-03-01/insights/CHANGELOG.md | 167 +- .../mgmt/2019-03-01/insights/_meta.json | 2 +- .../mgmt/2019-03-01/insights/actiongroups.go | 68 +- .../2019-03-01/insights/activitylogalerts.go | 57 +- .../mgmt/2019-03-01/insights/activitylogs.go | 9 +- .../2019-03-01/insights/alertruleincidents.go | 23 +- .../mgmt/2019-03-01/insights/alertrules.go | 71 +- .../2019-03-01/insights/autoscalesettings.go | 71 +- .../mgmt/2019-03-01/insights/baselines.go | 22 +- .../2019-03-01/insights/diagnosticsettings.go | 8 +- .../insights/diagnosticsettingscategory.go | 4 +- .../monitor/mgmt/2019-03-01/insights/enums.go | 168 +- .../2019-03-01/insights/eventcategories.go | 2 +- .../insights/insightsapi/interfaces.go | 8 - .../mgmt/2019-03-01/insights/logprofiles.go | 38 +- .../mgmt/2019-03-01/insights/metricalerts.go | 61 +- .../2019-03-01/insights/metricalertsstatus.go | 23 +- .../2019-03-01/insights/metricbaseline.go | 217 - .../2019-03-01/insights/metricdefinitions.go | 2 +- .../mgmt/2019-03-01/insights/metrics.go | 22 +- .../mgmt/2019-03-01/insights/models.go | 741 +- .../mgmt/2019-03-01/insights/operations.go | 2 +- .../insights/scheduledqueryrules.go | 69 +- .../2019-03-01/insights/tenantactivitylogs.go | 2 +- .../mgmt/2019-06-01/insights/CHANGELOG.md | 167 +- .../mgmt/2019-06-01/insights/_meta.json | 2 +- .../mgmt/2019-06-01/insights/actiongroups.go | 68 +- .../2019-06-01/insights/activitylogalerts.go | 57 +- .../mgmt/2019-06-01/insights/activitylogs.go | 9 +- .../2019-06-01/insights/alertruleincidents.go | 23 +- .../mgmt/2019-06-01/insights/alertrules.go | 71 +- .../2019-06-01/insights/autoscalesettings.go | 71 +- .../mgmt/2019-06-01/insights/baselines.go | 22 +- .../2019-06-01/insights/diagnosticsettings.go | 8 +- .../insights/diagnosticsettingscategory.go | 4 +- .../monitor/mgmt/2019-06-01/insights/enums.go | 168 +- .../2019-06-01/insights/eventcategories.go | 2 +- .../insights/insightsapi/interfaces.go | 8 - .../mgmt/2019-06-01/insights/logprofiles.go | 38 +- .../mgmt/2019-06-01/insights/metricalerts.go | 61 +- .../2019-06-01/insights/metricalertsstatus.go | 23 +- .../2019-06-01/insights/metricbaseline.go | 217 - .../2019-06-01/insights/metricdefinitions.go | 2 +- .../mgmt/2019-06-01/insights/metrics.go | 22 +- .../mgmt/2019-06-01/insights/models.go | 741 +- .../mgmt/2019-06-01/insights/operations.go | 2 +- .../insights/scheduledqueryrules.go | 69 +- .../2019-06-01/insights/tenantactivitylogs.go | 2 +- .../2019-11-01-preview/insights/CHANGELOG.md | 163 +- .../2019-11-01-preview/insights/_meta.json | 2 +- .../insights/actiongroups.go | 32 +- .../insights/activitylogalerts.go | 33 +- .../insights/activitylogs.go | 2 +- .../insights/alertruleincidents.go | 10 +- .../2019-11-01-preview/insights/alertrules.go | 39 +- .../insights/autoscalesettings.go | 39 +- .../2019-11-01-preview/insights/baselines.go | 20 +- .../insights/diagnosticsettings.go | 8 +- .../insights/diagnosticsettingscategory.go | 4 +- .../mgmt/2019-11-01-preview/insights/enums.go | 168 +- .../insights/eventcategories.go | 2 +- .../insights/insightsapi/interfaces.go | 8 - .../insights/logprofiles.go | 10 +- .../insights/metricalerts.go | 37 +- .../insights/metricalertsstatus.go | 14 +- .../insights/metricbaseline.go | 217 - .../insights/metricdefinitions.go | 2 +- .../2019-11-01-preview/insights/metrics.go | 22 +- .../2019-11-01-preview/insights/models.go | 542 +- .../2019-11-01-preview/insights/operations.go | 2 +- .../insights/privateendpointconnections.go | 26 +- .../insights/privatelinkresources.go | 14 +- .../insights/privatelinkscopedresources.go | 28 +- .../privatelinkscopeoperationstatus.go | 5 +- .../insights/privatelinkscopes.go | 25 +- .../insights/scheduledqueryrules.go | 39 +- .../insights/tenantactivitylogs.go | 2 +- .../2021-04-01-preview/insights/CHANGELOG.md | 2 - .../2021-04-01-preview/insights/_meta.json | 11 - .../datacollectionruleassociations.go | 534 - .../insights/diagnosticsettingscategory.go | 193 - .../mgmt/2021-04-01-preview/insights/enums.go | 989 -- .../insights/insightsapi/interfaces.go | 291 - .../insights/metricdefinitions.go | 116 - .../insights/metricnamespaces.go | 116 - .../2021-04-01-preview/insights/models.go | 8744 ----------------- .../diagnostics/CHANGELOG.md | 2 + .../2021-05-01-preview/diagnostics/_meta.json | 11 + .../diagnostics}/actiongroups.go | 255 +- .../diagnostics}/autoscalesettings.go | 99 +- .../2021-05-01-preview/diagnostics/client.go | 41 + .../diagnostics/diagnosticsapi/interfaces.go | 137 + .../2021-05-01-preview/diagnostics/enums.go | 272 + .../managementgroupdiagnosticsettings.go | 334 + .../2021-05-01-preview/diagnostics/models.go | 2780 ++++++ .../diagnostics/predictivemetric.go | 130 + .../privateendpointconnections.go | 96 +- .../diagnostics}/privatelinkresources.go | 74 +- .../privatelinkscopedresources.go | 45 +- .../privatelinkscopeoperationstatus.go | 12 +- .../diagnostics}/privatelinkscopes.go | 76 +- .../diagnostics/settings.go} | 127 +- .../diagnostics/settingscategory.go | 180 + .../subscriptiondiagnosticsettings.go | 353 + .../2021-05-01-preview/diagnostics/version.go | 19 + .../2021-05-01-preview/metrics/CHANGELOG.md | 2 + .../2021-05-01-preview/metrics/_meta.json | 11 + .../metrics/alerts.go} | 140 +- .../metrics/alertsstatus.go} | 57 +- .../metrics/baselines.go} | 85 +- .../metrics}/client.go | 8 +- .../2021-05-01-preview/metrics/definitions.go | 193 + .../mgmt/2021-05-01-preview/metrics/enums.go | 324 + .../2021-05-01-preview/metrics/metrics.go | 449 + .../metrics/metricsapi/interfaces.go | 71 + .../mgmt/2021-05-01-preview/metrics/models.go | 2336 +++++ .../metrics/namespaces.go} | 37 +- .../metrics}/operations.go | 12 +- .../2021-05-01-preview/metrics/version.go | 19 + .../2021-07-01-preview/insights/CHANGELOG.md | 7 +- .../2021-07-01-preview/insights/_meta.json | 2 +- .../mgmt/2021-07-01-preview/insights/enums.go | 4 +- .../2021-07-01-preview/insights/models.go | 2 +- .../datacollection/CHANGELOG.md | 2 + .../datacollection/_meta.json | 11 + .../datacollection/client.go | 41 + .../datacollectionapi/interfaces.go | 56 + .../datacollection/endpoints.go} | 189 +- .../datacollection/enums.go | 360 + .../datacollection/models.go | 1540 +++ .../datacollection/ruleassociations.go | 661 ++ .../datacollection/rules.go} | 189 +- .../datacollection/version.go | 19 + .../2021-09-01-preview/insights/CHANGELOG.md | 2 +- .../2021-09-01-preview/insights/_meta.json | 2 +- 256 files changed, 23188 insertions(+), 15822 deletions(-) create mode 100644 services/monitor/mgmt/2020-10-01/activitylogs/CHANGELOG.md create mode 100644 services/monitor/mgmt/2020-10-01/activitylogs/_meta.json rename services/{preview/monitor/mgmt/2021-04-01-preview/insights => monitor/mgmt/2020-10-01/activitylogs}/activitylogs.go (66%) create mode 100644 services/monitor/mgmt/2020-10-01/activitylogs/activitylogsapi/interfaces.go rename services/{preview/monitor/mgmt/2021-04-01-preview/insights/activitylogalerts.go => monitor/mgmt/2020-10-01/activitylogs/alerts.go} (52%) create mode 100644 services/monitor/mgmt/2020-10-01/activitylogs/client.go create mode 100644 services/monitor/mgmt/2020-10-01/activitylogs/enums.go create mode 100644 services/monitor/mgmt/2020-10-01/activitylogs/models.go rename services/{preview/monitor/mgmt/2021-04-01-preview/insights => monitor/mgmt/2020-10-01/activitylogs}/tenantactivitylogs.go (88%) rename services/{preview/monitor/mgmt/2021-04-01-preview/insights => monitor/mgmt/2020-10-01/activitylogs}/version.go (86%) create mode 100644 services/monitor/mgmt/2021-08-01/scheduledqueryrules/CHANGELOG.md create mode 100644 services/monitor/mgmt/2021-08-01/scheduledqueryrules/_meta.json create mode 100644 services/monitor/mgmt/2021-08-01/scheduledqueryrules/client.go create mode 100644 services/monitor/mgmt/2021-08-01/scheduledqueryrules/enums.go create mode 100644 services/monitor/mgmt/2021-08-01/scheduledqueryrules/models.go rename services/{preview/monitor/mgmt/2021-04-01-preview/insights => monitor/mgmt/2021-08-01/scheduledqueryrules}/scheduledqueryrules.go (54%) create mode 100644 services/monitor/mgmt/2021-08-01/scheduledqueryrules/scheduledqueryrulesapi/interfaces.go create mode 100644 services/monitor/mgmt/2021-08-01/scheduledqueryrules/version.go create mode 100644 services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/CHANGELOG.md create mode 100644 services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/_meta.json rename services/preview/monitor/mgmt/{2021-04-01-preview/insights => 2016-03-01-preview/monitorlegacy}/alertruleincidents.go (88%) rename services/preview/monitor/mgmt/{2021-04-01-preview/insights => 2016-03-01-preview/monitorlegacy}/alertrules.go (87%) create mode 100644 services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/client.go create mode 100644 services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/enums.go rename services/preview/monitor/mgmt/{2021-04-01-preview/insights => 2016-03-01-preview/monitorlegacy}/eventcategories.go (88%) rename services/preview/monitor/mgmt/{2021-04-01-preview/insights => 2016-03-01-preview/monitorlegacy}/logprofiles.go (84%) create mode 100644 services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/models.go create mode 100644 services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/monitorlegacyapi/interfaces.go create mode 100644 services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/version.go rename services/preview/monitor/mgmt/{2021-04-01-preview/insights => 2016-03-01-preview/monitorlegacy}/vminsights.go (90%) delete mode 100644 services/preview/monitor/mgmt/2017-05-01-preview/insights/metricbaseline.go delete mode 100644 services/preview/monitor/mgmt/2018-03-01/insights/metricbaseline.go rename services/preview/monitor/mgmt/{2021-04-01-preview => 2018-09-01}/insights/baselines.go (94%) delete mode 100644 services/preview/monitor/mgmt/2018-09-01/insights/metricbaseline.go delete mode 100644 services/preview/monitor/mgmt/2018-11-01-preview/insights/metricbaseline.go delete mode 100644 services/preview/monitor/mgmt/2019-03-01/insights/metricbaseline.go delete mode 100644 services/preview/monitor/mgmt/2019-06-01/insights/metricbaseline.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/metricbaseline.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/CHANGELOG.md delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/_meta.json delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/datacollectionruleassociations.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/diagnosticsettingscategory.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/enums.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/insightsapi/interfaces.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/metricdefinitions.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/metricnamespaces.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/models.go create mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/CHANGELOG.md create mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/_meta.json rename services/preview/monitor/mgmt/{2021-04-01-preview/insights => 2021-05-01-preview/diagnostics}/actiongroups.go (67%) rename services/preview/monitor/mgmt/{2021-04-01-preview/insights => 2021-05-01-preview/diagnostics}/autoscalesettings.go (81%) create mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/client.go create mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/diagnosticsapi/interfaces.go create mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/enums.go create mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/managementgroupdiagnosticsettings.go create mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/models.go create mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/predictivemetric.go rename services/preview/monitor/mgmt/{2021-04-01-preview/insights => 2021-05-01-preview/diagnostics}/privateendpointconnections.go (77%) rename services/preview/monitor/mgmt/{2021-04-01-preview/insights => 2021-05-01-preview/diagnostics}/privatelinkresources.go (70%) rename services/preview/monitor/mgmt/{2021-04-01-preview/insights => 2021-05-01-preview/diagnostics}/privatelinkscopedresources.go (86%) rename services/preview/monitor/mgmt/{2021-04-01-preview/insights => 2021-05-01-preview/diagnostics}/privatelinkscopeoperationstatus.go (88%) rename services/preview/monitor/mgmt/{2021-04-01-preview/insights => 2021-05-01-preview/diagnostics}/privatelinkscopes.go (84%) rename services/preview/monitor/mgmt/{2021-04-01-preview/insights/diagnosticsettings.go => 2021-05-01-preview/diagnostics/settings.go} (52%) create mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/settingscategory.go create mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/subscriptiondiagnosticsettings.go create mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/version.go create mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/metrics/CHANGELOG.md create mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/metrics/_meta.json rename services/preview/monitor/mgmt/{2021-04-01-preview/insights/metricalerts.go => 2021-05-01-preview/metrics/alerts.go} (66%) rename services/preview/monitor/mgmt/{2021-04-01-preview/insights/metricalertsstatus.go => 2021-05-01-preview/metrics/alertsstatus.go} (65%) rename services/preview/monitor/mgmt/{2021-04-01-preview/insights/metrics.go => 2021-05-01-preview/metrics/baselines.go} (56%) rename services/preview/monitor/mgmt/{2021-04-01-preview/insights => 2021-05-01-preview/metrics}/client.go (84%) create mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/metrics/definitions.go create mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/metrics/enums.go create mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/metrics/metrics.go create mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/metrics/metricsapi/interfaces.go create mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/metrics/models.go rename services/preview/monitor/mgmt/{2018-09-01/insights/metricnamespaces.go => 2021-05-01-preview/metrics/namespaces.go} (58%) rename services/preview/monitor/mgmt/{2021-04-01-preview/insights => 2021-05-01-preview/metrics}/operations.go (87%) create mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/metrics/version.go create mode 100644 services/preview/monitor/mgmt/2021-09-01-preview/datacollection/CHANGELOG.md create mode 100644 services/preview/monitor/mgmt/2021-09-01-preview/datacollection/_meta.json create mode 100644 services/preview/monitor/mgmt/2021-09-01-preview/datacollection/client.go create mode 100644 services/preview/monitor/mgmt/2021-09-01-preview/datacollection/datacollectionapi/interfaces.go rename services/preview/monitor/mgmt/{2021-04-01-preview/insights/datacollectionendpoints.go => 2021-09-01-preview/datacollection/endpoints.go} (61%) create mode 100644 services/preview/monitor/mgmt/2021-09-01-preview/datacollection/enums.go create mode 100644 services/preview/monitor/mgmt/2021-09-01-preview/datacollection/models.go create mode 100644 services/preview/monitor/mgmt/2021-09-01-preview/datacollection/ruleassociations.go rename services/preview/monitor/mgmt/{2021-04-01-preview/insights/datacollectionrules.go => 2021-09-01-preview/datacollection/rules.go} (62%) create mode 100644 services/preview/monitor/mgmt/2021-09-01-preview/datacollection/version.go diff --git a/services/monitor/mgmt/2020-10-01/activitylogs/CHANGELOG.md b/services/monitor/mgmt/2020-10-01/activitylogs/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/monitor/mgmt/2020-10-01/activitylogs/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/monitor/mgmt/2020-10-01/activitylogs/_meta.json b/services/monitor/mgmt/2020-10-01/activitylogs/_meta.json new file mode 100644 index 000000000000..0a99b460217e --- /dev/null +++ b/services/monitor/mgmt/2020-10-01/activitylogs/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "83f6c7b9ac240d3862e909245f0a61d70ae33908", + "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", + "tag": "package-2020-10-activityLogs", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2020-10-activityLogs --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/activitylogs.go b/services/monitor/mgmt/2020-10-01/activitylogs/activitylogs.go similarity index 66% rename from services/preview/monitor/mgmt/2021-04-01-preview/insights/activitylogs.go rename to services/monitor/mgmt/2020-10-01/activitylogs/activitylogs.go index 468cd15e3148..b136facbbc2f 100644 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/activitylogs.go +++ b/services/monitor/mgmt/2020-10-01/activitylogs/activitylogs.go @@ -1,4 +1,4 @@ -package insights +package activitylogs // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -15,20 +15,20 @@ import ( "net/http" ) -// ActivityLogsClient is the monitor Management Client -type ActivityLogsClient struct { +// Client is the monitor Management Client +type Client struct { BaseClient } -// NewActivityLogsClient creates an instance of the ActivityLogsClient client. -func NewActivityLogsClient(subscriptionID string) ActivityLogsClient { - return NewActivityLogsClientWithBaseURI(DefaultBaseURI, subscriptionID) +// NewClient creates an instance of the Client client. +func NewClient(subscriptionID string) Client { + return NewClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// NewActivityLogsClientWithBaseURI creates an instance of the ActivityLogsClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewActivityLogsClientWithBaseURI(baseURI string, subscriptionID string) ActivityLogsClient { - return ActivityLogsClient{NewWithBaseURI(baseURI, subscriptionID)} +// NewClientWithBaseURI creates an instance of the Client client using a custom endpoint. Use this when interacting +// with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewClientWithBaseURI(baseURI string, subscriptionID string) Client { + return Client{NewWithBaseURI(baseURI, subscriptionID)} } // List provides the list of records from the activity logs. @@ -50,9 +50,9 @@ func NewActivityLogsClientWithBaseURI(baseURI string, subscriptionID string) Act // *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, // *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, // *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* -func (client ActivityLogsClient) List(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionPage, err error) { +func (client Client) List(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionPage, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogsClient.List") + ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") defer func() { sc := -1 if result.edc.Response.Response != nil { @@ -64,26 +64,26 @@ func (client ActivityLogsClient) List(ctx context.Context, filter string, select if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.ActivityLogsClient", "List", err.Error()) + return result, validation.NewError("activitylogs.Client", "List", err.Error()) } result.fn = client.listNextResults req, err := client.ListPreparer(ctx, filter, selectParameter) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "activitylogs.Client", "List", nil, "Failure preparing request") return } resp, err := client.ListSender(req) if err != nil { result.edc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "activitylogs.Client", "List", resp, "Failure sending request") return } result.edc, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "activitylogs.Client", "List", resp, "Failure responding to request") return } if result.edc.hasNextLink() && result.edc.IsEmpty() { @@ -95,7 +95,7 @@ func (client ActivityLogsClient) List(ctx context.Context, filter string, select } // ListPreparer prepares the List request. -func (client ActivityLogsClient) ListPreparer(ctx context.Context, filter string, selectParameter string) (*http.Request, error) { +func (client Client) ListPreparer(ctx context.Context, filter string, selectParameter string) (*http.Request, error) { pathParameters := map[string]interface{}{ "subscriptionId": autorest.Encode("path", client.SubscriptionID), } @@ -112,20 +112,20 @@ func (client ActivityLogsClient) ListPreparer(ctx context.Context, filter string preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/eventtypes/management/values", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/eventtypes/management/values", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. -func (client ActivityLogsClient) ListSender(req *http.Request) (*http.Response, error) { +func (client Client) ListSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // ListResponder handles the response to the List request. The method always // closes the http.Response Body. -func (client ActivityLogsClient) ListResponder(resp *http.Response) (result EventDataCollection, err error) { +func (client Client) ListResponder(resp *http.Response) (result EventDataCollection, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -136,10 +136,10 @@ func (client ActivityLogsClient) ListResponder(resp *http.Response) (result Even } // listNextResults retrieves the next set of results, if any. -func (client ActivityLogsClient) listNextResults(ctx context.Context, lastResults EventDataCollection) (result EventDataCollection, err error) { +func (client Client) listNextResults(ctx context.Context, lastResults EventDataCollection) (result EventDataCollection, err error) { req, err := lastResults.eventDataCollectionPreparer(ctx) if err != nil { - return result, autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "listNextResults", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "activitylogs.Client", "listNextResults", nil, "Failure preparing next results request") } if req == nil { return @@ -147,19 +147,19 @@ func (client ActivityLogsClient) listNextResults(ctx context.Context, lastResult resp, err := client.ListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "listNextResults", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "activitylogs.Client", "listNextResults", resp, "Failure sending next results request") } result, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "listNextResults", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "activitylogs.Client", "listNextResults", resp, "Failure responding to next results request") } return } // ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ActivityLogsClient) ListComplete(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionIterator, err error) { +func (client Client) ListComplete(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionIterator, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogsClient.List") + ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") defer func() { sc := -1 if result.Response().Response.Response != nil { diff --git a/services/monitor/mgmt/2020-10-01/activitylogs/activitylogsapi/interfaces.go b/services/monitor/mgmt/2020-10-01/activitylogs/activitylogsapi/interfaces.go new file mode 100644 index 000000000000..f1c0fc341637 --- /dev/null +++ b/services/monitor/mgmt/2020-10-01/activitylogs/activitylogsapi/interfaces.go @@ -0,0 +1,43 @@ +package activitylogsapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for 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 ( + "context" + "github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2020-10-01/activitylogs" + "github.com/Azure/go-autorest/autorest" +) + +// ClientAPI contains the set of methods on the Client type. +type ClientAPI interface { + List(ctx context.Context, filter string, selectParameter string) (result activitylogs.EventDataCollectionPage, err error) + ListComplete(ctx context.Context, filter string, selectParameter string) (result activitylogs.EventDataCollectionIterator, err error) +} + +var _ ClientAPI = (*activitylogs.Client)(nil) + +// TenantActivityLogsClientAPI contains the set of methods on the TenantActivityLogsClient type. +type TenantActivityLogsClientAPI interface { + List(ctx context.Context, filter string, selectParameter string) (result activitylogs.EventDataCollectionPage, err error) + ListComplete(ctx context.Context, filter string, selectParameter string) (result activitylogs.EventDataCollectionIterator, err error) +} + +var _ TenantActivityLogsClientAPI = (*activitylogs.TenantActivityLogsClient)(nil) + +// AlertsClientAPI contains the set of methods on the AlertsClient type. +type AlertsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertRule activitylogs.AlertResource) (result activitylogs.AlertResource, err error) + Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result activitylogs.AlertResource, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result activitylogs.AlertRuleListPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result activitylogs.AlertRuleListIterator, err error) + ListBySubscriptionID(ctx context.Context) (result activitylogs.AlertRuleListPage, err error) + ListBySubscriptionIDComplete(ctx context.Context) (result activitylogs.AlertRuleListIterator, err error) + Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertRulePatch activitylogs.AlertRulePatchObject) (result activitylogs.AlertResource, err error) +} + +var _ AlertsClientAPI = (*activitylogs.AlertsClient)(nil) diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/activitylogalerts.go b/services/monitor/mgmt/2020-10-01/activitylogs/alerts.go similarity index 52% rename from services/preview/monitor/mgmt/2021-04-01-preview/insights/activitylogalerts.go rename to services/monitor/mgmt/2020-10-01/activitylogs/alerts.go index f897b08a6f0c..a0d5548f5e6b 100644 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/activitylogalerts.go +++ b/services/monitor/mgmt/2020-10-01/activitylogs/alerts.go @@ -1,4 +1,4 @@ -package insights +package activitylogs // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -15,31 +15,30 @@ import ( "net/http" ) -// ActivityLogAlertsClient is the monitor Management Client -type ActivityLogAlertsClient struct { +// AlertsClient is the monitor Management Client +type AlertsClient struct { BaseClient } -// NewActivityLogAlertsClient creates an instance of the ActivityLogAlertsClient client. -func NewActivityLogAlertsClient(subscriptionID string) ActivityLogAlertsClient { - return NewActivityLogAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID) +// NewAlertsClient creates an instance of the AlertsClient client. +func NewAlertsClient(subscriptionID string) AlertsClient { + return NewAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// NewActivityLogAlertsClientWithBaseURI creates an instance of the ActivityLogAlertsClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewActivityLogAlertsClientWithBaseURI(baseURI string, subscriptionID string) ActivityLogAlertsClient { - return ActivityLogAlertsClient{NewWithBaseURI(baseURI, subscriptionID)} +// NewAlertsClientWithBaseURI creates an instance of the AlertsClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAlertsClientWithBaseURI(baseURI string, subscriptionID string) AlertsClient { + return AlertsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// CreateOrUpdate create a new activity log alert or update an existing one. +// CreateOrUpdate create a new Activity Log Alert rule or update an existing one. // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. -// activityLogAlertName - the name of the activity log alert. -// activityLogAlert - the activity log alert to create or use for the update. -func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (result ActivityLogAlertResource, err error) { +// activityLogAlertName - the name of the Activity Log Alert rule. +// activityLogAlertRule - the Activity Log Alert rule to create or use for the update. +func (client AlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertRule AlertResource) (result AlertResource, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.CreateOrUpdate") + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.CreateOrUpdate") defer func() { sc := -1 if result.Response.Response != nil { @@ -54,32 +53,32 @@ func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resour {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: activityLogAlert, - Constraints: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Scopes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "activityLogAlert.ActivityLogAlert.Condition", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Condition.AllOf", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "activityLogAlert.ActivityLogAlert.Actions", Name: validation.Null, Rule: true, Chain: nil}, + {TargetValue: activityLogAlertRule, + Constraints: []validation.Constraint{{Target: "activityLogAlertRule.AlertRuleProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "activityLogAlertRule.AlertRuleProperties.Scopes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "activityLogAlertRule.AlertRuleProperties.Condition", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "activityLogAlertRule.AlertRuleProperties.Condition.AllOf", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "activityLogAlertRule.AlertRuleProperties.Actions", Name: validation.Null, Rule: true, Chain: nil}, }}}}}); err != nil { - return result, validation.NewError("insights.ActivityLogAlertsClient", "CreateOrUpdate", err.Error()) + return result, validation.NewError("activitylogs.AlertsClient", "CreateOrUpdate", err.Error()) } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, activityLogAlertName, activityLogAlert) + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, activityLogAlertName, activityLogAlertRule) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "CreateOrUpdate", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "activitylogs.AlertsClient", "CreateOrUpdate", nil, "Failure preparing request") return } resp, err := client.CreateOrUpdateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "CreateOrUpdate", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "activitylogs.AlertsClient", "CreateOrUpdate", resp, "Failure sending request") return } result, err = client.CreateOrUpdateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "CreateOrUpdate", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "activitylogs.AlertsClient", "CreateOrUpdate", resp, "Failure responding to request") return } @@ -87,14 +86,14 @@ func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resour } // CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ActivityLogAlertsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (*http.Request, error) { +func (client AlertsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertRule AlertResource) (*http.Request, error) { pathParameters := map[string]interface{}{ "activityLogAlertName": autorest.Encode("path", activityLogAlertName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-01" + const APIVersion = "2020-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -103,21 +102,21 @@ func (client ActivityLogAlertsClient) CreateOrUpdatePreparer(ctx context.Context autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}", pathParameters), - autorest.WithJSON(activityLogAlert), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}", pathParameters), + autorest.WithJSON(activityLogAlertRule), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. -func (client ActivityLogAlertsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { +func (client AlertsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. -func (client ActivityLogAlertsClient) CreateOrUpdateResponder(resp *http.Response) (result ActivityLogAlertResource, err error) { +func (client AlertsClient) CreateOrUpdateResponder(resp *http.Response) (result AlertResource, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), @@ -127,13 +126,13 @@ func (client ActivityLogAlertsClient) CreateOrUpdateResponder(resp *http.Respons return } -// Delete delete an activity log alert. +// Delete delete an Activity Log Alert rule. // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. -// activityLogAlertName - the name of the activity log alert. -func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) { +// activityLogAlertName - the name of the Activity Log Alert rule. +func (client AlertsClient) Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.Delete") + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.Delete") defer func() { sc := -1 if result.Response != nil { @@ -148,25 +147,25 @@ func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupN {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.ActivityLogAlertsClient", "Delete", err.Error()) + return result, validation.NewError("activitylogs.AlertsClient", "Delete", err.Error()) } req, err := client.DeletePreparer(ctx, resourceGroupName, activityLogAlertName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "activitylogs.AlertsClient", "Delete", nil, "Failure preparing request") return } resp, err := client.DeleteSender(req) if err != nil { result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "activitylogs.AlertsClient", "Delete", resp, "Failure sending request") return } result, err = client.DeleteResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "activitylogs.AlertsClient", "Delete", resp, "Failure responding to request") return } @@ -174,14 +173,14 @@ func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupN } // DeletePreparer prepares the Delete request. -func (client ActivityLogAlertsClient) DeletePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string) (*http.Request, error) { +func (client AlertsClient) DeletePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "activityLogAlertName": autorest.Encode("path", activityLogAlertName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-01" + const APIVersion = "2020-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -189,20 +188,20 @@ func (client ActivityLogAlertsClient) DeletePreparer(ctx context.Context, resour preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. -func (client ActivityLogAlertsClient) DeleteSender(req *http.Request) (*http.Response, error) { +func (client AlertsClient) DeleteSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. -func (client ActivityLogAlertsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { +func (client AlertsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), @@ -211,13 +210,13 @@ func (client ActivityLogAlertsClient) DeleteResponder(resp *http.Response) (resu return } -// Get get an activity log alert. +// Get get an Activity Log Alert rule. // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. -// activityLogAlertName - the name of the activity log alert. -func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result ActivityLogAlertResource, err error) { +// activityLogAlertName - the name of the Activity Log Alert rule. +func (client AlertsClient) Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result AlertResource, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.Get") + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.Get") defer func() { sc := -1 if result.Response.Response != nil { @@ -232,25 +231,25 @@ func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.ActivityLogAlertsClient", "Get", err.Error()) + return result, validation.NewError("activitylogs.AlertsClient", "Get", err.Error()) } req, err := client.GetPreparer(ctx, resourceGroupName, activityLogAlertName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Get", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "activitylogs.AlertsClient", "Get", nil, "Failure preparing request") return } resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Get", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "activitylogs.AlertsClient", "Get", resp, "Failure sending request") return } result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Get", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "activitylogs.AlertsClient", "Get", resp, "Failure responding to request") return } @@ -258,14 +257,14 @@ func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName } // GetPreparer prepares the Get request. -func (client ActivityLogAlertsClient) GetPreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string) (*http.Request, error) { +func (client AlertsClient) GetPreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "activityLogAlertName": autorest.Encode("path", activityLogAlertName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-01" + const APIVersion = "2020-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -273,20 +272,20 @@ func (client ActivityLogAlertsClient) GetPreparer(ctx context.Context, resourceG preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. -func (client ActivityLogAlertsClient) GetSender(req *http.Request) (*http.Response, error) { +func (client AlertsClient) GetSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client ActivityLogAlertsClient) GetResponder(resp *http.Response) (result ActivityLogAlertResource, err error) { +func (client AlertsClient) GetResponder(resp *http.Response) (result AlertResource, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -296,16 +295,16 @@ func (client ActivityLogAlertsClient) GetResponder(resp *http.Response) (result return } -// ListByResourceGroup get a list of all activity log alerts in a resource group. +// ListByResourceGroup get a list of all Activity Log Alert rules in a resource group. // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. -func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActivityLogAlertList, err error) { +func (client AlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AlertRuleListPage, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.ListByResourceGroup") + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.ListByResourceGroup") defer func() { sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode + if result.arl.Response.Response != nil { + sc = result.arl.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() @@ -316,25 +315,30 @@ func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, r {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.ActivityLogAlertsClient", "ListByResourceGroup", err.Error()) + return result, validation.NewError("activitylogs.AlertsClient", "ListByResourceGroup", err.Error()) } + result.fn = client.listByResourceGroupNextResults req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListByResourceGroup", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "activitylogs.AlertsClient", "ListByResourceGroup", nil, "Failure preparing request") return } resp, err := client.ListByResourceGroupSender(req) if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListByResourceGroup", resp, "Failure sending request") + result.arl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "activitylogs.AlertsClient", "ListByResourceGroup", resp, "Failure sending request") return } - result, err = client.ListByResourceGroupResponder(resp) + result.arl, err = client.ListByResourceGroupResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListByResourceGroup", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "activitylogs.AlertsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.arl.hasNextLink() && result.arl.IsEmpty() { + err = result.NextWithContext(ctx) return } @@ -342,13 +346,13 @@ func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, r } // ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ActivityLogAlertsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { +func (client AlertsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-01" + const APIVersion = "2020-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -356,20 +360,20 @@ func (client ActivityLogAlertsClient) ListByResourceGroupPreparer(ctx context.Co preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the // http.Response Body if it receives an error. -func (client ActivityLogAlertsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { +func (client AlertsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always // closes the http.Response Body. -func (client ActivityLogAlertsClient) ListByResourceGroupResponder(resp *http.Response) (result ActivityLogAlertList, err error) { +func (client AlertsClient) ListByResourceGroupResponder(resp *http.Response) (result AlertRuleList, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -379,14 +383,51 @@ func (client ActivityLogAlertsClient) ListByResourceGroupResponder(resp *http.Re return } -// ListBySubscriptionID get a list of all activity log alerts in a subscription. -func (client ActivityLogAlertsClient) ListBySubscriptionID(ctx context.Context) (result ActivityLogAlertList, err error) { +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client AlertsClient) listByResourceGroupNextResults(ctx context.Context, lastResults AlertRuleList) (result AlertRuleList, err error) { + req, err := lastResults.alertRuleListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "activitylogs.AlertsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "activitylogs.AlertsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "activitylogs.AlertsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client AlertsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AlertRuleListIterator, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.ListBySubscriptionID") + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.ListByResourceGroup") defer func() { sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListBySubscriptionID get a list of all Activity Log Alert rules in a subscription. +func (client AlertsClient) ListBySubscriptionID(ctx context.Context) (result AlertRuleListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.ListBySubscriptionID") + defer func() { + sc := -1 + if result.arl.Response.Response != nil { + sc = result.arl.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() @@ -394,25 +435,30 @@ func (client ActivityLogAlertsClient) ListBySubscriptionID(ctx context.Context) if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.ActivityLogAlertsClient", "ListBySubscriptionID", err.Error()) + return result, validation.NewError("activitylogs.AlertsClient", "ListBySubscriptionID", err.Error()) } + result.fn = client.listBySubscriptionIDNextResults req, err := client.ListBySubscriptionIDPreparer(ctx) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "activitylogs.AlertsClient", "ListBySubscriptionID", nil, "Failure preparing request") return } resp, err := client.ListBySubscriptionIDSender(req) if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", resp, "Failure sending request") + result.arl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "activitylogs.AlertsClient", "ListBySubscriptionID", resp, "Failure sending request") return } - result, err = client.ListBySubscriptionIDResponder(resp) + result.arl, err = client.ListBySubscriptionIDResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "activitylogs.AlertsClient", "ListBySubscriptionID", resp, "Failure responding to request") + return + } + if result.arl.hasNextLink() && result.arl.IsEmpty() { + err = result.NextWithContext(ctx) return } @@ -420,12 +466,12 @@ func (client ActivityLogAlertsClient) ListBySubscriptionID(ctx context.Context) } // ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. -func (client ActivityLogAlertsClient) ListBySubscriptionIDPreparer(ctx context.Context) (*http.Request, error) { +func (client AlertsClient) ListBySubscriptionIDPreparer(ctx context.Context) (*http.Request, error) { pathParameters := map[string]interface{}{ "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-01" + const APIVersion = "2020-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -433,20 +479,20 @@ func (client ActivityLogAlertsClient) ListBySubscriptionIDPreparer(ctx context.C preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/activityLogAlerts", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the // http.Response Body if it receives an error. -func (client ActivityLogAlertsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { +func (client AlertsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always // closes the http.Response Body. -func (client ActivityLogAlertsClient) ListBySubscriptionIDResponder(resp *http.Response) (result ActivityLogAlertList, err error) { +func (client AlertsClient) ListBySubscriptionIDResponder(resp *http.Response) (result AlertRuleList, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -456,14 +502,52 @@ func (client ActivityLogAlertsClient) ListBySubscriptionIDResponder(resp *http.R return } -// Update updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. +// listBySubscriptionIDNextResults retrieves the next set of results, if any. +func (client AlertsClient) listBySubscriptionIDNextResults(ctx context.Context, lastResults AlertRuleList) (result AlertRuleList, err error) { + req, err := lastResults.alertRuleListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "activitylogs.AlertsClient", "listBySubscriptionIDNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "activitylogs.AlertsClient", "listBySubscriptionIDNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "activitylogs.AlertsClient", "listBySubscriptionIDNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionIDComplete enumerates all values, automatically crossing page boundaries as required. +func (client AlertsClient) ListBySubscriptionIDComplete(ctx context.Context) (result AlertRuleListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.ListBySubscriptionID") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscriptionID(ctx) + return +} + +// Update updates 'tags' and 'enabled' fields in an existing Alert rule. This method is used to update the Alert rule +// tags, and to enable or disable the Alert rule. To update other fields use CreateOrUpdate operation. // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. -// activityLogAlertName - the name of the activity log alert. -// activityLogAlertPatch - parameters supplied to the operation. -func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (result ActivityLogAlertResource, err error) { +// activityLogAlertName - the name of the Activity Log Alert rule. +// activityLogAlertRulePatch - parameters supplied to the operation. +func (client AlertsClient) Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertRulePatch AlertRulePatchObject) (result AlertResource, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.Update") + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.Update") defer func() { sc := -1 if result.Response.Response != nil { @@ -478,25 +562,25 @@ func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupN {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.ActivityLogAlertsClient", "Update", err.Error()) + return result, validation.NewError("activitylogs.AlertsClient", "Update", err.Error()) } - req, err := client.UpdatePreparer(ctx, resourceGroupName, activityLogAlertName, activityLogAlertPatch) + req, err := client.UpdatePreparer(ctx, resourceGroupName, activityLogAlertName, activityLogAlertRulePatch) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Update", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "activitylogs.AlertsClient", "Update", nil, "Failure preparing request") return } resp, err := client.UpdateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Update", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "activitylogs.AlertsClient", "Update", resp, "Failure sending request") return } result, err = client.UpdateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Update", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "activitylogs.AlertsClient", "Update", resp, "Failure responding to request") return } @@ -504,14 +588,14 @@ func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupN } // UpdatePreparer prepares the Update request. -func (client ActivityLogAlertsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (*http.Request, error) { +func (client AlertsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertRulePatch AlertRulePatchObject) (*http.Request, error) { pathParameters := map[string]interface{}{ "activityLogAlertName": autorest.Encode("path", activityLogAlertName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-01" + const APIVersion = "2020-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -520,21 +604,21 @@ func (client ActivityLogAlertsClient) UpdatePreparer(ctx context.Context, resour autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}", pathParameters), - autorest.WithJSON(activityLogAlertPatch), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}", pathParameters), + autorest.WithJSON(activityLogAlertRulePatch), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. -func (client ActivityLogAlertsClient) UpdateSender(req *http.Request) (*http.Response, error) { +func (client AlertsClient) UpdateSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. -func (client ActivityLogAlertsClient) UpdateResponder(resp *http.Response) (result ActivityLogAlertResource, err error) { +func (client AlertsClient) UpdateResponder(resp *http.Response) (result AlertResource, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), diff --git a/services/monitor/mgmt/2020-10-01/activitylogs/client.go b/services/monitor/mgmt/2020-10-01/activitylogs/client.go new file mode 100644 index 000000000000..702c4066876e --- /dev/null +++ b/services/monitor/mgmt/2020-10-01/activitylogs/client.go @@ -0,0 +1,41 @@ +// Package activitylogs implements the Azure ARM Activitylogs service API version . +// +// Monitor Management Client +package activitylogs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for 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 ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Activitylogs + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Activitylogs. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/monitor/mgmt/2020-10-01/activitylogs/enums.go b/services/monitor/mgmt/2020-10-01/activitylogs/enums.go new file mode 100644 index 000000000000..611bb3b05463 --- /dev/null +++ b/services/monitor/mgmt/2020-10-01/activitylogs/enums.go @@ -0,0 +1,28 @@ +package activitylogs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// EventLevel enumerates the values for event level. +type EventLevel string + +const ( + // Critical ... + Critical EventLevel = "Critical" + // Error ... + Error EventLevel = "Error" + // Informational ... + Informational EventLevel = "Informational" + // Verbose ... + Verbose EventLevel = "Verbose" + // Warning ... + Warning EventLevel = "Warning" +) + +// PossibleEventLevelValues returns an array of possible values for the EventLevel const type. +func PossibleEventLevelValues() []EventLevel { + return []EventLevel{Critical, Error, Informational, Verbose, Warning} +} diff --git a/services/monitor/mgmt/2020-10-01/activitylogs/models.go b/services/monitor/mgmt/2020-10-01/activitylogs/models.go new file mode 100644 index 000000000000..d9a087f13b7e --- /dev/null +++ b/services/monitor/mgmt/2020-10-01/activitylogs/models.go @@ -0,0 +1,703 @@ +package activitylogs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for 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 ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2020-10-01/activitylogs" + +// ActionGroup a pointer to an Azure Action Group. +type ActionGroup struct { + // ActionGroupID - The resource ID of the Action Group. This cannot be null or empty. + ActionGroupID *string `json:"actionGroupId,omitempty"` + // WebhookProperties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. + WebhookProperties map[string]*string `json:"webhookProperties"` +} + +// MarshalJSON is the custom marshaler for ActionGroup. +func (ag ActionGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ag.ActionGroupID != nil { + objectMap["actionGroupId"] = ag.ActionGroupID + } + if ag.WebhookProperties != nil { + objectMap["webhookProperties"] = ag.WebhookProperties + } + return json.Marshal(objectMap) +} + +// ActionList a list of Activity Log Alert rule actions. +type ActionList struct { + // ActionGroups - The list of the Action Groups. + ActionGroups *[]ActionGroup `json:"actionGroups,omitempty"` +} + +// AlertResource an Activity Log Alert rule resource. +type AlertResource struct { + autorest.Response `json:"-"` + // AlertRuleProperties - The Activity Log Alert rule properties of the resource. + *AlertRuleProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. Since Azure Activity Log Alerts is a global service, the location of the rules should always be 'global'. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for AlertResource. +func (ar AlertResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ar.AlertRuleProperties != nil { + objectMap["properties"] = ar.AlertRuleProperties + } + if ar.Location != nil { + objectMap["location"] = ar.Location + } + if ar.Tags != nil { + objectMap["tags"] = ar.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AlertResource struct. +func (ar *AlertResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var alertRuleProperties AlertRuleProperties + err = json.Unmarshal(*v, &alertRuleProperties) + if err != nil { + return err + } + ar.AlertRuleProperties = &alertRuleProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ar.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ar.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ar.Tags = tags + } + } + } + + return nil +} + +// AlertRuleAllOfCondition an Activity Log Alert rule condition that is met when all its member conditions +// are met. +type AlertRuleAllOfCondition struct { + // AllOf - The list of Activity Log Alert rule conditions. + AllOf *[]AlertRuleAnyOfOrLeafCondition `json:"allOf,omitempty"` +} + +// AlertRuleAnyOfOrLeafCondition an Activity Log Alert rule condition that is met when all its member +// conditions are met. +// Each condition can be of one of the following types: +// __Important__: Each type has its unique subset of properties. Properties from different types CANNOT +// exist in one condition. +// * __Leaf Condition -__ must contain 'field' and either 'equals' or 'containsAny'. +// _Please note, 'anyOf' should __not__ be set in a Leaf Condition._ +// * __AnyOf Condition -__ must contain __only__ 'anyOf' (which is an array of Leaf Conditions). +// _Please note, 'field', 'equals' and 'containsAny' should __not__ be set in an AnyOf Condition._ +type AlertRuleAnyOfOrLeafCondition struct { + // AnyOf - An Activity Log Alert rule condition that is met when at least one of its member leaf conditions are met. + AnyOf *[]AlertRuleLeafCondition `json:"anyOf,omitempty"` + // Field - The name of the Activity Log event's 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'. + Field *string `json:"field,omitempty"` + // Equals - The value of the event's field will be compared to this value (case-insensitive) to determine if the condition is met. + Equals *string `json:"equals,omitempty"` + // ContainsAny - The value of the event's field will be compared to the values in this array (case-insensitive) to determine if the condition is met. + ContainsAny *[]string `json:"containsAny,omitempty"` +} + +// AlertRuleLeafCondition an Activity Log Alert rule condition that is met by comparing the field and value +// of an Activity Log event. +// This condition must contain 'field' and either 'equals' or 'containsAny'. +type AlertRuleLeafCondition struct { + // Field - The name of the Activity Log event's 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'. + Field *string `json:"field,omitempty"` + // Equals - The value of the event's field will be compared to this value (case-insensitive) to determine if the condition is met. + Equals *string `json:"equals,omitempty"` + // ContainsAny - The value of the event's field will be compared to the values in this array (case-insensitive) to determine if the condition is met. + ContainsAny *[]string `json:"containsAny,omitempty"` +} + +// AlertRuleList a list of Activity Log Alert rules. +type AlertRuleList struct { + autorest.Response `json:"-"` + // Value - The list of Activity Log Alert rules. + Value *[]AlertResource `json:"value,omitempty"` + // NextLink - Provides the link to retrieve the next set of elements. + NextLink *string `json:"nextLink,omitempty"` +} + +// AlertRuleListIterator provides access to a complete listing of AlertResource values. +type AlertRuleListIterator struct { + i int + page AlertRuleListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AlertRuleListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AlertRuleListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AlertRuleListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AlertRuleListIterator) Response() AlertRuleList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AlertRuleListIterator) Value() AlertResource { + if !iter.page.NotDone() { + return AlertResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AlertRuleListIterator type. +func NewAlertRuleListIterator(page AlertRuleListPage) AlertRuleListIterator { + return AlertRuleListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (arl AlertRuleList) IsEmpty() bool { + return arl.Value == nil || len(*arl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (arl AlertRuleList) hasNextLink() bool { + return arl.NextLink != nil && len(*arl.NextLink) != 0 +} + +// alertRuleListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (arl AlertRuleList) alertRuleListPreparer(ctx context.Context) (*http.Request, error) { + if !arl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(arl.NextLink))) +} + +// AlertRuleListPage contains a page of AlertResource values. +type AlertRuleListPage struct { + fn func(context.Context, AlertRuleList) (AlertRuleList, error) + arl AlertRuleList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AlertRuleListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.arl) + if err != nil { + return err + } + page.arl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AlertRuleListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AlertRuleListPage) NotDone() bool { + return !page.arl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AlertRuleListPage) Response() AlertRuleList { + return page.arl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AlertRuleListPage) Values() []AlertResource { + if page.arl.IsEmpty() { + return nil + } + return *page.arl.Value +} + +// Creates a new instance of the AlertRuleListPage type. +func NewAlertRuleListPage(cur AlertRuleList, getNextPage func(context.Context, AlertRuleList) (AlertRuleList, error)) AlertRuleListPage { + return AlertRuleListPage{ + fn: getNextPage, + arl: cur, + } +} + +// AlertRulePatchObject an Activity Log Alert rule object for the body of patch operations. +type AlertRulePatchObject struct { + // Tags - The resource tags + Tags map[string]*string `json:"tags"` + // AlertRulePatchProperties - The activity log alert settings for an update operation. + *AlertRulePatchProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AlertRulePatchObject. +func (arpo AlertRulePatchObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if arpo.Tags != nil { + objectMap["tags"] = arpo.Tags + } + if arpo.AlertRulePatchProperties != nil { + objectMap["properties"] = arpo.AlertRulePatchProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AlertRulePatchObject struct. +func (arpo *AlertRulePatchObject) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + arpo.Tags = tags + } + case "properties": + if v != nil { + var alertRulePatchProperties AlertRulePatchProperties + err = json.Unmarshal(*v, &alertRulePatchProperties) + if err != nil { + return err + } + arpo.AlertRulePatchProperties = &alertRulePatchProperties + } + } + } + + return nil +} + +// AlertRulePatchProperties an Activity Log Alert rule properties for patch operations. +type AlertRulePatchProperties struct { + // Enabled - Indicates whether this Activity Log Alert rule is enabled. If an Activity Log Alert rule is not enabled, then none of its actions will be activated. + Enabled *bool `json:"enabled,omitempty"` +} + +// AlertRuleProperties an Azure Activity Log Alert rule. +type AlertRuleProperties struct { + // Scopes - A list of resource IDs that will be used as prefixes. The alert will only apply to Activity Log events with resource IDs that fall under one of these prefixes. This list must include at least one item. + Scopes *[]string `json:"scopes,omitempty"` + // Condition - The condition that will cause this alert to activate. + Condition *AlertRuleAllOfCondition `json:"condition,omitempty"` + // Actions - The actions that will activate when the condition is met. + Actions *ActionList `json:"actions,omitempty"` + // Enabled - Indicates whether this Activity Log Alert rule is enabled. If an Activity Log Alert rule is not enabled, then none of its actions will be activated. + Enabled *bool `json:"enabled,omitempty"` + // Description - A description of this Activity Log Alert rule. + Description *string `json:"description,omitempty"` +} + +// AzureResource an Azure resource object. +type AzureResource struct { + // ID - READ-ONLY; The resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. Since Azure Activity Log Alerts is a global service, the location of the rules should always be 'global'. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for AzureResource. +func (ar AzureResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ar.Location != nil { + objectMap["location"] = ar.Location + } + if ar.Tags != nil { + objectMap["tags"] = ar.Tags + } + return json.Marshal(objectMap) +} + +// ErrorResponse describes the format of Error response. +type ErrorResponse struct { + // Code - Error code + Code *string `json:"code,omitempty"` + // Message - Error message indicating why the operation failed. + Message *string `json:"message,omitempty"` +} + +// EventData the Azure event log entries are of type EventData +type EventData struct { + // Authorization - READ-ONLY; The sender authorization information. + Authorization *SenderAuthorization `json:"authorization,omitempty"` + // Claims - READ-ONLY; key value pairs to identify ARM permissions. + Claims map[string]*string `json:"claims"` + // Caller - READ-ONLY; the email address of the user who has performed the operation, the UPN claim or SPN claim based on availability. + Caller *string `json:"caller,omitempty"` + // Description - READ-ONLY; the description of the event. + Description *string `json:"description,omitempty"` + // ID - READ-ONLY; the Id of this event as required by ARM for RBAC. It contains the EventDataID and a timestamp information. + ID *string `json:"id,omitempty"` + // EventDataID - READ-ONLY; the event data Id. This is a unique identifier for an event. + EventDataID *string `json:"eventDataId,omitempty"` + // CorrelationID - READ-ONLY; 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. + CorrelationID *string `json:"correlationId,omitempty"` + // EventName - READ-ONLY; the event name. This value should not be confused with OperationName. For practical purposes, OperationName might be more appealing to end users. + EventName *LocalizableString `json:"eventName,omitempty"` + // Category - READ-ONLY; the event category. + Category *LocalizableString `json:"category,omitempty"` + // HTTPRequest - READ-ONLY; 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). + HTTPRequest *HTTPRequestInfo `json:"httpRequest,omitempty"` + // Level - READ-ONLY; the event level. Possible values include: 'Critical', 'Error', 'Warning', 'Informational', 'Verbose' + Level EventLevel `json:"level,omitempty"` + // ResourceGroupName - READ-ONLY; the resource group name of the impacted resource. + ResourceGroupName *string `json:"resourceGroupName,omitempty"` + // ResourceProviderName - READ-ONLY; the resource provider name of the impacted resource. + ResourceProviderName *LocalizableString `json:"resourceProviderName,omitempty"` + // ResourceID - READ-ONLY; the resource uri that uniquely identifies the resource that caused this event. + ResourceID *string `json:"resourceId,omitempty"` + // ResourceType - READ-ONLY; the resource type + ResourceType *LocalizableString `json:"resourceType,omitempty"` + // OperationID - READ-ONLY; It is usually a GUID shared among the events corresponding to single operation. This value should not be confused with EventName. + OperationID *string `json:"operationId,omitempty"` + // OperationName - READ-ONLY; the operation name. + OperationName *LocalizableString `json:"operationName,omitempty"` + // Properties - READ-ONLY; the set of pairs (usually a Dictionary) that includes details about the event. + Properties map[string]*string `json:"properties"` + // Status - READ-ONLY; a string describing the status of the operation. Some typical values are: Started, In progress, Succeeded, Failed, Resolved. + Status *LocalizableString `json:"status,omitempty"` + // SubStatus - READ-ONLY; 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) + SubStatus *LocalizableString `json:"subStatus,omitempty"` + // EventTimestamp - READ-ONLY; the timestamp of when the event was generated by the Azure service processing the request corresponding the event. It in ISO 8601 format. + EventTimestamp *date.Time `json:"eventTimestamp,omitempty"` + // SubmissionTimestamp - READ-ONLY; 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. + SubmissionTimestamp *date.Time `json:"submissionTimestamp,omitempty"` + // SubscriptionID - READ-ONLY; the Azure subscription Id usually a GUID. + SubscriptionID *string `json:"subscriptionId,omitempty"` + // TenantID - READ-ONLY; the Azure tenant Id + TenantID *string `json:"tenantId,omitempty"` +} + +// MarshalJSON is the custom marshaler for EventData. +func (ed EventData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// EventDataCollection represents collection of events. +type EventDataCollection struct { + autorest.Response `json:"-"` + // Value - this list that includes the Azure audit logs. + Value *[]EventData `json:"value,omitempty"` + // NextLink - Provides the link to retrieve the next set of events. + NextLink *string `json:"nextLink,omitempty"` +} + +// EventDataCollectionIterator provides access to a complete listing of EventData values. +type EventDataCollectionIterator struct { + i int + page EventDataCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *EventDataCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *EventDataCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter EventDataCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter EventDataCollectionIterator) Response() EventDataCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter EventDataCollectionIterator) Value() EventData { + if !iter.page.NotDone() { + return EventData{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the EventDataCollectionIterator type. +func NewEventDataCollectionIterator(page EventDataCollectionPage) EventDataCollectionIterator { + return EventDataCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (edc EventDataCollection) IsEmpty() bool { + return edc.Value == nil || len(*edc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (edc EventDataCollection) hasNextLink() bool { + return edc.NextLink != nil && len(*edc.NextLink) != 0 +} + +// eventDataCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (edc EventDataCollection) eventDataCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !edc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(edc.NextLink))) +} + +// EventDataCollectionPage contains a page of EventData values. +type EventDataCollectionPage struct { + fn func(context.Context, EventDataCollection) (EventDataCollection, error) + edc EventDataCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *EventDataCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.edc) + if err != nil { + return err + } + page.edc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *EventDataCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page EventDataCollectionPage) NotDone() bool { + return !page.edc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page EventDataCollectionPage) Response() EventDataCollection { + return page.edc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page EventDataCollectionPage) Values() []EventData { + if page.edc.IsEmpty() { + return nil + } + return *page.edc.Value +} + +// Creates a new instance of the EventDataCollectionPage type. +func NewEventDataCollectionPage(cur EventDataCollection, getNextPage func(context.Context, EventDataCollection) (EventDataCollection, error)) EventDataCollectionPage { + return EventDataCollectionPage{ + fn: getNextPage, + edc: cur, + } +} + +// HTTPRequestInfo the Http request info. +type HTTPRequestInfo struct { + // ClientRequestID - the client request id. + ClientRequestID *string `json:"clientRequestId,omitempty"` + // ClientIPAddress - the client Ip Address + ClientIPAddress *string `json:"clientIpAddress,omitempty"` + // Method - the Http request method. + Method *string `json:"method,omitempty"` + // URI - the Uri. + URI *string `json:"uri,omitempty"` +} + +// LocalizableString the localizable string class. +type LocalizableString struct { + // Value - the invariant value. + Value *string `json:"value,omitempty"` + // LocalizedValue - the locale specific value. + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// SenderAuthorization 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' +type SenderAuthorization struct { + // Action - the permissible actions. For instance: microsoft.support/supporttickets/write + Action *string `json:"action,omitempty"` + // Role - the role of the user. For instance: Subscription Admin + Role *string `json:"role,omitempty"` + // Scope - the scope. + Scope *string `json:"scope,omitempty"` +} diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/tenantactivitylogs.go b/services/monitor/mgmt/2020-10-01/activitylogs/tenantactivitylogs.go similarity index 88% rename from services/preview/monitor/mgmt/2021-04-01-preview/insights/tenantactivitylogs.go rename to services/monitor/mgmt/2020-10-01/activitylogs/tenantactivitylogs.go index 7501f047bb38..87c62855a112 100644 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/tenantactivitylogs.go +++ b/services/monitor/mgmt/2020-10-01/activitylogs/tenantactivitylogs.go @@ -1,4 +1,4 @@ -package insights +package activitylogs // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -67,20 +67,20 @@ func (client TenantActivityLogsClient) List(ctx context.Context, filter string, result.fn = client.listNextResults req, err := client.ListPreparer(ctx, filter, selectParameter) if err != nil { - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "activitylogs.TenantActivityLogsClient", "List", nil, "Failure preparing request") return } resp, err := client.ListSender(req) if err != nil { result.edc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "activitylogs.TenantActivityLogsClient", "List", resp, "Failure sending request") return } result.edc, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "activitylogs.TenantActivityLogsClient", "List", resp, "Failure responding to request") return } if result.edc.hasNextLink() && result.edc.IsEmpty() { @@ -107,7 +107,7 @@ func (client TenantActivityLogsClient) ListPreparer(ctx context.Context, filter preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventtypes/management/values"), + autorest.WithPath("/providers/Microsoft.Insights/eventtypes/management/values"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -134,7 +134,7 @@ func (client TenantActivityLogsClient) ListResponder(resp *http.Response) (resul func (client TenantActivityLogsClient) listNextResults(ctx context.Context, lastResults EventDataCollection) (result EventDataCollection, err error) { req, err := lastResults.eventDataCollectionPreparer(ctx) if err != nil { - return result, autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "listNextResults", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "activitylogs.TenantActivityLogsClient", "listNextResults", nil, "Failure preparing next results request") } if req == nil { return @@ -142,11 +142,11 @@ func (client TenantActivityLogsClient) listNextResults(ctx context.Context, last resp, err := client.ListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "listNextResults", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "activitylogs.TenantActivityLogsClient", "listNextResults", resp, "Failure sending next results request") } result, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "listNextResults", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "activitylogs.TenantActivityLogsClient", "listNextResults", resp, "Failure responding to next results request") } return } diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/version.go b/services/monitor/mgmt/2020-10-01/activitylogs/version.go similarity index 86% rename from services/preview/monitor/mgmt/2021-04-01-preview/insights/version.go rename to services/monitor/mgmt/2020-10-01/activitylogs/version.go index 60957f79ddd4..11d3580d73d5 100644 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/version.go +++ b/services/monitor/mgmt/2020-10-01/activitylogs/version.go @@ -1,4 +1,4 @@ -package insights +package activitylogs import "github.com/Azure/azure-sdk-for-go/version" @@ -10,7 +10,7 @@ import "github.com/Azure/azure-sdk-for-go/version" // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " insights/2021-04-01-preview" + return "Azure-SDK-For-Go/" + Version() + " activitylogs/2020-10-01" } // Version returns the semantic version (see http://semver.org) of the client. diff --git a/services/monitor/mgmt/2020-10-01/insights/CHANGELOG.md b/services/monitor/mgmt/2020-10-01/insights/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/monitor/mgmt/2020-10-01/insights/CHANGELOG.md +++ b/services/monitor/mgmt/2020-10-01/insights/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/monitor/mgmt/2020-10-01/insights/_meta.json b/services/monitor/mgmt/2020-10-01/insights/_meta.json index 4c1f4af5754e..40a0bc8a961c 100644 --- a/services/monitor/mgmt/2020-10-01/insights/_meta.json +++ b/services/monitor/mgmt/2020-10-01/insights/_meta.json @@ -1,10 +1,10 @@ { - "commit": "8240593bde5350e6762015523ccd57cb61e32da5", + "commit": "83f6c7b9ac240d3862e909245f0a61d70ae33908", "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", - "tag": "package-2020-10", + "tag": "package-2020-10-only", "use": "@microsoft.azure/autorest.go@2.1.187", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2020-10 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2020-10-only --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", "additional_properties": { "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" } diff --git a/services/monitor/mgmt/2020-10-01/insights/activitylogalerts.go b/services/monitor/mgmt/2020-10-01/insights/activitylogalerts.go index efb62a1d3abf..361db434a6a1 100644 --- a/services/monitor/mgmt/2020-10-01/insights/activitylogalerts.go +++ b/services/monitor/mgmt/2020-10-01/insights/activitylogalerts.go @@ -53,8 +53,7 @@ func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resour Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: activityLogAlertRule, Constraints: []validation.Constraint{{Target: "activityLogAlertRule.AlertRuleProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "activityLogAlertRule.AlertRuleProperties.Scopes", Name: validation.Null, Rule: true, Chain: nil}, @@ -148,8 +147,7 @@ func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupN Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ActivityLogAlertsClient", "Delete", err.Error()) } @@ -233,8 +231,7 @@ func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ActivityLogAlertsClient", "Get", err.Error()) } @@ -318,8 +315,7 @@ func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, r Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ActivityLogAlertsClient", "ListByResourceGroup", err.Error()) } @@ -566,8 +562,7 @@ func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupN Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ActivityLogAlertsClient", "Update", err.Error()) } diff --git a/services/monitor/mgmt/2021-08-01/scheduledqueryrules/CHANGELOG.md b/services/monitor/mgmt/2021-08-01/scheduledqueryrules/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/monitor/mgmt/2021-08-01/scheduledqueryrules/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/monitor/mgmt/2021-08-01/scheduledqueryrules/_meta.json b/services/monitor/mgmt/2021-08-01/scheduledqueryrules/_meta.json new file mode 100644 index 000000000000..f31bcd7807cd --- /dev/null +++ b/services/monitor/mgmt/2021-08-01/scheduledqueryrules/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "83f6c7b9ac240d3862e909245f0a61d70ae33908", + "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", + "tag": "package-2021-08-scheduledqueryrules", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-08-scheduledqueryrules --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/monitor/mgmt/2021-08-01/scheduledqueryrules/client.go b/services/monitor/mgmt/2021-08-01/scheduledqueryrules/client.go new file mode 100644 index 000000000000..4268817e2d7a --- /dev/null +++ b/services/monitor/mgmt/2021-08-01/scheduledqueryrules/client.go @@ -0,0 +1,41 @@ +// Package scheduledqueryrules implements the Azure ARM Scheduledqueryrules service API version 2021-08-01. +// +// Monitor Management Client +package scheduledqueryrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for 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 ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Scheduledqueryrules + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Scheduledqueryrules. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/monitor/mgmt/2021-08-01/scheduledqueryrules/enums.go b/services/monitor/mgmt/2021-08-01/scheduledqueryrules/enums.go new file mode 100644 index 000000000000..55c838107697 --- /dev/null +++ b/services/monitor/mgmt/2021-08-01/scheduledqueryrules/enums.go @@ -0,0 +1,98 @@ +package scheduledqueryrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ConditionOperator enumerates the values for condition operator. +type ConditionOperator string + +const ( + // Equals ... + Equals ConditionOperator = "Equals" + // GreaterThan ... + GreaterThan ConditionOperator = "GreaterThan" + // GreaterThanOrEqual ... + GreaterThanOrEqual ConditionOperator = "GreaterThanOrEqual" + // LessThan ... + LessThan ConditionOperator = "LessThan" + // LessThanOrEqual ... + LessThanOrEqual ConditionOperator = "LessThanOrEqual" +) + +// PossibleConditionOperatorValues returns an array of possible values for the ConditionOperator const type. +func PossibleConditionOperatorValues() []ConditionOperator { + return []ConditionOperator{Equals, GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // Application ... + Application CreatedByType = "Application" + // Key ... + Key CreatedByType = "Key" + // ManagedIdentity ... + ManagedIdentity CreatedByType = "ManagedIdentity" + // User ... + User CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{Application, Key, ManagedIdentity, User} +} + +// DimensionOperator enumerates the values for dimension operator. +type DimensionOperator string + +const ( + // Exclude ... + Exclude DimensionOperator = "Exclude" + // Include ... + Include DimensionOperator = "Include" +) + +// PossibleDimensionOperatorValues returns an array of possible values for the DimensionOperator const type. +func PossibleDimensionOperatorValues() []DimensionOperator { + return []DimensionOperator{Exclude, Include} +} + +// Kind enumerates the values for kind. +type Kind string + +const ( + // LogAlert ... + LogAlert Kind = "LogAlert" + // LogToMetric ... + LogToMetric Kind = "LogToMetric" +) + +// PossibleKindValues returns an array of possible values for the Kind const type. +func PossibleKindValues() []Kind { + return []Kind{LogAlert, LogToMetric} +} + +// TimeAggregation enumerates the values for time aggregation. +type TimeAggregation string + +const ( + // Average ... + Average TimeAggregation = "Average" + // Count ... + Count TimeAggregation = "Count" + // Maximum ... + Maximum TimeAggregation = "Maximum" + // Minimum ... + Minimum TimeAggregation = "Minimum" + // Total ... + Total TimeAggregation = "Total" +) + +// PossibleTimeAggregationValues returns an array of possible values for the TimeAggregation const type. +func PossibleTimeAggregationValues() []TimeAggregation { + return []TimeAggregation{Average, Count, Maximum, Minimum, Total} +} diff --git a/services/monitor/mgmt/2021-08-01/scheduledqueryrules/models.go b/services/monitor/mgmt/2021-08-01/scheduledqueryrules/models.go new file mode 100644 index 000000000000..6f41b169502d --- /dev/null +++ b/services/monitor/mgmt/2021-08-01/scheduledqueryrules/models.go @@ -0,0 +1,671 @@ +package scheduledqueryrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for 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 ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2021-08-01/scheduledqueryrules" + +// Actions actions to invoke when the alert fires. +type Actions struct { + // ActionGroups - Action Group resource Ids to invoke when the alert fires. + ActionGroups *[]string `json:"actionGroups,omitempty"` + // CustomProperties - The properties of an alert payload. + CustomProperties map[string]*string `json:"customProperties"` +} + +// MarshalJSON is the custom marshaler for Actions. +func (a Actions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if a.ActionGroups != nil { + objectMap["actionGroups"] = a.ActionGroups + } + if a.CustomProperties != nil { + objectMap["customProperties"] = a.CustomProperties + } + return json.Marshal(objectMap) +} + +// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. +type AzureEntityResource struct { + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureEntityResource. +func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Condition a condition of the scheduled query rule. +type Condition struct { + // Query - Log query alert + Query *string `json:"query,omitempty"` + // TimeAggregation - Aggregation type. Relevant and required only for rules of the kind LogAlert. Possible values include: 'Count', 'Average', 'Minimum', 'Maximum', 'Total' + TimeAggregation TimeAggregation `json:"timeAggregation,omitempty"` + // MetricMeasureColumn - The column containing the metric measure number. Relevant only for rules of the kind LogAlert. + MetricMeasureColumn *string `json:"metricMeasureColumn,omitempty"` + // ResourceIDColumn - The column containing the resource id. The content of the column must be a uri formatted as resource id. Relevant only for rules of the kind LogAlert. + ResourceIDColumn *string `json:"resourceIdColumn,omitempty"` + // Dimensions - List of Dimensions conditions + Dimensions *[]Dimension `json:"dimensions,omitempty"` + // Operator - The criteria operator. Relevant and required only for rules of the kind LogAlert. Possible values include: 'Equals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' + Operator ConditionOperator `json:"operator,omitempty"` + // Threshold - the criteria threshold value that activates the alert. Relevant and required only for rules of the kind LogAlert. + Threshold *float64 `json:"threshold,omitempty"` + // FailingPeriods - The minimum number of violations required within the selected lookback time window required to raise an alert. Relevant only for rules of the kind LogAlert. + FailingPeriods *ConditionFailingPeriods `json:"failingPeriods,omitempty"` + // MetricName - The name of the metric to be sent. Relevant and required only for rules of the kind LogToMetric. + MetricName *string `json:"metricName,omitempty"` +} + +// ConditionFailingPeriods the minimum number of violations required within the selected lookback time +// window required to raise an alert. Relevant only for rules of the kind LogAlert. +type ConditionFailingPeriods struct { + // NumberOfEvaluationPeriods - 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. Default value is 1 + NumberOfEvaluationPeriods *int64 `json:"numberOfEvaluationPeriods,omitempty"` + // MinFailingPeriodsToAlert - The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. Default value is 1 + MinFailingPeriodsToAlert *int64 `json:"minFailingPeriodsToAlert,omitempty"` +} + +// Criteria the rule criteria that defines the conditions of the scheduled query rule. +type Criteria struct { + // AllOf - A list of conditions to evaluate against the specified scopes + AllOf *[]Condition `json:"allOf,omitempty"` +} + +// Dimension dimension splitting and filtering definition +type Dimension struct { + // Name - Name of the dimension + Name *string `json:"name,omitempty"` + // Operator - Operator for dimension values. Possible values include: 'Include', 'Exclude' + Operator DimensionOperator `json:"operator,omitempty"` + // Values - List of dimension values + Values *[]string `json:"values,omitempty"` +} + +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorContract describes the format of Error response. +type ErrorContract struct { + // Error - The error details. + Error *ErrorResponse `json:"error,omitempty"` +} + +// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for +// failed operations. (This also follows the OData error response format.) +type ErrorResponse struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorResponse `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorResponse. +func (er ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Properties scheduled query rule Definition +type Properties struct { + // CreatedWithAPIVersion - READ-ONLY; The api-version used when creating this alert rule + CreatedWithAPIVersion *string `json:"createdWithApiVersion,omitempty"` + // IsLegacyLogAnalyticsRule - READ-ONLY; True if alert rule is legacy Log Analytic rule + IsLegacyLogAnalyticsRule *bool `json:"isLegacyLogAnalyticsRule,omitempty"` + // Description - The description of the scheduled query rule. + Description *string `json:"description,omitempty"` + // DisplayName - The display name of the alert rule + DisplayName *string `json:"displayName,omitempty"` + // Severity - Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Relevant and required only for rules of the kind LogAlert. + Severity *int64 `json:"severity,omitempty"` + // Enabled - The flag which indicates whether this scheduled query rule is enabled. Value should be true or false + Enabled *bool `json:"enabled,omitempty"` + // Scopes - The list of resource id's that this scheduled query rule is scoped to. + Scopes *[]string `json:"scopes,omitempty"` + // EvaluationFrequency - How often the scheduled query rule is evaluated represented in ISO 8601 duration format. Relevant and required only for rules of the kind LogAlert. + EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` + // WindowSize - The period of time (in ISO 8601 duration format) on which the Alert query will be executed (bin size). Relevant and required only for rules of the kind LogAlert. + WindowSize *string `json:"windowSize,omitempty"` + // OverrideQueryTimeRange - If specified then overrides the query time range (default is WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert. + OverrideQueryTimeRange *string `json:"overrideQueryTimeRange,omitempty"` + // TargetResourceTypes - List of resource type of the target resource(s) on which the alert is created/updated. For example if the scope is a resource group and targetResourceTypes is Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual machine in the resource group which meet the alert criteria. Relevant only for rules of the kind LogAlert + TargetResourceTypes *[]string `json:"targetResourceTypes,omitempty"` + // Criteria - The rule criteria that defines the conditions of the scheduled query rule. + Criteria *Criteria `json:"criteria,omitempty"` + // MuteActionsDuration - Mute actions for the chosen period of time (in ISO 8601 duration format) after the alert is fired. Relevant only for rules of the kind LogAlert. + MuteActionsDuration *string `json:"muteActionsDuration,omitempty"` + // Actions - Actions to invoke when the alert fires. + Actions *Actions `json:"actions,omitempty"` + // IsWorkspaceAlertsStorageConfigured - READ-ONLY; The flag which indicates whether this scheduled query rule has been configured to be stored in the customer's storage. The default is false. + IsWorkspaceAlertsStorageConfigured *bool `json:"isWorkspaceAlertsStorageConfigured,omitempty"` + // CheckWorkspaceAlertsStorageConfigured - The flag which indicates whether this scheduled query rule should be stored in the customer's storage. The default is false. Relevant only for rules of the kind LogAlert. + CheckWorkspaceAlertsStorageConfigured *bool `json:"checkWorkspaceAlertsStorageConfigured,omitempty"` + // SkipQueryValidation - The flag which indicates whether the provided query should be validated or not. The default is false. Relevant only for rules of the kind LogAlert. + SkipQueryValidation *bool `json:"skipQueryValidation,omitempty"` + // AutoMitigate - The flag that indicates whether the alert should be automatically resolved or not. The default is true. Relevant only for rules of the kind LogAlert. + AutoMitigate *bool `json:"autoMitigate,omitempty"` +} + +// MarshalJSON is the custom marshaler for Properties. +func (p Properties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if p.Description != nil { + objectMap["description"] = p.Description + } + if p.DisplayName != nil { + objectMap["displayName"] = p.DisplayName + } + if p.Severity != nil { + objectMap["severity"] = p.Severity + } + if p.Enabled != nil { + objectMap["enabled"] = p.Enabled + } + if p.Scopes != nil { + objectMap["scopes"] = p.Scopes + } + if p.EvaluationFrequency != nil { + objectMap["evaluationFrequency"] = p.EvaluationFrequency + } + if p.WindowSize != nil { + objectMap["windowSize"] = p.WindowSize + } + if p.OverrideQueryTimeRange != nil { + objectMap["overrideQueryTimeRange"] = p.OverrideQueryTimeRange + } + if p.TargetResourceTypes != nil { + objectMap["targetResourceTypes"] = p.TargetResourceTypes + } + if p.Criteria != nil { + objectMap["criteria"] = p.Criteria + } + if p.MuteActionsDuration != nil { + objectMap["muteActionsDuration"] = p.MuteActionsDuration + } + if p.Actions != nil { + objectMap["actions"] = p.Actions + } + if p.CheckWorkspaceAlertsStorageConfigured != nil { + objectMap["checkWorkspaceAlertsStorageConfigured"] = p.CheckWorkspaceAlertsStorageConfigured + } + if p.SkipQueryValidation != nil { + objectMap["skipQueryValidation"] = p.SkipQueryValidation + } + if p.AutoMitigate != nil { + objectMap["autoMitigate"] = p.AutoMitigate + } + return json.Marshal(objectMap) +} + +// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not +// have tags and a location +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Resource common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceCollection represents a collection of scheduled query rule resources. +type ResourceCollection struct { + autorest.Response `json:"-"` + // Value - The values for the scheduled query rule resources. + Value *[]ResourceType `json:"value,omitempty"` + // NextLink - READ-ONLY; Provides the link to retrieve the next set of elements. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceCollection. +func (rc ResourceCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rc.Value != nil { + objectMap["value"] = rc.Value + } + return json.Marshal(objectMap) +} + +// ResourceCollectionIterator provides access to a complete listing of ResourceType values. +type ResourceCollectionIterator struct { + i int + page ResourceCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResourceCollectionIterator) Response() ResourceCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResourceCollectionIterator) Value() ResourceType { + if !iter.page.NotDone() { + return ResourceType{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResourceCollectionIterator type. +func NewResourceCollectionIterator(page ResourceCollectionPage) ResourceCollectionIterator { + return ResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rc ResourceCollection) IsEmpty() bool { + return rc.Value == nil || len(*rc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rc ResourceCollection) hasNextLink() bool { + return rc.NextLink != nil && len(*rc.NextLink) != 0 +} + +// resourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rc ResourceCollection) resourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !rc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rc.NextLink))) +} + +// ResourceCollectionPage contains a page of ResourceType values. +type ResourceCollectionPage struct { + fn func(context.Context, ResourceCollection) (ResourceCollection, error) + rc ResourceCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rc) + if err != nil { + return err + } + page.rc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceCollectionPage) NotDone() bool { + return !page.rc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceCollectionPage) Response() ResourceCollection { + return page.rc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceCollectionPage) Values() []ResourceType { + if page.rc.IsEmpty() { + return nil + } + return *page.rc.Value +} + +// Creates a new instance of the ResourceCollectionPage type. +func NewResourceCollectionPage(cur ResourceCollection, getNextPage func(context.Context, ResourceCollection) (ResourceCollection, error)) ResourceCollectionPage { + return ResourceCollectionPage{ + fn: getNextPage, + rc: cur, + } +} + +// ResourcePatch the scheduled query rule resource for patch operations. +type ResourcePatch struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // Properties - The scheduled query rule properties of the resource. + *Properties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourcePatch. +func (rp ResourcePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rp.Tags != nil { + objectMap["tags"] = rp.Tags + } + if rp.Properties != nil { + objectMap["properties"] = rp.Properties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ResourcePatch struct. +func (rp *ResourcePatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + rp.Tags = tags + } + case "properties": + if v != nil { + var properties Properties + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + rp.Properties = &properties + } + } + } + + return nil +} + +// ResourceType the scheduled query rule resource. +type ResourceType struct { + autorest.Response `json:"-"` + // Kind - Indicates the type of scheduled query rule. The default is LogAlert. Possible values include: 'LogAlert', 'LogToMetric' + Kind Kind `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` + // SystemData - READ-ONLY; SystemData of ScheduledQueryRule. + SystemData *SystemData `json:"systemData,omitempty"` + // Properties - The rule properties of the resource. + *Properties `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceType. +func (rt ResourceType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rt.Kind != "" { + objectMap["kind"] = rt.Kind + } + if rt.Properties != nil { + objectMap["properties"] = rt.Properties + } + if rt.Tags != nil { + objectMap["tags"] = rt.Tags + } + if rt.Location != nil { + objectMap["location"] = rt.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ResourceType struct. +func (rt *ResourceType) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "kind": + if v != nil { + var kind Kind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + rt.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + rt.Etag = &etag + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + rt.SystemData = &systemData + } + case "properties": + if v != nil { + var properties Properties + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + rt.Properties = &properties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + rt.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + rt.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rt.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rt.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rt.Type = &typeVar + } + } + } + + return nil +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource +// which has 'tags' and a 'location' +type TrackedResource struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/scheduledqueryrules.go b/services/monitor/mgmt/2021-08-01/scheduledqueryrules/scheduledqueryrules.go similarity index 54% rename from services/preview/monitor/mgmt/2021-04-01-preview/insights/scheduledqueryrules.go rename to services/monitor/mgmt/2021-08-01/scheduledqueryrules/scheduledqueryrules.go index d619338b4e0d..65274d4b509d 100644 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/scheduledqueryrules.go +++ b/services/monitor/mgmt/2021-08-01/scheduledqueryrules/scheduledqueryrules.go @@ -1,4 +1,4 @@ -package insights +package scheduledqueryrules // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -15,31 +15,30 @@ import ( "net/http" ) -// ScheduledQueryRulesClient is the monitor Management Client -type ScheduledQueryRulesClient struct { +// Client is the monitor Management Client +type Client struct { BaseClient } -// NewScheduledQueryRulesClient creates an instance of the ScheduledQueryRulesClient client. -func NewScheduledQueryRulesClient(subscriptionID string) ScheduledQueryRulesClient { - return NewScheduledQueryRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +// NewClient creates an instance of the Client client. +func NewClient(subscriptionID string) Client { + return NewClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// NewScheduledQueryRulesClientWithBaseURI creates an instance of the ScheduledQueryRulesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewScheduledQueryRulesClientWithBaseURI(baseURI string, subscriptionID string) ScheduledQueryRulesClient { - return ScheduledQueryRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +// NewClientWithBaseURI creates an instance of the Client client using a custom endpoint. Use this when interacting +// with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewClientWithBaseURI(baseURI string, subscriptionID string) Client { + return Client{NewWithBaseURI(baseURI, subscriptionID)} } -// CreateOrUpdate creates or updates an log search rule. +// CreateOrUpdate creates or updates a scheduled query rule. // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to create or update. -func (client ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResource) (result LogSearchRuleResource, err error) { +func (client Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters ResourceType) (result ResourceType, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.CreateOrUpdate") + ctx = tracing.StartSpan(ctx, fqdn+"/Client.CreateOrUpdate") defer func() { sc := -1 if result.Response.Response != nil { @@ -55,33 +54,26 @@ func (client ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, reso Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.LogSearchRule", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source.DataSourceID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.LogSearchRule.Schedule", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Schedule.FrequencyInMinutes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogSearchRule.Schedule.TimeWindowInMinutes", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("insights.ScheduledQueryRulesClient", "CreateOrUpdate", err.Error()) + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("scheduledqueryrules.Client", "CreateOrUpdate", err.Error()) } req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "scheduledqueryrules.Client", "CreateOrUpdate", nil, "Failure preparing request") return } resp, err := client.CreateOrUpdateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "CreateOrUpdate", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "scheduledqueryrules.Client", "CreateOrUpdate", resp, "Failure sending request") return } result, err = client.CreateOrUpdateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "CreateOrUpdate", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "scheduledqueryrules.Client", "CreateOrUpdate", resp, "Failure responding to request") return } @@ -89,23 +81,25 @@ func (client ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, reso } // CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ScheduledQueryRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResource) (*http.Request, error) { +func (client Client) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters ResourceType) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "ruleName": autorest.Encode("path", ruleName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-04-16" + const APIVersion = "2021-08-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } + parameters.Etag = nil + parameters.SystemData = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -113,13 +107,13 @@ func (client ScheduledQueryRulesClient) CreateOrUpdatePreparer(ctx context.Conte // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. -func (client ScheduledQueryRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { +func (client Client) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. -func (client ScheduledQueryRulesClient) CreateOrUpdateResponder(resp *http.Response) (result LogSearchRuleResource, err error) { +func (client Client) CreateOrUpdateResponder(resp *http.Response) (result ResourceType, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), @@ -129,13 +123,13 @@ func (client ScheduledQueryRulesClient) CreateOrUpdateResponder(resp *http.Respo return } -// Delete deletes a Log Search rule +// Delete deletes a scheduled query rule. // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. -func (client ScheduledQueryRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { +func (client Client) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.Delete") + ctx = tracing.StartSpan(ctx, fqdn+"/Client.Delete") defer func() { sc := -1 if result.Response != nil { @@ -145,30 +139,30 @@ func (client ScheduledQueryRulesClient) Delete(ctx context.Context, resourceGrou }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.ScheduledQueryRulesClient", "Delete", err.Error()) + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("scheduledqueryrules.Client", "Delete", err.Error()) } req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "scheduledqueryrules.Client", "Delete", nil, "Failure preparing request") return } resp, err := client.DeleteSender(req) if err != nil { result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "scheduledqueryrules.Client", "Delete", resp, "Failure sending request") return } result, err = client.DeleteResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "scheduledqueryrules.Client", "Delete", resp, "Failure responding to request") return } @@ -176,14 +170,14 @@ func (client ScheduledQueryRulesClient) Delete(ctx context.Context, resourceGrou } // DeletePreparer prepares the Delete request. -func (client ScheduledQueryRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { +func (client Client) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "ruleName": autorest.Encode("path", ruleName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-04-16" + const APIVersion = "2021-08-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -191,20 +185,20 @@ func (client ScheduledQueryRulesClient) DeletePreparer(ctx context.Context, reso preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. -func (client ScheduledQueryRulesClient) DeleteSender(req *http.Request) (*http.Response, error) { +func (client Client) DeleteSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. -func (client ScheduledQueryRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { +func (client Client) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), @@ -213,13 +207,13 @@ func (client ScheduledQueryRulesClient) DeleteResponder(resp *http.Response) (re return } -// Get gets an Log Search rule +// Get retrieve an scheduled query rule definition. // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. -func (client ScheduledQueryRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result LogSearchRuleResource, err error) { +func (client Client) Get(ctx context.Context, resourceGroupName string, ruleName string) (result ResourceType, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.Get") + ctx = tracing.StartSpan(ctx, fqdn+"/Client.Get") defer func() { sc := -1 if result.Response.Response != nil { @@ -229,30 +223,30 @@ func (client ScheduledQueryRulesClient) Get(ctx context.Context, resourceGroupNa }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.ScheduledQueryRulesClient", "Get", err.Error()) + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("scheduledqueryrules.Client", "Get", err.Error()) } req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Get", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "scheduledqueryrules.Client", "Get", nil, "Failure preparing request") return } resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Get", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "scheduledqueryrules.Client", "Get", resp, "Failure sending request") return } result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Get", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "scheduledqueryrules.Client", "Get", resp, "Failure responding to request") return } @@ -260,14 +254,14 @@ func (client ScheduledQueryRulesClient) Get(ctx context.Context, resourceGroupNa } // GetPreparer prepares the Get request. -func (client ScheduledQueryRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { +func (client Client) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "ruleName": autorest.Encode("path", ruleName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-04-16" + const APIVersion = "2021-08-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -275,20 +269,20 @@ func (client ScheduledQueryRulesClient) GetPreparer(ctx context.Context, resourc preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. -func (client ScheduledQueryRulesClient) GetSender(req *http.Request) (*http.Response, error) { +func (client Client) GetSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client ScheduledQueryRulesClient) GetResponder(resp *http.Response) (result LogSearchRuleResource, err error) { +func (client Client) GetResponder(resp *http.Response) (result ResourceType, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -298,47 +292,50 @@ func (client ScheduledQueryRulesClient) GetResponder(resp *http.Response) (resul return } -// ListByResourceGroup list the Log Search rules within a resource group. +// ListByResourceGroup retrieve scheduled query rule definitions in a resource group. // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. -// filter - the filter to apply on the operation. For more information please see -// https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx -func (client ScheduledQueryRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result LogSearchRuleResourceCollection, err error) { +func (client Client) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ResourceCollectionPage, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.ListByResourceGroup") + ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListByResourceGroup") defer func() { sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode + if result.rc.Response.Response != nil { + sc = result.rc.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.ScheduledQueryRulesClient", "ListByResourceGroup", err.Error()) + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("scheduledqueryrules.Client", "ListByResourceGroup", err.Error()) } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter) + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListByResourceGroup", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "scheduledqueryrules.Client", "ListByResourceGroup", nil, "Failure preparing request") return } resp, err := client.ListByResourceGroupSender(req) if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListByResourceGroup", resp, "Failure sending request") + result.rc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "scheduledqueryrules.Client", "ListByResourceGroup", resp, "Failure sending request") return } - result, err = client.ListByResourceGroupResponder(resp) + result.rc, err = client.ListByResourceGroupResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListByResourceGroup", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "scheduledqueryrules.Client", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.rc.hasNextLink() && result.rc.IsEmpty() { + err = result.NextWithContext(ctx) return } @@ -346,37 +343,34 @@ func (client ScheduledQueryRulesClient) ListByResourceGroup(ctx context.Context, } // ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ScheduledQueryRulesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string) (*http.Request, error) { +func (client Client) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-04-16" + const APIVersion = "2021-08-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the // http.Response Body if it receives an error. -func (client ScheduledQueryRulesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { +func (client Client) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always // closes the http.Response Body. -func (client ScheduledQueryRulesClient) ListByResourceGroupResponder(resp *http.Response) (result LogSearchRuleResourceCollection, err error) { +func (client Client) ListByResourceGroupResponder(resp *http.Response) (result ResourceCollection, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -386,17 +380,51 @@ func (client ScheduledQueryRulesClient) ListByResourceGroupResponder(resp *http. return } -// ListBySubscription list the Log Search rules within a subscription group. -// Parameters: -// filter - the filter to apply on the operation. For more information please see -// https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx -func (client ScheduledQueryRulesClient) ListBySubscription(ctx context.Context, filter string) (result LogSearchRuleResourceCollection, err error) { +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client Client) listByResourceGroupNextResults(ctx context.Context, lastResults ResourceCollection) (result ResourceCollection, err error) { + req, err := lastResults.resourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "scheduledqueryrules.Client", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "scheduledqueryrules.Client", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduledqueryrules.Client", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client Client) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ResourceCollectionIterator, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.ListBySubscription") + ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListByResourceGroup") defer func() { sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListBySubscription retrieve a scheduled query rule definitions in a subscription. +func (client Client) ListBySubscription(ctx context.Context) (result ResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListBySubscription") + defer func() { + sc := -1 + if result.rc.Response.Response != nil { + sc = result.rc.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() @@ -404,25 +432,30 @@ func (client ScheduledQueryRulesClient) ListBySubscription(ctx context.Context, if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.ScheduledQueryRulesClient", "ListBySubscription", err.Error()) + return result, validation.NewError("scheduledqueryrules.Client", "ListBySubscription", err.Error()) } - req, err := client.ListBySubscriptionPreparer(ctx, filter) + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "scheduledqueryrules.Client", "ListBySubscription", nil, "Failure preparing request") return } resp, err := client.ListBySubscriptionSender(req) if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", resp, "Failure sending request") + result.rc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "scheduledqueryrules.Client", "ListBySubscription", resp, "Failure sending request") return } - result, err = client.ListBySubscriptionResponder(resp) + result.rc, err = client.ListBySubscriptionResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "scheduledqueryrules.Client", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.rc.hasNextLink() && result.rc.IsEmpty() { + err = result.NextWithContext(ctx) return } @@ -430,36 +463,33 @@ func (client ScheduledQueryRulesClient) ListBySubscription(ctx context.Context, } // ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client ScheduledQueryRulesClient) ListBySubscriptionPreparer(ctx context.Context, filter string) (*http.Request, error) { +func (client Client) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { pathParameters := map[string]interface{}{ "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-04-16" + const APIVersion = "2021-08-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/scheduledQueryRules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // ListBySubscriptionSender sends the ListBySubscription request. The method will close the // http.Response Body if it receives an error. -func (client ScheduledQueryRulesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { +func (client Client) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always // closes the http.Response Body. -func (client ScheduledQueryRulesClient) ListBySubscriptionResponder(resp *http.Response) (result LogSearchRuleResourceCollection, err error) { +func (client Client) ListBySubscriptionResponder(resp *http.Response) (result ResourceCollection, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -469,14 +499,51 @@ func (client ScheduledQueryRulesClient) ListBySubscriptionResponder(resp *http.R return } -// Update update log search Rule. +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client Client) listBySubscriptionNextResults(ctx context.Context, lastResults ResourceCollection) (result ResourceCollection, err error) { + req, err := lastResults.resourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "scheduledqueryrules.Client", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "scheduledqueryrules.Client", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduledqueryrules.Client", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client Client) ListBySubscriptionComplete(ctx context.Context) (result ResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx) + return +} + +// Update update a scheduled query rule. // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to update. -func (client ScheduledQueryRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResourcePatch) (result LogSearchRuleResource, err error) { +func (client Client) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters ResourcePatch) (result ResourceType, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.Update") + ctx = tracing.StartSpan(ctx, fqdn+"/Client.Update") defer func() { sc := -1 if result.Response.Response != nil { @@ -491,25 +558,25 @@ func (client ScheduledQueryRulesClient) Update(ctx context.Context, resourceGrou {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.ScheduledQueryRulesClient", "Update", err.Error()) + return result, validation.NewError("scheduledqueryrules.Client", "Update", err.Error()) } req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, parameters) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Update", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "scheduledqueryrules.Client", "Update", nil, "Failure preparing request") return } resp, err := client.UpdateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Update", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "scheduledqueryrules.Client", "Update", resp, "Failure sending request") return } result, err = client.UpdateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Update", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "scheduledqueryrules.Client", "Update", resp, "Failure responding to request") return } @@ -517,14 +584,14 @@ func (client ScheduledQueryRulesClient) Update(ctx context.Context, resourceGrou } // UpdatePreparer prepares the Update request. -func (client ScheduledQueryRulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResourcePatch) (*http.Request, error) { +func (client Client) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters ResourcePatch) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "ruleName": autorest.Encode("path", ruleName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-04-16" + const APIVersion = "2021-08-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -533,7 +600,7 @@ func (client ScheduledQueryRulesClient) UpdatePreparer(ctx context.Context, reso autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -541,13 +608,13 @@ func (client ScheduledQueryRulesClient) UpdatePreparer(ctx context.Context, reso // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. -func (client ScheduledQueryRulesClient) UpdateSender(req *http.Request) (*http.Response, error) { +func (client Client) UpdateSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. -func (client ScheduledQueryRulesClient) UpdateResponder(resp *http.Response) (result LogSearchRuleResource, err error) { +func (client Client) UpdateResponder(resp *http.Response) (result ResourceType, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), diff --git a/services/monitor/mgmt/2021-08-01/scheduledqueryrules/scheduledqueryrulesapi/interfaces.go b/services/monitor/mgmt/2021-08-01/scheduledqueryrules/scheduledqueryrulesapi/interfaces.go new file mode 100644 index 000000000000..3c141a4633e2 --- /dev/null +++ b/services/monitor/mgmt/2021-08-01/scheduledqueryrules/scheduledqueryrulesapi/interfaces.go @@ -0,0 +1,27 @@ +package scheduledqueryrulesapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for 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 ( + "context" + "github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2021-08-01/scheduledqueryrules" + "github.com/Azure/go-autorest/autorest" +) + +// ClientAPI contains the set of methods on the Client type. +type ClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters scheduledqueryrules.ResourceType) (result scheduledqueryrules.ResourceType, err error) + Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, ruleName string) (result scheduledqueryrules.ResourceType, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result scheduledqueryrules.ResourceCollectionPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result scheduledqueryrules.ResourceCollectionIterator, err error) + ListBySubscription(ctx context.Context) (result scheduledqueryrules.ResourceCollectionPage, err error) + ListBySubscriptionComplete(ctx context.Context) (result scheduledqueryrules.ResourceCollectionIterator, err error) + Update(ctx context.Context, resourceGroupName string, ruleName string, parameters scheduledqueryrules.ResourcePatch) (result scheduledqueryrules.ResourceType, err error) +} + +var _ ClientAPI = (*scheduledqueryrules.Client)(nil) diff --git a/services/monitor/mgmt/2021-08-01/scheduledqueryrules/version.go b/services/monitor/mgmt/2021-08-01/scheduledqueryrules/version.go new file mode 100644 index 000000000000..7b93c062d30f --- /dev/null +++ b/services/monitor/mgmt/2021-08-01/scheduledqueryrules/version.go @@ -0,0 +1,19 @@ +package scheduledqueryrules + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " scheduledqueryrules/2021-08-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/CHANGELOG.md b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/_meta.json b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/_meta.json new file mode 100644 index 000000000000..b55af9855146 --- /dev/null +++ b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "83f6c7b9ac240d3862e909245f0a61d70ae33908", + "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", + "tag": "package-2016-03-preview-monitorlegacy", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2016-03-preview-monitorlegacy --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/alertruleincidents.go b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/alertruleincidents.go similarity index 88% rename from services/preview/monitor/mgmt/2021-04-01-preview/insights/alertruleincidents.go rename to services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/alertruleincidents.go index a7dcd9cba31e..1fccc97f9f1b 100644 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/alertruleincidents.go +++ b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/alertruleincidents.go @@ -1,4 +1,4 @@ -package insights +package monitorlegacy // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -54,25 +54,25 @@ func (client AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupNam {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.AlertRuleIncidentsClient", "Get", err.Error()) + return result, validation.NewError("monitorlegacy.AlertRuleIncidentsClient", "Get", err.Error()) } req, err := client.GetPreparer(ctx, resourceGroupName, ruleName, incidentName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "Get", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRuleIncidentsClient", "Get", nil, "Failure preparing request") return } resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "Get", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRuleIncidentsClient", "Get", resp, "Failure sending request") return } result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "Get", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRuleIncidentsClient", "Get", resp, "Failure responding to request") return } @@ -140,25 +140,25 @@ func (client AlertRuleIncidentsClient) ListByAlertRule(ctx context.Context, reso {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.AlertRuleIncidentsClient", "ListByAlertRule", err.Error()) + return result, validation.NewError("monitorlegacy.AlertRuleIncidentsClient", "ListByAlertRule", err.Error()) } req, err := client.ListByAlertRulePreparer(ctx, resourceGroupName, ruleName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRuleIncidentsClient", "ListByAlertRule", nil, "Failure preparing request") return } resp, err := client.ListByAlertRuleSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure sending request") return } result, err = client.ListByAlertRuleResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure responding to request") return } diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/alertrules.go b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/alertrules.go similarity index 87% rename from services/preview/monitor/mgmt/2021-04-01-preview/insights/alertrules.go rename to services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/alertrules.go index 888ed122e267..5a78bf9b356c 100644 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/alertrules.go +++ b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/alertrules.go @@ -1,4 +1,4 @@ -package insights +package monitorlegacy // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -58,25 +58,25 @@ func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroup }}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.AlertRulesClient", "CreateOrUpdate", err.Error()) + return result, validation.NewError("monitorlegacy.AlertRulesClient", "CreateOrUpdate", err.Error()) } req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "CreateOrUpdate", nil, "Failure preparing request") return } resp, err := client.CreateOrUpdateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "CreateOrUpdate", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "CreateOrUpdate", resp, "Failure sending request") return } result, err = client.CreateOrUpdateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "CreateOrUpdate", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "CreateOrUpdate", resp, "Failure responding to request") return } @@ -145,25 +145,25 @@ func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName str {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.AlertRulesClient", "Delete", err.Error()) + return result, validation.NewError("monitorlegacy.AlertRulesClient", "Delete", err.Error()) } req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "Delete", nil, "Failure preparing request") return } resp, err := client.DeleteSender(req) if err != nil { result.Response = resp - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "Delete", resp, "Failure sending request") return } result, err = client.DeleteResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "Delete", resp, "Failure responding to request") return } @@ -229,25 +229,25 @@ func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.AlertRulesClient", "Get", err.Error()) + return result, validation.NewError("monitorlegacy.AlertRulesClient", "Get", err.Error()) } req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Get", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "Get", nil, "Failure preparing request") return } resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Get", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "Get", resp, "Failure sending request") return } result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Get", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "Get", resp, "Failure responding to request") return } @@ -313,25 +313,25 @@ func (client AlertRulesClient) ListByResourceGroup(ctx context.Context, resource {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.AlertRulesClient", "ListByResourceGroup", err.Error()) + return result, validation.NewError("monitorlegacy.AlertRulesClient", "ListByResourceGroup", err.Error()) } req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListByResourceGroup", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "ListByResourceGroup", nil, "Failure preparing request") return } resp, err := client.ListByResourceGroupSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListByResourceGroup", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "ListByResourceGroup", resp, "Failure sending request") return } result, err = client.ListByResourceGroupResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListByResourceGroup", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "ListByResourceGroup", resp, "Failure responding to request") return } @@ -391,25 +391,25 @@ func (client AlertRulesClient) ListBySubscription(ctx context.Context) (result A if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.AlertRulesClient", "ListBySubscription", err.Error()) + return result, validation.NewError("monitorlegacy.AlertRulesClient", "ListBySubscription", err.Error()) } req, err := client.ListBySubscriptionPreparer(ctx) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "ListBySubscription", nil, "Failure preparing request") return } resp, err := client.ListBySubscriptionSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "ListBySubscription", resp, "Failure sending request") return } result, err = client.ListBySubscriptionResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "ListBySubscription", resp, "Failure responding to request") return } @@ -475,25 +475,25 @@ func (client AlertRulesClient) Update(ctx context.Context, resourceGroupName str {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.AlertRulesClient", "Update", err.Error()) + return result, validation.NewError("monitorlegacy.AlertRulesClient", "Update", err.Error()) } req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, alertRulesResource) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Update", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "Update", nil, "Failure preparing request") return } resp, err := client.UpdateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Update", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "Update", resp, "Failure sending request") return } result, err = client.UpdateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Update", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "Update", resp, "Failure responding to request") return } diff --git a/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/client.go b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/client.go new file mode 100644 index 000000000000..a5d40514c20e --- /dev/null +++ b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/client.go @@ -0,0 +1,41 @@ +// Package monitorlegacy implements the Azure ARM Monitorlegacy service API version . +// +// Monitor Management Client +package monitorlegacy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for 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 ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Monitorlegacy + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Monitorlegacy. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/enums.go b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/enums.go new file mode 100644 index 000000000000..695ea6d58754 --- /dev/null +++ b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/enums.go @@ -0,0 +1,132 @@ +package monitorlegacy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ConditionOperator enumerates the values for condition operator. +type ConditionOperator string + +const ( + // GreaterThan ... + GreaterThan ConditionOperator = "GreaterThan" + // GreaterThanOrEqual ... + GreaterThanOrEqual ConditionOperator = "GreaterThanOrEqual" + // LessThan ... + LessThan ConditionOperator = "LessThan" + // LessThanOrEqual ... + LessThanOrEqual ConditionOperator = "LessThanOrEqual" +) + +// PossibleConditionOperatorValues returns an array of possible values for the ConditionOperator const type. +func PossibleConditionOperatorValues() []ConditionOperator { + return []ConditionOperator{GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual} +} + +// DataStatus enumerates the values for data status. +type DataStatus string + +const ( + // NotPresent ... + NotPresent DataStatus = "notPresent" + // Present ... + Present DataStatus = "present" +) + +// PossibleDataStatusValues returns an array of possible values for the DataStatus const type. +func PossibleDataStatusValues() []DataStatus { + return []DataStatus{NotPresent, Present} +} + +// OdataType enumerates the values for odata type. +type OdataType string + +const ( + // OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource ... + OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource" + // OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource ... + OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource" + // OdataTypeRuleDataSource ... + OdataTypeRuleDataSource OdataType = "RuleDataSource" +) + +// PossibleOdataTypeValues returns an array of possible values for the OdataType const type. +func PossibleOdataTypeValues() []OdataType { + return []OdataType{OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource, OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource, OdataTypeRuleDataSource} +} + +// OdataTypeBasicRuleAction enumerates the values for odata type basic rule action. +type OdataTypeBasicRuleAction string + +const ( + // OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction ... + OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleEmailAction" + // OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction ... + OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction" + // OdataTypeRuleAction ... + OdataTypeRuleAction OdataTypeBasicRuleAction = "RuleAction" +) + +// PossibleOdataTypeBasicRuleActionValues returns an array of possible values for the OdataTypeBasicRuleAction const type. +func PossibleOdataTypeBasicRuleActionValues() []OdataTypeBasicRuleAction { + return []OdataTypeBasicRuleAction{OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction, OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction, OdataTypeRuleAction} +} + +// OdataTypeBasicRuleCondition enumerates the values for odata type basic rule condition. +type OdataTypeBasicRuleCondition string + +const ( + // OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition ... + OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition" + // OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition ... + OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition" + // OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition ... + OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition" + // OdataTypeRuleCondition ... + OdataTypeRuleCondition OdataTypeBasicRuleCondition = "RuleCondition" +) + +// PossibleOdataTypeBasicRuleConditionValues returns an array of possible values for the OdataTypeBasicRuleCondition const type. +func PossibleOdataTypeBasicRuleConditionValues() []OdataTypeBasicRuleCondition { + return []OdataTypeBasicRuleCondition{OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition, OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition, OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition, OdataTypeRuleCondition} +} + +// OnboardingStatus enumerates the values for onboarding status. +type OnboardingStatus string + +const ( + // NotOnboarded ... + NotOnboarded OnboardingStatus = "notOnboarded" + // Onboarded ... + Onboarded OnboardingStatus = "onboarded" + // Unknown ... + Unknown OnboardingStatus = "unknown" +) + +// PossibleOnboardingStatusValues returns an array of possible values for the OnboardingStatus const type. +func PossibleOnboardingStatusValues() []OnboardingStatus { + return []OnboardingStatus{NotOnboarded, Onboarded, Unknown} +} + +// TimeAggregationOperator enumerates the values for time aggregation operator. +type TimeAggregationOperator string + +const ( + // Average ... + Average TimeAggregationOperator = "Average" + // Last ... + Last TimeAggregationOperator = "Last" + // Maximum ... + Maximum TimeAggregationOperator = "Maximum" + // Minimum ... + Minimum TimeAggregationOperator = "Minimum" + // Total ... + Total TimeAggregationOperator = "Total" +) + +// PossibleTimeAggregationOperatorValues returns an array of possible values for the TimeAggregationOperator const type. +func PossibleTimeAggregationOperatorValues() []TimeAggregationOperator { + return []TimeAggregationOperator{Average, Last, Maximum, Minimum, Total} +} diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/eventcategories.go b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/eventcategories.go similarity index 88% rename from services/preview/monitor/mgmt/2021-04-01-preview/insights/eventcategories.go rename to services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/eventcategories.go index 86e59b424363..5806b06c0524 100644 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/eventcategories.go +++ b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/eventcategories.go @@ -1,4 +1,4 @@ -package insights +package monitorlegacy // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -45,20 +45,20 @@ func (client EventCategoriesClient) List(ctx context.Context) (result EventCateg } req, err := client.ListPreparer(ctx) if err != nil { - err = autorest.NewErrorWithError(err, "insights.EventCategoriesClient", "List", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "monitorlegacy.EventCategoriesClient", "List", nil, "Failure preparing request") return } resp, err := client.ListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.EventCategoriesClient", "List", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "monitorlegacy.EventCategoriesClient", "List", resp, "Failure sending request") return } result, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.EventCategoriesClient", "List", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "monitorlegacy.EventCategoriesClient", "List", resp, "Failure responding to request") return } @@ -75,7 +75,7 @@ func (client EventCategoriesClient) ListPreparer(ctx context.Context) (*http.Req preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventcategories"), + autorest.WithPath("/providers/Microsoft.Insights/eventcategories"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/logprofiles.go b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/logprofiles.go similarity index 84% rename from services/preview/monitor/mgmt/2021-04-01-preview/insights/logprofiles.go rename to services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/logprofiles.go index 64fda18dde7c..762a7e64bc28 100644 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/logprofiles.go +++ b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/logprofiles.go @@ -1,4 +1,4 @@ -package insights +package monitorlegacy // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -59,25 +59,25 @@ func (client LogProfilesClient) CreateOrUpdate(ctx context.Context, logProfileNa }}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.LogProfilesClient", "CreateOrUpdate", err.Error()) + return result, validation.NewError("monitorlegacy.LogProfilesClient", "CreateOrUpdate", err.Error()) } req, err := client.CreateOrUpdatePreparer(ctx, logProfileName, parameters) if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "CreateOrUpdate", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "CreateOrUpdate", nil, "Failure preparing request") return } resp, err := client.CreateOrUpdateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "CreateOrUpdate", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "CreateOrUpdate", resp, "Failure sending request") return } result, err = client.CreateOrUpdateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "CreateOrUpdate", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "CreateOrUpdate", resp, "Failure responding to request") return } @@ -100,7 +100,7 @@ func (client LogProfilesClient) CreateOrUpdatePreparer(ctx context.Context, logP autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -141,25 +141,25 @@ func (client LogProfilesClient) Delete(ctx context.Context, logProfileName strin if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.LogProfilesClient", "Delete", err.Error()) + return result, validation.NewError("monitorlegacy.LogProfilesClient", "Delete", err.Error()) } req, err := client.DeletePreparer(ctx, logProfileName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "Delete", nil, "Failure preparing request") return } resp, err := client.DeleteSender(req) if err != nil { result.Response = resp - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "Delete", resp, "Failure sending request") return } result, err = client.DeleteResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "Delete", resp, "Failure responding to request") return } @@ -181,7 +181,7 @@ func (client LogProfilesClient) DeletePreparer(ctx context.Context, logProfileNa preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -220,25 +220,25 @@ func (client LogProfilesClient) Get(ctx context.Context, logProfileName string) if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.LogProfilesClient", "Get", err.Error()) + return result, validation.NewError("monitorlegacy.LogProfilesClient", "Get", err.Error()) } req, err := client.GetPreparer(ctx, logProfileName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Get", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "Get", nil, "Failure preparing request") return } resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Get", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "Get", resp, "Failure sending request") return } result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Get", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "Get", resp, "Failure responding to request") return } @@ -260,7 +260,7 @@ func (client LogProfilesClient) GetPreparer(ctx context.Context, logProfileName preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -298,25 +298,25 @@ func (client LogProfilesClient) List(ctx context.Context) (result LogProfileColl if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.LogProfilesClient", "List", err.Error()) + return result, validation.NewError("monitorlegacy.LogProfilesClient", "List", err.Error()) } req, err := client.ListPreparer(ctx) if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "List", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "List", nil, "Failure preparing request") return } resp, err := client.ListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "List", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "List", resp, "Failure sending request") return } result, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "List", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "List", resp, "Failure responding to request") return } @@ -337,7 +337,7 @@ func (client LogProfilesClient) ListPreparer(ctx context.Context) (*http.Request preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -378,25 +378,25 @@ func (client LogProfilesClient) Update(ctx context.Context, logProfileName strin if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.LogProfilesClient", "Update", err.Error()) + return result, validation.NewError("monitorlegacy.LogProfilesClient", "Update", err.Error()) } req, err := client.UpdatePreparer(ctx, logProfileName, logProfilesResource) if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Update", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "Update", nil, "Failure preparing request") return } resp, err := client.UpdateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Update", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "Update", resp, "Failure sending request") return } result, err = client.UpdateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Update", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "Update", resp, "Failure responding to request") return } @@ -419,7 +419,7 @@ func (client LogProfilesClient) UpdatePreparer(ctx context.Context, logProfileNa autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithJSON(logProfilesResource), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/models.go b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/models.go new file mode 100644 index 000000000000..7c2accedf26a --- /dev/null +++ b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/models.go @@ -0,0 +1,1678 @@ +package monitorlegacy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for 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 ( + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy" + +// AlertRule an alert rule. +type AlertRule struct { + // Name - the name of the alert rule. + Name *string `json:"name,omitempty"` + // Description - the description of the alert rule that will be included in the alert email. + Description *string `json:"description,omitempty"` + // ProvisioningState - the provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` + // IsEnabled - the flag that indicates whether the alert rule is enabled. + IsEnabled *bool `json:"isEnabled,omitempty"` + // Condition - the condition that results in the alert rule being activated. + Condition BasicRuleCondition `json:"condition,omitempty"` + // Action - action that is performed when the alert rule becomes active, and when an alert condition is resolved. + Action BasicRuleAction `json:"action,omitempty"` + // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + Actions *[]BasicRuleAction `json:"actions,omitempty"` + // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. + LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` +} + +// MarshalJSON is the custom marshaler for AlertRule. +func (ar AlertRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ar.Name != nil { + objectMap["name"] = ar.Name + } + if ar.Description != nil { + objectMap["description"] = ar.Description + } + if ar.ProvisioningState != nil { + objectMap["provisioningState"] = ar.ProvisioningState + } + if ar.IsEnabled != nil { + objectMap["isEnabled"] = ar.IsEnabled + } + objectMap["condition"] = ar.Condition + objectMap["action"] = ar.Action + if ar.Actions != nil { + objectMap["actions"] = ar.Actions + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AlertRule struct. +func (ar *AlertRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ar.Name = &name + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + ar.Description = &description + } + case "provisioningState": + if v != nil { + var provisioningState string + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + ar.ProvisioningState = &provisioningState + } + case "isEnabled": + if v != nil { + var isEnabled bool + err = json.Unmarshal(*v, &isEnabled) + if err != nil { + return err + } + ar.IsEnabled = &isEnabled + } + case "condition": + if v != nil { + condition, err := unmarshalBasicRuleCondition(*v) + if err != nil { + return err + } + ar.Condition = condition + } + case "action": + if v != nil { + action, err := unmarshalBasicRuleAction(*v) + if err != nil { + return err + } + ar.Action = action + } + case "actions": + if v != nil { + actions, err := unmarshalBasicRuleActionArray(*v) + if err != nil { + return err + } + ar.Actions = &actions + } + case "lastUpdatedTime": + if v != nil { + var lastUpdatedTime date.Time + err = json.Unmarshal(*v, &lastUpdatedTime) + if err != nil { + return err + } + ar.LastUpdatedTime = &lastUpdatedTime + } + } + } + + return nil +} + +// AlertRuleResource the alert rule resource. +type AlertRuleResource struct { + autorest.Response `json:"-"` + // AlertRule - The alert rule properties of the resource. + *AlertRule `json:"properties,omitempty"` + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for AlertRuleResource. +func (arr AlertRuleResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if arr.AlertRule != nil { + objectMap["properties"] = arr.AlertRule + } + if arr.Location != nil { + objectMap["location"] = arr.Location + } + if arr.Tags != nil { + objectMap["tags"] = arr.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AlertRuleResource struct. +func (arr *AlertRuleResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var alertRule AlertRule + err = json.Unmarshal(*v, &alertRule) + if err != nil { + return err + } + arr.AlertRule = &alertRule + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + arr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + arr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + arr.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + arr.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + arr.Tags = tags + } + } + } + + return nil +} + +// AlertRuleResourceCollection represents a collection of alert rule resources. +type AlertRuleResourceCollection struct { + autorest.Response `json:"-"` + // Value - the values for the alert rule resources. + Value *[]AlertRuleResource `json:"value,omitempty"` +} + +// AlertRuleResourcePatch the alert rule object for patch operations. +type AlertRuleResourcePatch struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // AlertRule - The properties of an alert rule. + *AlertRule `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AlertRuleResourcePatch. +func (arrp AlertRuleResourcePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if arrp.Tags != nil { + objectMap["tags"] = arrp.Tags + } + if arrp.AlertRule != nil { + objectMap["properties"] = arrp.AlertRule + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AlertRuleResourcePatch struct. +func (arrp *AlertRuleResourcePatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + arrp.Tags = tags + } + case "properties": + if v != nil { + var alertRule AlertRule + err = json.Unmarshal(*v, &alertRule) + if err != nil { + return err + } + arrp.AlertRule = &alertRule + } + } + } + + return nil +} + +// DataContainer information about a container with data for a given resource. +type DataContainer struct { + // Workspace - Log Analytics workspace information. + Workspace *WorkspaceInfo `json:"workspace,omitempty"` +} + +// Error error details. +type Error struct { + // Code - Error code identifying the specific error. + Code *string `json:"code,omitempty"` + // Message - Error message in the caller's locale. + Message *string `json:"message,omitempty"` +} + +// ErrorResponse describes the format of Error response. +type ErrorResponse struct { + // Code - Error code + Code *string `json:"code,omitempty"` + // Message - Error message indicating why the operation failed. + Message *string `json:"message,omitempty"` +} + +// EventCategoryCollection a collection of event categories. Currently possible values are: Administrative, +// Security, ServiceHealth, Alert, Recommendation, Policy. +type EventCategoryCollection struct { + autorest.Response `json:"-"` + // Value - the list that includes the Azure event categories. + Value *[]LocalizableString `json:"value,omitempty"` +} + +// Incident an alert incident indicates the activation status of an alert rule. +type Incident struct { + autorest.Response `json:"-"` + // Name - READ-ONLY; Incident name. + Name *string `json:"name,omitempty"` + // RuleName - READ-ONLY; Rule name that is associated with the incident. + RuleName *string `json:"ruleName,omitempty"` + // IsActive - READ-ONLY; A boolean to indicate whether the incident is active or resolved. + IsActive *bool `json:"isActive,omitempty"` + // ActivatedTime - READ-ONLY; The time at which the incident was activated in ISO8601 format. + ActivatedTime *date.Time `json:"activatedTime,omitempty"` + // ResolvedTime - READ-ONLY; The time at which the incident was resolved in ISO8601 format. If null, it means the incident is still active. + ResolvedTime *date.Time `json:"resolvedTime,omitempty"` +} + +// MarshalJSON is the custom marshaler for Incident. +func (i Incident) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// IncidentListResult the List incidents operation response. +type IncidentListResult struct { + autorest.Response `json:"-"` + // Value - the incident collection. + Value *[]Incident `json:"value,omitempty"` +} + +// LocalizableString the localizable string class. +type LocalizableString struct { + // Value - the invariant value. + Value *string `json:"value,omitempty"` + // LocalizedValue - the locale specific value. + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// LocationThresholdRuleCondition a rule condition based on a certain number of locations failing. +type LocationThresholdRuleCondition struct { + // WindowSize - 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. + WindowSize *string `json:"windowSize,omitempty"` + // FailedLocationCount - the number of locations that must fail to activate the alert. + FailedLocationCount *int32 `json:"failedLocationCount,omitempty"` + // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. + DataSource BasicRuleDataSource `json:"dataSource,omitempty"` + // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' + OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for LocationThresholdRuleCondition. +func (ltrc LocationThresholdRuleCondition) MarshalJSON() ([]byte, error) { + ltrc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition + objectMap := make(map[string]interface{}) + if ltrc.WindowSize != nil { + objectMap["windowSize"] = ltrc.WindowSize + } + if ltrc.FailedLocationCount != nil { + objectMap["failedLocationCount"] = ltrc.FailedLocationCount + } + objectMap["dataSource"] = ltrc.DataSource + if ltrc.OdataType != "" { + objectMap["odata.type"] = ltrc.OdataType + } + return json.Marshal(objectMap) +} + +// AsThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. +func (ltrc LocationThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { + return nil, false +} + +// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. +func (ltrc LocationThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { + return <rc, true +} + +// AsManagementEventRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. +func (ltrc LocationThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { + return nil, false +} + +// AsRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. +func (ltrc LocationThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { + return nil, false +} + +// AsBasicRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. +func (ltrc LocationThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { + return <rc, true +} + +// UnmarshalJSON is the custom unmarshaler for LocationThresholdRuleCondition struct. +func (ltrc *LocationThresholdRuleCondition) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "windowSize": + if v != nil { + var windowSize string + err = json.Unmarshal(*v, &windowSize) + if err != nil { + return err + } + ltrc.WindowSize = &windowSize + } + case "failedLocationCount": + if v != nil { + var failedLocationCount int32 + err = json.Unmarshal(*v, &failedLocationCount) + if err != nil { + return err + } + ltrc.FailedLocationCount = &failedLocationCount + } + case "dataSource": + if v != nil { + dataSource, err := unmarshalBasicRuleDataSource(*v) + if err != nil { + return err + } + ltrc.DataSource = dataSource + } + case "odata.type": + if v != nil { + var odataType OdataTypeBasicRuleCondition + err = json.Unmarshal(*v, &odataType) + if err != nil { + return err + } + ltrc.OdataType = odataType + } + } + } + + return nil +} + +// LogProfileCollection represents a collection of log profiles. +type LogProfileCollection struct { + autorest.Response `json:"-"` + // Value - the values of the log profiles. + Value *[]LogProfileResource `json:"value,omitempty"` +} + +// LogProfileProperties the log profile properties. +type LogProfileProperties struct { + // StorageAccountID - the resource id of the storage account to which you would like to send the Activity Log. + StorageAccountID *string `json:"storageAccountId,omitempty"` + // ServiceBusRuleID - 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}'. + ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` + // Locations - 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. + Locations *[]string `json:"locations,omitempty"` + // Categories - the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.' + Categories *[]string `json:"categories,omitempty"` + // RetentionPolicy - the retention policy for the events in the log. + RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` +} + +// LogProfileResource the log profile resource. +type LogProfileResource struct { + autorest.Response `json:"-"` + // LogProfileProperties - The log profile properties of the resource. + *LogProfileProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for LogProfileResource. +func (lpr LogProfileResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lpr.LogProfileProperties != nil { + objectMap["properties"] = lpr.LogProfileProperties + } + if lpr.Location != nil { + objectMap["location"] = lpr.Location + } + if lpr.Tags != nil { + objectMap["tags"] = lpr.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LogProfileResource struct. +func (lpr *LogProfileResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var logProfileProperties LogProfileProperties + err = json.Unmarshal(*v, &logProfileProperties) + if err != nil { + return err + } + lpr.LogProfileProperties = &logProfileProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + lpr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + lpr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + lpr.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + lpr.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + lpr.Tags = tags + } + } + } + + return nil +} + +// LogProfileResourcePatch the log profile resource for patch operations. +type LogProfileResourcePatch struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // LogProfileProperties - The log profile properties for an update operation. + *LogProfileProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for LogProfileResourcePatch. +func (lprp LogProfileResourcePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lprp.Tags != nil { + objectMap["tags"] = lprp.Tags + } + if lprp.LogProfileProperties != nil { + objectMap["properties"] = lprp.LogProfileProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LogProfileResourcePatch struct. +func (lprp *LogProfileResourcePatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + lprp.Tags = tags + } + case "properties": + if v != nil { + var logProfileProperties LogProfileProperties + err = json.Unmarshal(*v, &logProfileProperties) + if err != nil { + return err + } + lprp.LogProfileProperties = &logProfileProperties + } + } + } + + return nil +} + +// ManagementEventAggregationCondition how the data that is collected should be combined over time. +type ManagementEventAggregationCondition struct { + // Operator - the condition operator. Possible values include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' + Operator ConditionOperator `json:"operator,omitempty"` + // Threshold - The threshold value that activates the alert. + Threshold *float64 `json:"threshold,omitempty"` + // WindowSize - 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. + WindowSize *string `json:"windowSize,omitempty"` +} + +// ManagementEventRuleCondition a management event rule condition. +type ManagementEventRuleCondition struct { + // 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. + Aggregation *ManagementEventAggregationCondition `json:"aggregation,omitempty"` + // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. + DataSource BasicRuleDataSource `json:"dataSource,omitempty"` + // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' + OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagementEventRuleCondition. +func (merc ManagementEventRuleCondition) MarshalJSON() ([]byte, error) { + merc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition + objectMap := make(map[string]interface{}) + if merc.Aggregation != nil { + objectMap["aggregation"] = merc.Aggregation + } + objectMap["dataSource"] = merc.DataSource + if merc.OdataType != "" { + objectMap["odata.type"] = merc.OdataType + } + return json.Marshal(objectMap) +} + +// AsThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. +func (merc ManagementEventRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { + return nil, false +} + +// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. +func (merc ManagementEventRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { + return nil, false +} + +// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. +func (merc ManagementEventRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { + return &merc, true +} + +// AsRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. +func (merc ManagementEventRuleCondition) AsRuleCondition() (*RuleCondition, bool) { + return nil, false +} + +// AsBasicRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. +func (merc ManagementEventRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { + return &merc, true +} + +// UnmarshalJSON is the custom unmarshaler for ManagementEventRuleCondition struct. +func (merc *ManagementEventRuleCondition) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "aggregation": + if v != nil { + var aggregation ManagementEventAggregationCondition + err = json.Unmarshal(*v, &aggregation) + if err != nil { + return err + } + merc.Aggregation = &aggregation + } + case "dataSource": + if v != nil { + dataSource, err := unmarshalBasicRuleDataSource(*v) + if err != nil { + return err + } + merc.DataSource = dataSource + } + case "odata.type": + if v != nil { + var odataType OdataTypeBasicRuleCondition + err = json.Unmarshal(*v, &odataType) + if err != nil { + return err + } + merc.OdataType = odataType + } + } + } + + return nil +} + +// ProxyResource an azure resource object +type ProxyResource struct { + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Resource an azure resource object +type Resource struct { + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.Location != nil { + objectMap["location"] = r.Location + } + if r.Tags != nil { + objectMap["tags"] = r.Tags + } + return json.Marshal(objectMap) +} + +// ResponseWithError an error response from the API. +type ResponseWithError struct { + // Error - Error information. + Error *Error `json:"error,omitempty"` +} + +// RetentionPolicy specifies the retention policy for the log. +type RetentionPolicy struct { + // Enabled - a value indicating whether the retention policy is enabled. + Enabled *bool `json:"enabled,omitempty"` + // Days - the number of days for the retention in days. A value of 0 will retain the events indefinitely. + Days *int32 `json:"days,omitempty"` +} + +// BasicRuleAction the action that is performed when the alert rule becomes active, and when an alert condition is +// resolved. +type BasicRuleAction interface { + AsRuleEmailAction() (*RuleEmailAction, bool) + AsRuleWebhookAction() (*RuleWebhookAction, bool) + AsRuleAction() (*RuleAction, bool) +} + +// RuleAction the action that is performed when the alert rule becomes active, and when an alert condition is +// resolved. +type RuleAction struct { + // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' + OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` +} + +func unmarshalBasicRuleAction(body []byte) (BasicRuleAction, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["odata.type"] { + case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction): + var rea RuleEmailAction + err := json.Unmarshal(body, &rea) + return rea, err + case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction): + var rwa RuleWebhookAction + err := json.Unmarshal(body, &rwa) + return rwa, err + default: + var ra RuleAction + err := json.Unmarshal(body, &ra) + return ra, err + } +} +func unmarshalBasicRuleActionArray(body []byte) ([]BasicRuleAction, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + raArray := make([]BasicRuleAction, len(rawMessages)) + + for index, rawMessage := range rawMessages { + ra, err := unmarshalBasicRuleAction(*rawMessage) + if err != nil { + return nil, err + } + raArray[index] = ra + } + return raArray, nil +} + +// MarshalJSON is the custom marshaler for RuleAction. +func (ra RuleAction) MarshalJSON() ([]byte, error) { + ra.OdataType = OdataTypeRuleAction + objectMap := make(map[string]interface{}) + if ra.OdataType != "" { + objectMap["odata.type"] = ra.OdataType + } + return json.Marshal(objectMap) +} + +// AsRuleEmailAction is the BasicRuleAction implementation for RuleAction. +func (ra RuleAction) AsRuleEmailAction() (*RuleEmailAction, bool) { + return nil, false +} + +// AsRuleWebhookAction is the BasicRuleAction implementation for RuleAction. +func (ra RuleAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { + return nil, false +} + +// AsRuleAction is the BasicRuleAction implementation for RuleAction. +func (ra RuleAction) AsRuleAction() (*RuleAction, bool) { + return &ra, true +} + +// AsBasicRuleAction is the BasicRuleAction implementation for RuleAction. +func (ra RuleAction) AsBasicRuleAction() (BasicRuleAction, bool) { + return &ra, true +} + +// BasicRuleCondition the condition that results in the alert rule being activated. +type BasicRuleCondition interface { + AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) + AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) + AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) + AsRuleCondition() (*RuleCondition, bool) +} + +// RuleCondition the condition that results in the alert rule being activated. +type RuleCondition struct { + // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. + DataSource BasicRuleDataSource `json:"dataSource,omitempty"` + // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' + OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` +} + +func unmarshalBasicRuleCondition(body []byte) (BasicRuleCondition, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["odata.type"] { + case string(OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition): + var trc ThresholdRuleCondition + err := json.Unmarshal(body, &trc) + return trc, err + case string(OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition): + var ltrc LocationThresholdRuleCondition + err := json.Unmarshal(body, <rc) + return ltrc, err + case string(OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition): + var merc ManagementEventRuleCondition + err := json.Unmarshal(body, &merc) + return merc, err + default: + var rc RuleCondition + err := json.Unmarshal(body, &rc) + return rc, err + } +} +func unmarshalBasicRuleConditionArray(body []byte) ([]BasicRuleCondition, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + rcArray := make([]BasicRuleCondition, len(rawMessages)) + + for index, rawMessage := range rawMessages { + rc, err := unmarshalBasicRuleCondition(*rawMessage) + if err != nil { + return nil, err + } + rcArray[index] = rc + } + return rcArray, nil +} + +// MarshalJSON is the custom marshaler for RuleCondition. +func (rc RuleCondition) MarshalJSON() ([]byte, error) { + rc.OdataType = OdataTypeRuleCondition + objectMap := make(map[string]interface{}) + objectMap["dataSource"] = rc.DataSource + if rc.OdataType != "" { + objectMap["odata.type"] = rc.OdataType + } + return json.Marshal(objectMap) +} + +// AsThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. +func (rc RuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { + return nil, false +} + +// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. +func (rc RuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { + return nil, false +} + +// AsManagementEventRuleCondition is the BasicRuleCondition implementation for RuleCondition. +func (rc RuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { + return nil, false +} + +// AsRuleCondition is the BasicRuleCondition implementation for RuleCondition. +func (rc RuleCondition) AsRuleCondition() (*RuleCondition, bool) { + return &rc, true +} + +// AsBasicRuleCondition is the BasicRuleCondition implementation for RuleCondition. +func (rc RuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { + return &rc, true +} + +// UnmarshalJSON is the custom unmarshaler for RuleCondition struct. +func (rc *RuleCondition) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "dataSource": + if v != nil { + dataSource, err := unmarshalBasicRuleDataSource(*v) + if err != nil { + return err + } + rc.DataSource = dataSource + } + case "odata.type": + if v != nil { + var odataType OdataTypeBasicRuleCondition + err = json.Unmarshal(*v, &odataType) + if err != nil { + return err + } + rc.OdataType = odataType + } + } + } + + return nil +} + +// BasicRuleDataSource the resource from which the rule collects its data. +type BasicRuleDataSource interface { + AsRuleMetricDataSource() (*RuleMetricDataSource, bool) + AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) + AsRuleDataSource() (*RuleDataSource, bool) +} + +// RuleDataSource the resource from which the rule collects its data. +type RuleDataSource struct { + // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` + // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' + OdataType OdataType `json:"odata.type,omitempty"` +} + +func unmarshalBasicRuleDataSource(body []byte) (BasicRuleDataSource, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["odata.type"] { + case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource): + var rmds RuleMetricDataSource + err := json.Unmarshal(body, &rmds) + return rmds, err + case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource): + var rmeds RuleManagementEventDataSource + err := json.Unmarshal(body, &rmeds) + return rmeds, err + default: + var rds RuleDataSource + err := json.Unmarshal(body, &rds) + return rds, err + } +} +func unmarshalBasicRuleDataSourceArray(body []byte) ([]BasicRuleDataSource, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + rdsArray := make([]BasicRuleDataSource, len(rawMessages)) + + for index, rawMessage := range rawMessages { + rds, err := unmarshalBasicRuleDataSource(*rawMessage) + if err != nil { + return nil, err + } + rdsArray[index] = rds + } + return rdsArray, nil +} + +// MarshalJSON is the custom marshaler for RuleDataSource. +func (rds RuleDataSource) MarshalJSON() ([]byte, error) { + rds.OdataType = OdataTypeRuleDataSource + objectMap := make(map[string]interface{}) + if rds.ResourceURI != nil { + objectMap["resourceUri"] = rds.ResourceURI + } + if rds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rds.LegacyResourceID + } + if rds.ResourceLocation != nil { + objectMap["resourceLocation"] = rds.ResourceLocation + } + if rds.MetricNamespace != nil { + objectMap["metricNamespace"] = rds.MetricNamespace + } + if rds.OdataType != "" { + objectMap["odata.type"] = rds.OdataType + } + return json.Marshal(objectMap) +} + +// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleDataSource. +func (rds RuleDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { + return nil, false +} + +// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleDataSource. +func (rds RuleDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { + return nil, false +} + +// AsRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. +func (rds RuleDataSource) AsRuleDataSource() (*RuleDataSource, bool) { + return &rds, true +} + +// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. +func (rds RuleDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { + return &rds, true +} + +// RuleEmailAction specifies the action to send email when the rule condition is evaluated. The +// discriminator is always RuleEmailAction in this case. +type RuleEmailAction struct { + // SendToServiceOwners - Whether the administrators (service and co-administrators) of the service should be notified when the alert is activated. + SendToServiceOwners *bool `json:"sendToServiceOwners,omitempty"` + // CustomEmails - the list of administrator's custom email addresses to notify of the activation of the alert. + CustomEmails *[]string `json:"customEmails,omitempty"` + // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' + OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleEmailAction. +func (rea RuleEmailAction) MarshalJSON() ([]byte, error) { + rea.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction + objectMap := make(map[string]interface{}) + if rea.SendToServiceOwners != nil { + objectMap["sendToServiceOwners"] = rea.SendToServiceOwners + } + if rea.CustomEmails != nil { + objectMap["customEmails"] = rea.CustomEmails + } + if rea.OdataType != "" { + objectMap["odata.type"] = rea.OdataType + } + return json.Marshal(objectMap) +} + +// AsRuleEmailAction is the BasicRuleAction implementation for RuleEmailAction. +func (rea RuleEmailAction) AsRuleEmailAction() (*RuleEmailAction, bool) { + return &rea, true +} + +// AsRuleWebhookAction is the BasicRuleAction implementation for RuleEmailAction. +func (rea RuleEmailAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { + return nil, false +} + +// AsRuleAction is the BasicRuleAction implementation for RuleEmailAction. +func (rea RuleEmailAction) AsRuleAction() (*RuleAction, bool) { + return nil, false +} + +// AsBasicRuleAction is the BasicRuleAction implementation for RuleEmailAction. +func (rea RuleEmailAction) AsBasicRuleAction() (BasicRuleAction, bool) { + return &rea, true +} + +// RuleManagementEventClaimsDataSource the claims for a rule management event data source. +type RuleManagementEventClaimsDataSource struct { + // EmailAddress - the email address. + EmailAddress *string `json:"emailAddress,omitempty"` +} + +// RuleManagementEventDataSource a rule management event data source. The discriminator fields is always +// RuleManagementEventDataSource in this case. +type RuleManagementEventDataSource struct { + // EventName - the event name. + EventName *string `json:"eventName,omitempty"` + // EventSource - the event source. + EventSource *string `json:"eventSource,omitempty"` + // Level - the level. + Level *string `json:"level,omitempty"` + // OperationName - The name of the operation that should be checked for. If no name is provided, any operation will match. + OperationName *string `json:"operationName,omitempty"` + // ResourceGroupName - the resource group name. + ResourceGroupName *string `json:"resourceGroupName,omitempty"` + // ResourceProviderName - the resource provider name. + ResourceProviderName *string `json:"resourceProviderName,omitempty"` + // Status - The status of the operation that should be checked for. If no status is provided, any status will match. + Status *string `json:"status,omitempty"` + // SubStatus - the substatus. + SubStatus *string `json:"subStatus,omitempty"` + // Claims - the claims. + Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` + // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` + // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' + OdataType OdataType `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleManagementEventDataSource. +func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { + rmeds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource + objectMap := make(map[string]interface{}) + if rmeds.EventName != nil { + objectMap["eventName"] = rmeds.EventName + } + if rmeds.EventSource != nil { + objectMap["eventSource"] = rmeds.EventSource + } + if rmeds.Level != nil { + objectMap["level"] = rmeds.Level + } + if rmeds.OperationName != nil { + objectMap["operationName"] = rmeds.OperationName + } + if rmeds.ResourceGroupName != nil { + objectMap["resourceGroupName"] = rmeds.ResourceGroupName + } + if rmeds.ResourceProviderName != nil { + objectMap["resourceProviderName"] = rmeds.ResourceProviderName + } + if rmeds.Status != nil { + objectMap["status"] = rmeds.Status + } + if rmeds.SubStatus != nil { + objectMap["subStatus"] = rmeds.SubStatus + } + if rmeds.Claims != nil { + objectMap["claims"] = rmeds.Claims + } + if rmeds.ResourceURI != nil { + objectMap["resourceUri"] = rmeds.ResourceURI + } + if rmeds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rmeds.LegacyResourceID + } + if rmeds.ResourceLocation != nil { + objectMap["resourceLocation"] = rmeds.ResourceLocation + } + if rmeds.MetricNamespace != nil { + objectMap["metricNamespace"] = rmeds.MetricNamespace + } + if rmeds.OdataType != "" { + objectMap["odata.type"] = rmeds.OdataType + } + return json.Marshal(objectMap) +} + +// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. +func (rmeds RuleManagementEventDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { + return nil, false +} + +// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. +func (rmeds RuleManagementEventDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { + return &rmeds, true +} + +// AsRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. +func (rmeds RuleManagementEventDataSource) AsRuleDataSource() (*RuleDataSource, bool) { + return nil, false +} + +// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. +func (rmeds RuleManagementEventDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { + return &rmeds, true +} + +// RuleMetricDataSource a rule metric data source. The discriminator value is always RuleMetricDataSource +// in this case. +type RuleMetricDataSource struct { + // MetricName - the name of the metric that defines what the rule monitors. + MetricName *string `json:"metricName,omitempty"` + // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` + // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' + OdataType OdataType `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleMetricDataSource. +func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) { + rmds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource + objectMap := make(map[string]interface{}) + if rmds.MetricName != nil { + objectMap["metricName"] = rmds.MetricName + } + if rmds.ResourceURI != nil { + objectMap["resourceUri"] = rmds.ResourceURI + } + if rmds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rmds.LegacyResourceID + } + if rmds.ResourceLocation != nil { + objectMap["resourceLocation"] = rmds.ResourceLocation + } + if rmds.MetricNamespace != nil { + objectMap["metricNamespace"] = rmds.MetricNamespace + } + if rmds.OdataType != "" { + objectMap["odata.type"] = rmds.OdataType + } + return json.Marshal(objectMap) +} + +// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. +func (rmds RuleMetricDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { + return &rmds, true +} + +// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. +func (rmds RuleMetricDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { + return nil, false +} + +// AsRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. +func (rmds RuleMetricDataSource) AsRuleDataSource() (*RuleDataSource, bool) { + return nil, false +} + +// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. +func (rmds RuleMetricDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { + return &rmds, true +} + +// RuleWebhookAction specifies the action to post to service when the rule condition is evaluated. The +// discriminator is always RuleWebhookAction in this case. +type RuleWebhookAction struct { + // ServiceURI - the service uri to Post the notification when the alert activates or resolves. + ServiceURI *string `json:"serviceUri,omitempty"` + // Properties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. + Properties map[string]*string `json:"properties"` + // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' + OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleWebhookAction. +func (rwa RuleWebhookAction) MarshalJSON() ([]byte, error) { + rwa.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction + objectMap := make(map[string]interface{}) + if rwa.ServiceURI != nil { + objectMap["serviceUri"] = rwa.ServiceURI + } + if rwa.Properties != nil { + objectMap["properties"] = rwa.Properties + } + if rwa.OdataType != "" { + objectMap["odata.type"] = rwa.OdataType + } + return json.Marshal(objectMap) +} + +// AsRuleEmailAction is the BasicRuleAction implementation for RuleWebhookAction. +func (rwa RuleWebhookAction) AsRuleEmailAction() (*RuleEmailAction, bool) { + return nil, false +} + +// AsRuleWebhookAction is the BasicRuleAction implementation for RuleWebhookAction. +func (rwa RuleWebhookAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { + return &rwa, true +} + +// AsRuleAction is the BasicRuleAction implementation for RuleWebhookAction. +func (rwa RuleWebhookAction) AsRuleAction() (*RuleAction, bool) { + return nil, false +} + +// AsBasicRuleAction is the BasicRuleAction implementation for RuleWebhookAction. +func (rwa RuleWebhookAction) AsBasicRuleAction() (BasicRuleAction, bool) { + return &rwa, true +} + +// ThresholdRuleCondition a rule condition based on a metric crossing a threshold. +type ThresholdRuleCondition struct { + // Operator - the operator used to compare the data and the threshold. Possible values include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' + Operator ConditionOperator `json:"operator,omitempty"` + // Threshold - the threshold value that activates the alert. + Threshold *float64 `json:"threshold,omitempty"` + // WindowSize - 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. + WindowSize *string `json:"windowSize,omitempty"` + // TimeAggregation - 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' + TimeAggregation TimeAggregationOperator `json:"timeAggregation,omitempty"` + // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. + DataSource BasicRuleDataSource `json:"dataSource,omitempty"` + // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' + OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ThresholdRuleCondition. +func (trc ThresholdRuleCondition) MarshalJSON() ([]byte, error) { + trc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition + objectMap := make(map[string]interface{}) + if trc.Operator != "" { + objectMap["operator"] = trc.Operator + } + if trc.Threshold != nil { + objectMap["threshold"] = trc.Threshold + } + if trc.WindowSize != nil { + objectMap["windowSize"] = trc.WindowSize + } + if trc.TimeAggregation != "" { + objectMap["timeAggregation"] = trc.TimeAggregation + } + objectMap["dataSource"] = trc.DataSource + if trc.OdataType != "" { + objectMap["odata.type"] = trc.OdataType + } + return json.Marshal(objectMap) +} + +// AsThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. +func (trc ThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { + return &trc, true +} + +// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. +func (trc ThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { + return nil, false +} + +// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. +func (trc ThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { + return nil, false +} + +// AsRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. +func (trc ThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { + return nil, false +} + +// AsBasicRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. +func (trc ThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { + return &trc, true +} + +// UnmarshalJSON is the custom unmarshaler for ThresholdRuleCondition struct. +func (trc *ThresholdRuleCondition) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "operator": + if v != nil { + var operator ConditionOperator + err = json.Unmarshal(*v, &operator) + if err != nil { + return err + } + trc.Operator = operator + } + case "threshold": + if v != nil { + var threshold float64 + err = json.Unmarshal(*v, &threshold) + if err != nil { + return err + } + trc.Threshold = &threshold + } + case "windowSize": + if v != nil { + var windowSize string + err = json.Unmarshal(*v, &windowSize) + if err != nil { + return err + } + trc.WindowSize = &windowSize + } + case "timeAggregation": + if v != nil { + var timeAggregation TimeAggregationOperator + err = json.Unmarshal(*v, &timeAggregation) + if err != nil { + return err + } + trc.TimeAggregation = timeAggregation + } + case "dataSource": + if v != nil { + dataSource, err := unmarshalBasicRuleDataSource(*v) + if err != nil { + return err + } + trc.DataSource = dataSource + } + case "odata.type": + if v != nil { + var odataType OdataTypeBasicRuleCondition + err = json.Unmarshal(*v, &odataType) + if err != nil { + return err + } + trc.OdataType = odataType + } + } + } + + return nil +} + +// VMInsightsOnboardingStatus VM Insights onboarding status for a resource. +type VMInsightsOnboardingStatus struct { + autorest.Response `json:"-"` + // VMInsightsOnboardingStatusProperties - Resource properties. + *VMInsightsOnboardingStatusProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for VMInsightsOnboardingStatus. +func (vios VMInsightsOnboardingStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vios.VMInsightsOnboardingStatusProperties != nil { + objectMap["properties"] = vios.VMInsightsOnboardingStatusProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VMInsightsOnboardingStatus struct. +func (vios *VMInsightsOnboardingStatus) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var VMInsightsOnboardingStatusProperties VMInsightsOnboardingStatusProperties + err = json.Unmarshal(*v, &VMInsightsOnboardingStatusProperties) + if err != nil { + return err + } + vios.VMInsightsOnboardingStatusProperties = &VMInsightsOnboardingStatusProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vios.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vios.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vios.Type = &typeVar + } + } + } + + return nil +} + +// VMInsightsOnboardingStatusProperties resource properties. +type VMInsightsOnboardingStatusProperties struct { + // ResourceID - Azure Resource Manager identifier of the resource whose onboarding status is being represented. + ResourceID *string `json:"resourceId,omitempty"` + // OnboardingStatus - 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' + OnboardingStatus OnboardingStatus `json:"onboardingStatus,omitempty"` + // DataStatus - 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' + DataStatus DataStatus `json:"dataStatus,omitempty"` + // Data - Containers that currently store VM Insights data for the specified resource. + Data *[]DataContainer `json:"data,omitempty"` +} + +// WorkspaceInfo information about a Log Analytics Workspace. +type WorkspaceInfo struct { + // ID - Azure Resource Manager identifier of the Log Analytics Workspace. + ID *string `json:"id,omitempty"` + // Location - Location of the Log Analytics workspace. + Location *string `json:"location,omitempty"` + // WorkspaceInfoProperties - Resource properties. + *WorkspaceInfoProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for WorkspaceInfo. +func (wi WorkspaceInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wi.ID != nil { + objectMap["id"] = wi.ID + } + if wi.Location != nil { + objectMap["location"] = wi.Location + } + if wi.WorkspaceInfoProperties != nil { + objectMap["properties"] = wi.WorkspaceInfoProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for WorkspaceInfo struct. +func (wi *WorkspaceInfo) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + wi.ID = &ID + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + wi.Location = &location + } + case "properties": + if v != nil { + var workspaceInfoProperties WorkspaceInfoProperties + err = json.Unmarshal(*v, &workspaceInfoProperties) + if err != nil { + return err + } + wi.WorkspaceInfoProperties = &workspaceInfoProperties + } + } + } + + return nil +} + +// WorkspaceInfoProperties resource properties. +type WorkspaceInfoProperties struct { + // CustomerID - Log Analytics workspace identifier. + CustomerID *string `json:"customerId,omitempty"` +} diff --git a/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/monitorlegacyapi/interfaces.go b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/monitorlegacyapi/interfaces.go new file mode 100644 index 000000000000..05314cce0559 --- /dev/null +++ b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/monitorlegacyapi/interfaces.go @@ -0,0 +1,58 @@ +package monitorlegacyapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for 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 ( + "context" + "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy" + "github.com/Azure/go-autorest/autorest" +) + +// EventCategoriesClientAPI contains the set of methods on the EventCategoriesClient type. +type EventCategoriesClientAPI interface { + List(ctx context.Context) (result monitorlegacy.EventCategoryCollection, err error) +} + +var _ EventCategoriesClientAPI = (*monitorlegacy.EventCategoriesClient)(nil) + +// AlertRulesClientAPI contains the set of methods on the AlertRulesClient type. +type AlertRulesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters monitorlegacy.AlertRuleResource) (result monitorlegacy.AlertRuleResource, err error) + Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, ruleName string) (result monitorlegacy.AlertRuleResource, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result monitorlegacy.AlertRuleResourceCollection, err error) + ListBySubscription(ctx context.Context) (result monitorlegacy.AlertRuleResourceCollection, err error) + Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource monitorlegacy.AlertRuleResourcePatch) (result monitorlegacy.AlertRuleResource, err error) +} + +var _ AlertRulesClientAPI = (*monitorlegacy.AlertRulesClient)(nil) + +// AlertRuleIncidentsClientAPI contains the set of methods on the AlertRuleIncidentsClient type. +type AlertRuleIncidentsClientAPI interface { + Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result monitorlegacy.Incident, err error) + ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result monitorlegacy.IncidentListResult, err error) +} + +var _ AlertRuleIncidentsClientAPI = (*monitorlegacy.AlertRuleIncidentsClient)(nil) + +// LogProfilesClientAPI contains the set of methods on the LogProfilesClient type. +type LogProfilesClientAPI interface { + CreateOrUpdate(ctx context.Context, logProfileName string, parameters monitorlegacy.LogProfileResource) (result monitorlegacy.LogProfileResource, err error) + Delete(ctx context.Context, logProfileName string) (result autorest.Response, err error) + Get(ctx context.Context, logProfileName string) (result monitorlegacy.LogProfileResource, err error) + List(ctx context.Context) (result monitorlegacy.LogProfileCollection, err error) + Update(ctx context.Context, logProfileName string, logProfilesResource monitorlegacy.LogProfileResourcePatch) (result monitorlegacy.LogProfileResource, err error) +} + +var _ LogProfilesClientAPI = (*monitorlegacy.LogProfilesClient)(nil) + +// VMInsightsClientAPI contains the set of methods on the VMInsightsClient type. +type VMInsightsClientAPI interface { + GetOnboardingStatus(ctx context.Context, resourceURI string) (result monitorlegacy.VMInsightsOnboardingStatus, err error) +} + +var _ VMInsightsClientAPI = (*monitorlegacy.VMInsightsClient)(nil) diff --git a/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/version.go b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/version.go new file mode 100644 index 000000000000..96e256f563e7 --- /dev/null +++ b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/version.go @@ -0,0 +1,19 @@ +package monitorlegacy + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " monitorlegacy/2016-03-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/vminsights.go b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/vminsights.go similarity index 90% rename from services/preview/monitor/mgmt/2021-04-01-preview/insights/vminsights.go rename to services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/vminsights.go index 3787cb6fc53e..c252f9ff3867 100644 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/vminsights.go +++ b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/vminsights.go @@ -1,4 +1,4 @@ -package insights +package monitorlegacy // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -47,20 +47,20 @@ func (client VMInsightsClient) GetOnboardingStatus(ctx context.Context, resource } req, err := client.GetOnboardingStatusPreparer(ctx, resourceURI) if err != nil { - err = autorest.NewErrorWithError(err, "insights.VMInsightsClient", "GetOnboardingStatus", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "monitorlegacy.VMInsightsClient", "GetOnboardingStatus", nil, "Failure preparing request") return } resp, err := client.GetOnboardingStatusSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.VMInsightsClient", "GetOnboardingStatus", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "monitorlegacy.VMInsightsClient", "GetOnboardingStatus", resp, "Failure sending request") return } result, err = client.GetOnboardingStatusResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.VMInsightsClient", "GetOnboardingStatus", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "monitorlegacy.VMInsightsClient", "GetOnboardingStatus", resp, "Failure responding to request") return } diff --git a/services/preview/monitor/mgmt/2017-05-01-preview/insights/CHANGELOG.md b/services/preview/monitor/mgmt/2017-05-01-preview/insights/CHANGELOG.md index 52911e4cc5e4..ed91a676987d 100644 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/CHANGELOG.md +++ b/services/preview/monitor/mgmt/2017-05-01-preview/insights/CHANGELOG.md @@ -1,2 +1,72 @@ -# Change History +# Unreleased +## Breaking Changes + +### Removed Constants + +1. Sensitivity.High +1. Sensitivity.Low +1. Sensitivity.Medium + +### Removed Funcs + +1. *BaselineResponse.UnmarshalJSON([]byte) error +1. BaselineResponse.MarshalJSON() ([]byte, error) +1. MetricBaselineClient.CalculateBaseline(context.Context, string, TimeSeriesInformation) (CalculateBaselineResponse, error) +1. MetricBaselineClient.CalculateBaselinePreparer(context.Context, string, TimeSeriesInformation) (*http.Request, error) +1. MetricBaselineClient.CalculateBaselineResponder(*http.Response) (CalculateBaselineResponse, error) +1. MetricBaselineClient.CalculateBaselineSender(*http.Request) (*http.Response, error) +1. MetricBaselineClient.Get(context.Context, string, string, string, *string, string, string, ResultType) (BaselineResponse, error) +1. MetricBaselineClient.GetPreparer(context.Context, string, string, string, *string, string, string, ResultType) (*http.Request, error) +1. MetricBaselineClient.GetResponder(*http.Response) (BaselineResponse, error) +1. MetricBaselineClient.GetSender(*http.Request) (*http.Response, error) +1. NewMetricBaselineClient(string) MetricBaselineClient +1. NewMetricBaselineClientWithBaseURI(string, string) MetricBaselineClient +1. PossibleSensitivityValues() []Sensitivity + +### Struct Changes + +#### Removed Structs + +1. Baseline +1. BaselineMetadataValue +1. BaselineProperties +1. BaselineResponse +1. CalculateBaselineResponse +1. MetricBaselineClient +1. TimeSeriesInformation + +## Additive Changes + +### New Constants + +1. MetricStatisticType.MetricStatisticTypeCount +1. ScaleType.ServiceAllowedNextValue +1. Unit.UnitBitsPerSecond +1. Unit.UnitCores +1. Unit.UnitMilliCores +1. Unit.UnitNanoCores + +### Struct Changes + +#### New Struct Fields + +1. AlertRule.Action +1. AlertRule.ProvisioningState +1. AutoscaleSetting.TargetResourceLocation +1. Metric.DisplayDescription +1. Metric.ErrorCode +1. Metric.ErrorMessage +1. MetricDefinition.Category +1. MetricDefinition.DisplayDescription +1. MetricTrigger.DividePerInstance +1. MetricTrigger.MetricResourceLocation +1. RuleDataSource.LegacyResourceID +1. RuleDataSource.MetricNamespace +1. RuleDataSource.ResourceLocation +1. RuleManagementEventDataSource.LegacyResourceID +1. RuleManagementEventDataSource.MetricNamespace +1. RuleManagementEventDataSource.ResourceLocation +1. RuleMetricDataSource.LegacyResourceID +1. RuleMetricDataSource.MetricNamespace +1. RuleMetricDataSource.ResourceLocation diff --git a/services/preview/monitor/mgmt/2017-05-01-preview/insights/_meta.json b/services/preview/monitor/mgmt/2017-05-01-preview/insights/_meta.json index 9c53dafc00b1..bb234287f44a 100644 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/_meta.json +++ b/services/preview/monitor/mgmt/2017-05-01-preview/insights/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "83f6c7b9ac240d3862e909245f0a61d70ae33908", "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", "tag": "package-2017-09", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/monitor/mgmt/2017-05-01-preview/insights/actiongroups.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/actiongroups.go index 20bdb629e8c1..d2fccb5ce09e 100644 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/actiongroups.go +++ b/services/preview/monitor/mgmt/2017-05-01-preview/insights/actiongroups.go @@ -33,7 +33,7 @@ func NewActionGroupsClientWithBaseURI(baseURI string, subscriptionID string) Act // CreateOrUpdate create a new action group or update an existing one. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. // actionGroup - the action group to create or use for the update. func (client ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (result ActionGroupResource, err error) { @@ -48,12 +48,17 @@ func (client ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGro }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: actionGroup, Constraints: []validation.Constraint{{Target: "actionGroup.ActionGroup", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.MaxLength, Rule: 12, Chain: nil}}}, {Target: "actionGroup.ActionGroup.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ActionGroupsClient", "CreateOrUpdate", err.Error()) } @@ -122,7 +127,7 @@ func (client ActionGroupsClient) CreateOrUpdateResponder(resp *http.Response) (r // Delete delete an action group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. func (client ActionGroupsClient) Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -135,6 +140,15 @@ func (client ActionGroupsClient) Delete(ctx context.Context, resourceGroupName s tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, actionGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", nil, "Failure preparing request") @@ -198,7 +212,7 @@ func (client ActionGroupsClient) DeleteResponder(resp *http.Response) (result au // EnableReceiver 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. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. // enableRequest - the receiver to re-enable. func (client ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (result autorest.Response, err error) { @@ -213,8 +227,13 @@ func (client ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGro }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: enableRequest, - Constraints: []validation.Constraint{{Target: "enableRequest.ReceiverName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "enableRequest.ReceiverName", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ActionGroupsClient", "EnableReceiver", err.Error()) } @@ -282,7 +301,7 @@ func (client ActionGroupsClient) EnableReceiverResponder(resp *http.Response) (r // Get get an action group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. func (client ActionGroupsClient) Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result ActionGroupResource, err error) { if tracing.IsEnabled() { @@ -295,6 +314,15 @@ func (client ActionGroupsClient) Get(ctx context.Context, resourceGroupName stri tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, actionGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Get", nil, "Failure preparing request") @@ -358,7 +386,7 @@ func (client ActionGroupsClient) GetResponder(resp *http.Response) (result Actio // ListByResourceGroup get a list of all action groups in a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client ActionGroupsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActionGroupList, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.ListByResourceGroup") @@ -370,6 +398,15 @@ func (client ActionGroupsClient) ListByResourceGroup(ctx context.Context, resour tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -442,6 +479,12 @@ func (client ActionGroupsClient) ListBySubscriptionID(ctx context.Context) (resu tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "ListBySubscriptionID", err.Error()) + } + req, err := client.ListBySubscriptionIDPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", nil, "Failure preparing request") @@ -503,7 +546,7 @@ func (client ActionGroupsClient) ListBySubscriptionIDResponder(resp *http.Respon // Update updates an existing action group's tags. To update other fields use the CreateOrUpdate method. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. // actionGroupPatch - parameters supplied to the operation. func (client ActionGroupsClient) Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (result ActionGroupResource, err error) { @@ -517,6 +560,15 @@ func (client ActionGroupsClient) Update(ctx context.Context, resourceGroupName s tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, actionGroupName, actionGroupPatch) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Update", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2017-05-01-preview/insights/activitylogalerts.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/activitylogalerts.go index 44aaf3ef1e4a..f897b08a6f0c 100644 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/activitylogalerts.go +++ b/services/preview/monitor/mgmt/2017-05-01-preview/insights/activitylogalerts.go @@ -34,7 +34,7 @@ func NewActivityLogAlertsClientWithBaseURI(baseURI string, subscriptionID string // CreateOrUpdate create a new activity log alert or update an existing one. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // activityLogAlertName - the name of the activity log alert. // activityLogAlert - the activity log alert to create or use for the update. func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (result ActivityLogAlertResource, err error) { @@ -49,6 +49,11 @@ func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resour }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: activityLogAlert, Constraints: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Scopes", Name: validation.Null, Rule: true, Chain: nil}, @@ -124,7 +129,7 @@ func (client ActivityLogAlertsClient) CreateOrUpdateResponder(resp *http.Respons // Delete delete an activity log alert. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // activityLogAlertName - the name of the activity log alert. func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -137,6 +142,15 @@ func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupN tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, activityLogAlertName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", nil, "Failure preparing request") @@ -199,7 +213,7 @@ func (client ActivityLogAlertsClient) DeleteResponder(resp *http.Response) (resu // Get get an activity log alert. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // activityLogAlertName - the name of the activity log alert. func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result ActivityLogAlertResource, err error) { if tracing.IsEnabled() { @@ -212,6 +226,15 @@ func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, activityLogAlertName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Get", nil, "Failure preparing request") @@ -275,7 +298,7 @@ func (client ActivityLogAlertsClient) GetResponder(resp *http.Response) (result // ListByResourceGroup get a list of all activity log alerts in a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActivityLogAlertList, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.ListByResourceGroup") @@ -287,6 +310,15 @@ func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, r tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -359,6 +391,12 @@ func (client ActivityLogAlertsClient) ListBySubscriptionID(ctx context.Context) tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "ListBySubscriptionID", err.Error()) + } + req, err := client.ListBySubscriptionIDPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", nil, "Failure preparing request") @@ -420,7 +458,7 @@ func (client ActivityLogAlertsClient) ListBySubscriptionIDResponder(resp *http.R // Update updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // activityLogAlertName - the name of the activity log alert. // activityLogAlertPatch - parameters supplied to the operation. func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (result ActivityLogAlertResource, err error) { @@ -434,6 +472,15 @@ func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupN tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, activityLogAlertName, activityLogAlertPatch) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Update", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2017-05-01-preview/insights/activitylogs.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/activitylogs.go index 16dd215e6ad9..fc6927fa0e16 100644 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/activitylogs.go +++ b/services/preview/monitor/mgmt/2017-05-01-preview/insights/activitylogs.go @@ -10,6 +10,7 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" "net/http" ) @@ -60,6 +61,12 @@ func (client ActivityLogsClient) List(ctx context.Context, filter string, select tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogsClient", "List", err.Error()) + } + result.fn = client.listNextResults req, err := client.ListPreparer(ctx, filter, selectParameter) if err != nil { @@ -105,7 +112,7 @@ func (client ActivityLogsClient) ListPreparer(ctx context.Context, filter string preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/eventtypes/management/values", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/eventtypes/management/values", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2017-05-01-preview/insights/alertruleincidents.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/alertruleincidents.go index c3bf26828d8e..a7dcd9cba31e 100644 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/alertruleincidents.go +++ b/services/preview/monitor/mgmt/2017-05-01-preview/insights/alertruleincidents.go @@ -10,6 +10,7 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" "net/http" ) @@ -33,7 +34,7 @@ func NewAlertRuleIncidentsClientWithBaseURI(baseURI string, subscriptionID strin // Get gets an incident associated to an alert rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // incidentName - the name of the incident to retrieve. func (client AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result Incident, err error) { @@ -47,6 +48,15 @@ func (client AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupNam tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRuleIncidentsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName, incidentName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "Get", nil, "Failure preparing request") @@ -111,7 +121,7 @@ func (client AlertRuleIncidentsClient) GetResponder(resp *http.Response) (result // ListByAlertRule gets a list of incidents associated to an alert rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client AlertRuleIncidentsClient) ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result IncidentListResult, err error) { if tracing.IsEnabled() { @@ -124,6 +134,15 @@ func (client AlertRuleIncidentsClient) ListByAlertRule(ctx context.Context, reso tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRuleIncidentsClient", "ListByAlertRule", err.Error()) + } + req, err := client.ListByAlertRulePreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2017-05-01-preview/insights/alertrules.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/alertrules.go index f5a2ab682384..888ed122e267 100644 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/alertrules.go +++ b/services/preview/monitor/mgmt/2017-05-01-preview/insights/alertrules.go @@ -33,7 +33,7 @@ func NewAlertRulesClientWithBaseURI(baseURI string, subscriptionID string) Alert // CreateOrUpdate creates or updates a classic metric alert rule. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to create or update. func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (result AlertRuleResource, err error) { @@ -48,11 +48,16 @@ func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroup }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.AlertRule", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.AlertRule.Name", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.AlertRule.IsEnabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AlertRulesClient", "CreateOrUpdate", err.Error()) } @@ -95,7 +100,7 @@ func (client AlertRulesClient) CreateOrUpdatePreparer(ctx context.Context, resou autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -121,7 +126,7 @@ func (client AlertRulesClient) CreateOrUpdateResponder(resp *http.Response) (res // Delete deletes a classic metric alert rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -134,6 +139,15 @@ func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName str tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", nil, "Failure preparing request") @@ -172,7 +186,7 @@ func (client AlertRulesClient) DeletePreparer(ctx context.Context, resourceGroup preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -196,7 +210,7 @@ func (client AlertRulesClient) DeleteResponder(resp *http.Response) (result auto // Get gets a classic metric alert rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result AlertRuleResource, err error) { if tracing.IsEnabled() { @@ -209,6 +223,15 @@ func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Get", nil, "Failure preparing request") @@ -247,7 +270,7 @@ func (client AlertRulesClient) GetPreparer(ctx context.Context, resourceGroupNam preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -272,7 +295,7 @@ func (client AlertRulesClient) GetResponder(resp *http.Response) (result AlertRu // ListByResourceGroup list the classic metric alert rules within a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client AlertRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AlertRuleResourceCollection, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.ListByResourceGroup") @@ -284,6 +307,15 @@ func (client AlertRulesClient) ListByResourceGroup(ctx context.Context, resource tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -321,7 +353,7 @@ func (client AlertRulesClient) ListByResourceGroupPreparer(ctx context.Context, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -356,6 +388,12 @@ func (client AlertRulesClient) ListBySubscription(ctx context.Context) (result A tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "ListBySubscription", err.Error()) + } + req, err := client.ListBySubscriptionPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", nil, "Failure preparing request") @@ -392,7 +430,7 @@ func (client AlertRulesClient) ListBySubscriptionPreparer(ctx context.Context) ( preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/alertrules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -417,7 +455,7 @@ func (client AlertRulesClient) ListBySubscriptionResponder(resp *http.Response) // Update updates an existing classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // alertRulesResource - parameters supplied to the operation. func (client AlertRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (result AlertRuleResource, err error) { @@ -431,6 +469,15 @@ func (client AlertRulesClient) Update(ctx context.Context, resourceGroupName str tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, alertRulesResource) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Update", nil, "Failure preparing request") @@ -470,7 +517,7 @@ func (client AlertRulesClient) UpdatePreparer(ctx context.Context, resourceGroup autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithJSON(alertRulesResource), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2017-05-01-preview/insights/autoscalesettings.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/autoscalesettings.go index 86f253d0fb89..d9118bd2d049 100644 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/autoscalesettings.go +++ b/services/preview/monitor/mgmt/2017-05-01-preview/insights/autoscalesettings.go @@ -34,7 +34,7 @@ func NewAutoscaleSettingsClientWithBaseURI(baseURI string, subscriptionID string // CreateOrUpdate creates or updates an autoscale setting. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // autoscaleSettingName - the autoscale setting name. // parameters - parameters supplied to the operation. func (client AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (result AutoscaleSettingResource, err error) { @@ -49,11 +49,16 @@ func (client AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resour }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.AutoscaleSetting", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.MaxItems, Rule: 20, Chain: nil}}}, - }}}}}); err != nil { + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AutoscaleSettingsClient", "CreateOrUpdate", err.Error()) } @@ -96,7 +101,7 @@ func (client AutoscaleSettingsClient) CreateOrUpdatePreparer(ctx context.Context autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -122,7 +127,7 @@ func (client AutoscaleSettingsClient) CreateOrUpdateResponder(resp *http.Respons // Delete deletes and autoscale setting // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // autoscaleSettingName - the autoscale setting name. func (client AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -135,6 +140,15 @@ func (client AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupN tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, autoscaleSettingName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", nil, "Failure preparing request") @@ -173,7 +187,7 @@ func (client AutoscaleSettingsClient) DeletePreparer(ctx context.Context, resour preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -197,7 +211,7 @@ func (client AutoscaleSettingsClient) DeleteResponder(resp *http.Response) (resu // Get gets an autoscale setting // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // autoscaleSettingName - the autoscale setting name. func (client AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result AutoscaleSettingResource, err error) { if tracing.IsEnabled() { @@ -210,6 +224,15 @@ func (client AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, autoscaleSettingName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Get", nil, "Failure preparing request") @@ -248,7 +271,7 @@ func (client AutoscaleSettingsClient) GetPreparer(ctx context.Context, resourceG preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -273,7 +296,7 @@ func (client AutoscaleSettingsClient) GetResponder(resp *http.Response) (result // ListByResourceGroup lists the autoscale settings for a resource group // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client AutoscaleSettingsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.ListByResourceGroup") @@ -285,6 +308,15 @@ func (client AutoscaleSettingsClient) ListByResourceGroup(ctx context.Context, r tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "ListByResourceGroup", err.Error()) + } + result.fn = client.listByResourceGroupNextResults req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { @@ -327,7 +359,7 @@ func (client AutoscaleSettingsClient) ListByResourceGroupPreparer(ctx context.Co preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -399,6 +431,12 @@ func (client AutoscaleSettingsClient) ListBySubscription(ctx context.Context) (r tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "ListBySubscription", err.Error()) + } + result.fn = client.listBySubscriptionNextResults req, err := client.ListBySubscriptionPreparer(ctx) if err != nil { @@ -440,7 +478,7 @@ func (client AutoscaleSettingsClient) ListBySubscriptionPreparer(ctx context.Con preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/autoscalesettings", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -502,7 +540,7 @@ func (client AutoscaleSettingsClient) ListBySubscriptionComplete(ctx context.Con // Update updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // autoscaleSettingName - the autoscale setting name. // autoscaleSettingResource - parameters supplied to the operation. func (client AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (result AutoscaleSettingResource, err error) { @@ -516,6 +554,15 @@ func (client AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupN tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, autoscaleSettingName, autoscaleSettingResource) if err != nil { err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Update", nil, "Failure preparing request") @@ -555,7 +602,7 @@ func (client AutoscaleSettingsClient) UpdatePreparer(ctx context.Context, resour autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithJSON(autoscaleSettingResource), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2017-05-01-preview/insights/diagnosticsettings.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/diagnosticsettings.go index 9708c52c2499..db8aa282d0f3 100644 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/diagnosticsettings.go +++ b/services/preview/monitor/mgmt/2017-05-01-preview/insights/diagnosticsettings.go @@ -85,7 +85,7 @@ func (client DiagnosticSettingsClient) CreateOrUpdatePreparer(ctx context.Contex autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -161,7 +161,7 @@ func (client DiagnosticSettingsClient) DeletePreparer(ctx context.Context, resou preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -235,7 +235,7 @@ func (client DiagnosticSettingsClient) GetPreparer(ctx context.Context, resource preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -308,7 +308,7 @@ func (client DiagnosticSettingsClient) ListPreparer(ctx context.Context, resourc preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2017-05-01-preview/insights/diagnosticsettingscategory.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/diagnosticsettingscategory.go index 48365ed67e65..07b7295848ef 100644 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/diagnosticsettingscategory.go +++ b/services/preview/monitor/mgmt/2017-05-01-preview/insights/diagnosticsettingscategory.go @@ -83,7 +83,7 @@ func (client DiagnosticSettingsCategoryClient) GetPreparer(ctx context.Context, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -156,7 +156,7 @@ func (client DiagnosticSettingsCategoryClient) ListPreparer(ctx context.Context, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2017-05-01-preview/insights/enums.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/enums.go index 2c1f3faef4f7..53c5997dfac1 100644 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/enums.go +++ b/services/preview/monitor/mgmt/2017-05-01-preview/insights/enums.go @@ -113,6 +113,8 @@ type MetricStatisticType string const ( // MetricStatisticTypeAverage ... MetricStatisticTypeAverage MetricStatisticType = "Average" + // MetricStatisticTypeCount ... + MetricStatisticTypeCount MetricStatisticType = "Count" // MetricStatisticTypeMax ... MetricStatisticTypeMax MetricStatisticType = "Max" // MetricStatisticTypeMin ... @@ -123,7 +125,7 @@ const ( // PossibleMetricStatisticTypeValues returns an array of possible values for the MetricStatisticType const type. func PossibleMetricStatisticTypeValues() []MetricStatisticType { - return []MetricStatisticType{MetricStatisticTypeAverage, MetricStatisticTypeMax, MetricStatisticTypeMin, MetricStatisticTypeSum} + return []MetricStatisticType{MetricStatisticTypeAverage, MetricStatisticTypeCount, MetricStatisticTypeMax, MetricStatisticTypeMin, MetricStatisticTypeSum} } // OdataType enumerates the values for odata type. @@ -280,28 +282,13 @@ const ( ExactCount ScaleType = "ExactCount" // PercentChangeCount ... PercentChangeCount ScaleType = "PercentChangeCount" + // ServiceAllowedNextValue ... + ServiceAllowedNextValue ScaleType = "ServiceAllowedNextValue" ) // PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. func PossibleScaleTypeValues() []ScaleType { - return []ScaleType{ChangeCount, ExactCount, PercentChangeCount} -} - -// Sensitivity enumerates the values for sensitivity. -type Sensitivity string - -const ( - // High ... - High Sensitivity = "High" - // Low ... - Low Sensitivity = "Low" - // Medium ... - Medium Sensitivity = "Medium" -) - -// PossibleSensitivityValues returns an array of possible values for the Sensitivity const type. -func PossibleSensitivityValues() []Sensitivity { - return []Sensitivity{High, Low, Medium} + return []ScaleType{ChangeCount, ExactCount, PercentChangeCount, ServiceAllowedNextValue} } // TimeAggregationOperator enumerates the values for time aggregation operator. @@ -352,18 +339,26 @@ func PossibleTimeAggregationTypeValues() []TimeAggregationType { type Unit string const ( + // UnitBitsPerSecond ... + UnitBitsPerSecond Unit = "BitsPerSecond" // UnitBytes ... UnitBytes Unit = "Bytes" // UnitByteSeconds ... UnitByteSeconds Unit = "ByteSeconds" // UnitBytesPerSecond ... UnitBytesPerSecond Unit = "BytesPerSecond" + // UnitCores ... + UnitCores Unit = "Cores" // UnitCount ... UnitCount Unit = "Count" // UnitCountPerSecond ... UnitCountPerSecond Unit = "CountPerSecond" + // UnitMilliCores ... + UnitMilliCores Unit = "MilliCores" // UnitMilliSeconds ... UnitMilliSeconds Unit = "MilliSeconds" + // UnitNanoCores ... + UnitNanoCores Unit = "NanoCores" // UnitPercent ... UnitPercent Unit = "Percent" // UnitSeconds ... @@ -374,5 +369,5 @@ const ( // PossibleUnitValues returns an array of possible values for the Unit const type. func PossibleUnitValues() []Unit { - return []Unit{UnitBytes, UnitByteSeconds, UnitBytesPerSecond, UnitCount, UnitCountPerSecond, UnitMilliSeconds, UnitPercent, UnitSeconds, UnitUnspecified} + return []Unit{UnitBitsPerSecond, UnitBytes, UnitByteSeconds, UnitBytesPerSecond, UnitCores, UnitCount, UnitCountPerSecond, UnitMilliCores, UnitMilliSeconds, UnitNanoCores, UnitPercent, UnitSeconds, UnitUnspecified} } diff --git a/services/preview/monitor/mgmt/2017-05-01-preview/insights/eventcategories.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/eventcategories.go index 86e59b424363..f43c5468ac51 100644 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/eventcategories.go +++ b/services/preview/monitor/mgmt/2017-05-01-preview/insights/eventcategories.go @@ -75,7 +75,7 @@ func (client EventCategoriesClient) ListPreparer(ctx context.Context) (*http.Req preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventcategories"), + autorest.WithPath("/providers/Microsoft.Insights/eventcategories"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2017-05-01-preview/insights/insightsapi/interfaces.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/insightsapi/interfaces.go index 3c72f0831326..5e6f4c64cd0b 100644 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/insightsapi/interfaces.go +++ b/services/preview/monitor/mgmt/2017-05-01-preview/insights/insightsapi/interfaces.go @@ -143,11 +143,3 @@ type MetricsClientAPI interface { } var _ MetricsClientAPI = (*insights.MetricsClient)(nil) - -// MetricBaselineClientAPI contains the set of methods on the MetricBaselineClient type. -type MetricBaselineClientAPI interface { - CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation insights.TimeSeriesInformation) (result insights.CalculateBaselineResponse, err error) - Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType insights.ResultType) (result insights.BaselineResponse, err error) -} - -var _ MetricBaselineClientAPI = (*insights.MetricBaselineClient)(nil) diff --git a/services/preview/monitor/mgmt/2017-05-01-preview/insights/logprofiles.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/logprofiles.go index ad1500b87bc9..cfa5e8be2997 100644 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/logprofiles.go +++ b/services/preview/monitor/mgmt/2017-05-01-preview/insights/logprofiles.go @@ -56,7 +56,9 @@ func (client LogProfilesClient) CreateOrUpdate(ctx context.Context, logProfileNa {Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, }}, - }}}}}); err != nil { + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.LogProfilesClient", "CreateOrUpdate", err.Error()) } @@ -98,7 +100,7 @@ func (client LogProfilesClient) CreateOrUpdatePreparer(ctx context.Context, logP autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -136,6 +138,12 @@ func (client LogProfilesClient) Delete(ctx context.Context, logProfileName strin tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, logProfileName) if err != nil { err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", nil, "Failure preparing request") @@ -173,7 +181,7 @@ func (client LogProfilesClient) DeletePreparer(ctx context.Context, logProfileNa preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -209,6 +217,12 @@ func (client LogProfilesClient) Get(ctx context.Context, logProfileName string) tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, logProfileName) if err != nil { err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Get", nil, "Failure preparing request") @@ -246,7 +260,7 @@ func (client LogProfilesClient) GetPreparer(ctx context.Context, logProfileName preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -281,6 +295,12 @@ func (client LogProfilesClient) List(ctx context.Context) (result LogProfileColl tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "List", err.Error()) + } + req, err := client.ListPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "List", nil, "Failure preparing request") @@ -317,7 +337,7 @@ func (client LogProfilesClient) ListPreparer(ctx context.Context) (*http.Request preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -355,6 +375,12 @@ func (client LogProfilesClient) Update(ctx context.Context, logProfileName strin tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, logProfileName, logProfilesResource) if err != nil { err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Update", nil, "Failure preparing request") @@ -393,7 +419,7 @@ func (client LogProfilesClient) UpdatePreparer(ctx context.Context, logProfileNa autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithJSON(logProfilesResource), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2017-05-01-preview/insights/metricbaseline.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/metricbaseline.go deleted file mode 100644 index d395fc67bc59..000000000000 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/metricbaseline.go +++ /dev/null @@ -1,217 +0,0 @@ -package insights - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// MetricBaselineClient is the monitor Management Client -type MetricBaselineClient struct { - BaseClient -} - -// NewMetricBaselineClient creates an instance of the MetricBaselineClient client. -func NewMetricBaselineClient(subscriptionID string) MetricBaselineClient { - return NewMetricBaselineClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricBaselineClientWithBaseURI creates an instance of the MetricBaselineClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewMetricBaselineClientWithBaseURI(baseURI string, subscriptionID string) MetricBaselineClient { - return MetricBaselineClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CalculateBaseline **Lists the baseline values for a resource**. -// Parameters: -// resourceURI - 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 -// timeSeriesInformation - information that need to be specified to calculate a baseline on a time series. -func (client MetricBaselineClient) CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (result CalculateBaselineResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricBaselineClient.CalculateBaseline") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: timeSeriesInformation, - Constraints: []validation.Constraint{{Target: "timeSeriesInformation.Sensitivities", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "timeSeriesInformation.Values", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.MetricBaselineClient", "CalculateBaseline", err.Error()) - } - - req, err := client.CalculateBaselinePreparer(ctx, resourceURI, timeSeriesInformation) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", nil, "Failure preparing request") - return - } - - resp, err := client.CalculateBaselineSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure sending request") - return - } - - result, err = client.CalculateBaselineResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure responding to request") - return - } - - return -} - -// CalculateBaselinePreparer prepares the CalculateBaseline request. -func (client MetricBaselineClient) CalculateBaselinePreparer(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/calculatebaseline", pathParameters), - autorest.WithJSON(timeSeriesInformation), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CalculateBaselineSender sends the CalculateBaseline request. The method will close the -// http.Response Body if it receives an error. -func (client MetricBaselineClient) CalculateBaselineSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CalculateBaselineResponder handles the response to the CalculateBaseline request. The method always -// closes the http.Response Body. -func (client MetricBaselineClient) CalculateBaselineResponder(resp *http.Response) (result CalculateBaselineResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get **Gets the baseline values for a specific metric**. -// Parameters: -// resourceURI - 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 -// metricName - the name of the metric to retrieve the baseline for. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// aggregation - the aggregation type of the metric to retrieve the baseline for. -// sensitivities - the list of sensitivities (comma separated) to retrieve. -// resultType - allows retrieving only metadata of the baseline. On data request all information is retrieved. -func (client MetricBaselineClient) Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (result BaselineResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricBaselineClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceURI, metricName, timespan, interval, aggregation, sensitivities, resultType) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client MetricBaselineClient) GetPreparer(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "metricName": autorest.Encode("path", metricName), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if len(sensitivities) > 0 { - queryParameters["sensitivities"] = autorest.Encode("query", sensitivities) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/baseline/{metricName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client MetricBaselineClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client MetricBaselineClient) GetResponder(resp *http.Response) (result BaselineResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/services/preview/monitor/mgmt/2017-05-01-preview/insights/models.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/models.go index f992c8054196..04480d8c12c4 100644 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/models.go +++ b/services/preview/monitor/mgmt/2017-05-01-preview/insights/models.go @@ -447,10 +447,14 @@ type AlertRule struct { Name *string `json:"name,omitempty"` // Description - the description of the alert rule that will be included in the alert email. Description *string `json:"description,omitempty"` + // ProvisioningState - the provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` // IsEnabled - the flag that indicates whether the alert rule is enabled. IsEnabled *bool `json:"isEnabled,omitempty"` // Condition - the condition that results in the alert rule being activated. Condition BasicRuleCondition `json:"condition,omitempty"` + // Action - action that is performed when the alert rule becomes active, and when an alert condition is resolved. + Action BasicRuleAction `json:"action,omitempty"` // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. Actions *[]BasicRuleAction `json:"actions,omitempty"` // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. @@ -466,10 +470,14 @@ func (ar AlertRule) MarshalJSON() ([]byte, error) { if ar.Description != nil { objectMap["description"] = ar.Description } + if ar.ProvisioningState != nil { + objectMap["provisioningState"] = ar.ProvisioningState + } if ar.IsEnabled != nil { objectMap["isEnabled"] = ar.IsEnabled } objectMap["condition"] = ar.Condition + objectMap["action"] = ar.Action if ar.Actions != nil { objectMap["actions"] = ar.Actions } @@ -503,6 +511,15 @@ func (ar *AlertRule) UnmarshalJSON(body []byte) error { } ar.Description = &description } + case "provisioningState": + if v != nil { + var provisioningState string + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + ar.ProvisioningState = &provisioningState + } case "isEnabled": if v != nil { var isEnabled bool @@ -520,6 +537,14 @@ func (ar *AlertRule) UnmarshalJSON(body []byte) error { } ar.Condition = condition } + case "action": + if v != nil { + action, err := unmarshalBasicRuleAction(*v) + if err != nil { + return err + } + ar.Action = action + } case "actions": if v != nil { actions, err := unmarshalBasicRuleActionArray(*v) @@ -765,6 +790,8 @@ type AutoscaleSetting struct { Name *string `json:"name,omitempty"` // TargetResourceURI - the resource identifier of the resource that the autoscale setting should be added to. TargetResourceURI *string `json:"targetResourceUri,omitempty"` + // TargetResourceLocation - the location of the resource that the autoscale setting should be added to. + TargetResourceLocation *string `json:"targetResourceLocation,omitempty"` } // AutoscaleSettingResource the autoscale setting resource. @@ -1101,124 +1128,6 @@ type AzureFunctionReceiver struct { HTTPTriggerURL *string `json:"httpTriggerUrl,omitempty"` } -// Baseline the baseline values for a single sensitivity value. -type Baseline struct { - // Sensitivity - the sensitivity of the baseline. Possible values include: 'Low', 'Medium', 'High' - Sensitivity Sensitivity `json:"sensitivity,omitempty"` - // LowThresholds - The low thresholds of the baseline. - LowThresholds *[]float64 `json:"lowThresholds,omitempty"` - // HighThresholds - The high thresholds of the baseline. - HighThresholds *[]float64 `json:"highThresholds,omitempty"` -} - -// BaselineMetadataValue represents a baseline metadata value. -type BaselineMetadataValue struct { - // Name - the name of the metadata. - Name *LocalizableString `json:"name,omitempty"` - // Value - the value of the metadata. - Value *string `json:"value,omitempty"` -} - -// BaselineProperties the baseline properties class. -type BaselineProperties struct { - // 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. - Timespan *string `json:"timespan,omitempty"` - // 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. - Interval *string `json:"interval,omitempty"` - // Aggregation - The aggregation type of the metric. - Aggregation *string `json:"aggregation,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Baseline - the baseline values for each sensitivity. - Baseline *[]Baseline `json:"baseline,omitempty"` - // Metadata - the baseline metadata values. - Metadata *[]BaselineMetadataValue `json:"metadata,omitempty"` -} - -// BaselineResponse the response to a baseline query. -type BaselineResponse struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; the metric baseline Id. - ID *string `json:"id,omitempty"` - // Type - READ-ONLY; the resource type of the baseline resource. - Type *string `json:"type,omitempty"` - // Name - READ-ONLY; the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString `json:"name,omitempty"` - // BaselineProperties - the properties of the baseline. - *BaselineProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for BaselineResponse. -func (br BaselineResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if br.BaselineProperties != nil { - objectMap["properties"] = br.BaselineProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BaselineResponse struct. -func (br *BaselineResponse) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - br.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - br.Type = &typeVar - } - case "name": - if v != nil { - var name LocalizableString - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - br.Name = &name - } - case "properties": - if v != nil { - var baselineProperties BaselineProperties - err = json.Unmarshal(*v, &baselineProperties) - if err != nil { - return err - } - br.BaselineProperties = &baselineProperties - } - } - } - - return nil -} - -// CalculateBaselineResponse the response to a calculate baseline call. -type CalculateBaselineResponse struct { - autorest.Response `json:"-"` - // Type - the resource type of the baseline resource. - Type *string `json:"type,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Baseline - the baseline values for each sensitivity. - Baseline *[]Baseline `json:"baseline,omitempty"` -} - // DiagnosticSettings the diagnostic settings. type DiagnosticSettings struct { // StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs. @@ -2154,7 +2063,13 @@ type Metric struct { Type *string `json:"type,omitempty"` // Name - the name and the display name of the metric, i.e. it is localizable string. Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified' + // DisplayDescription - Detailed description of this metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + // ErrorCode - 'Success' or the error details on query failures for this metric. + ErrorCode *string `json:"errorCode,omitempty"` + // ErrorMessage - Error message encountered querying this specific metric. + ErrorMessage *string `json:"errorMessage,omitempty"` + // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' Unit Unit `json:"unit,omitempty"` // Timeseries - the time series returned when a data query is performed. Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"` @@ -2177,7 +2092,11 @@ type MetricDefinition struct { ResourceID *string `json:"resourceId,omitempty"` // Name - the name and the display name of the metric, i.e. it is a localizable string. Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified' + // DisplayDescription - Detailed description of this metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + // Category - Custom category name for this metric. + Category *string `json:"category,omitempty"` + // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' Unit Unit `json:"unit,omitempty"` // PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' PrimaryAggregationType AggregationType `json:"primaryAggregationType,omitempty"` @@ -2216,9 +2135,11 @@ type MetricTrigger struct { MetricNamespace *string `json:"metricNamespace,omitempty"` // MetricResourceURI - the resource identifier of the resource the rule monitors. MetricResourceURI *string `json:"metricResourceUri,omitempty"` + // MetricResourceLocation - the location of the resource the rule monitors. + MetricResourceLocation *string `json:"metricResourceLocation,omitempty"` // TimeGrain - 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. TimeGrain *string `json:"timeGrain,omitempty"` - // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum' + // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum', 'MetricStatisticTypeCount' Statistic MetricStatisticType `json:"statistic,omitempty"` // TimeWindow - 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. TimeWindow *string `json:"timeWindow,omitempty"` @@ -2230,6 +2151,8 @@ type MetricTrigger struct { Threshold *float64 `json:"threshold,omitempty"` // Dimensions - List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. Dimensions *[]ScaleRuleMetricDimension `json:"dimensions,omitempty"` + // DividePerInstance - a value indicating whether metric should divide per instance. + DividePerInstance *bool `json:"dividePerInstance,omitempty"` } // MetricValue represents a metric value. @@ -2342,7 +2265,7 @@ func (r Resource) MarshalJSON() ([]byte, error) { // Response the response to a metrics query. type Response struct { autorest.Response `json:"-"` - // Cost - The integer value representing the cost of the query, for data case. + // Cost - The integer value representing the relative cost of the query. Cost *float64 `json:"cost,omitempty"` // 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. Timespan *string `json:"timespan,omitempty"` @@ -2586,6 +2509,12 @@ type BasicRuleDataSource interface { type RuleDataSource struct { // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' OdataType OdataType `json:"odata.type,omitempty"` } @@ -2638,6 +2567,15 @@ func (rds RuleDataSource) MarshalJSON() ([]byte, error) { if rds.ResourceURI != nil { objectMap["resourceUri"] = rds.ResourceURI } + if rds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rds.LegacyResourceID + } + if rds.ResourceLocation != nil { + objectMap["resourceLocation"] = rds.ResourceLocation + } + if rds.MetricNamespace != nil { + objectMap["metricNamespace"] = rds.MetricNamespace + } if rds.OdataType != "" { objectMap["odata.type"] = rds.OdataType } @@ -2740,6 +2678,12 @@ type RuleManagementEventDataSource struct { Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' OdataType OdataType `json:"odata.type,omitempty"` } @@ -2778,6 +2722,15 @@ func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { if rmeds.ResourceURI != nil { objectMap["resourceUri"] = rmeds.ResourceURI } + if rmeds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rmeds.LegacyResourceID + } + if rmeds.ResourceLocation != nil { + objectMap["resourceLocation"] = rmeds.ResourceLocation + } + if rmeds.MetricNamespace != nil { + objectMap["metricNamespace"] = rmeds.MetricNamespace + } if rmeds.OdataType != "" { objectMap["odata.type"] = rmeds.OdataType } @@ -2811,6 +2764,12 @@ type RuleMetricDataSource struct { MetricName *string `json:"metricName,omitempty"` // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' OdataType OdataType `json:"odata.type,omitempty"` } @@ -2825,6 +2784,15 @@ func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) { if rmds.ResourceURI != nil { objectMap["resourceUri"] = rmds.ResourceURI } + if rmds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rmds.LegacyResourceID + } + if rmds.ResourceLocation != nil { + objectMap["resourceLocation"] = rmds.ResourceLocation + } + if rmds.MetricNamespace != nil { + objectMap["metricNamespace"] = rmds.MetricNamespace + } if rmds.OdataType != "" { objectMap["odata.type"] = rmds.OdataType } @@ -2902,7 +2870,7 @@ func (rwa RuleWebhookAction) AsBasicRuleAction() (BasicRuleAction, bool) { type ScaleAction struct { // Direction - the scale direction. Whether the scaling action increases or decreases the number of instances. Possible values include: 'ScaleDirectionNone', 'ScaleDirectionIncrease', 'ScaleDirectionDecrease' Direction ScaleDirection `json:"direction,omitempty"` - // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount' + // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount', 'ServiceAllowedNextValue' Type ScaleType `json:"type,omitempty"` // Value - the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1. Value *string `json:"value,omitempty"` @@ -3117,16 +3085,6 @@ type TimeSeriesElement struct { Data *[]MetricValue `json:"data,omitempty"` } -// TimeSeriesInformation the time series info needed for calculating the baseline. -type TimeSeriesInformation struct { - // Sensitivities - the list of sensitivities for calculating the baseline. - Sensitivities *[]string `json:"sensitivities,omitempty"` - // Values - The metric values to calculate the baseline. - Values *[]float64 `json:"values,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` -} - // TimeWindow a specific date-time for the profile. type TimeWindow struct { // TimeZone - 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 diff --git a/services/preview/monitor/mgmt/2017-05-01-preview/insights/operations.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/operations.go index 3f82351c7f23..afb74dc9248f 100644 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/operations.go +++ b/services/preview/monitor/mgmt/2017-05-01-preview/insights/operations.go @@ -74,7 +74,7 @@ func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/operations"), + autorest.WithPath("/providers/Microsoft.Insights/operations"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2017-05-01-preview/insights/tenantactivitylogs.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/tenantactivitylogs.go index 7501f047bb38..7c6ee7981381 100644 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/tenantactivitylogs.go +++ b/services/preview/monitor/mgmt/2017-05-01-preview/insights/tenantactivitylogs.go @@ -107,7 +107,7 @@ func (client TenantActivityLogsClient) ListPreparer(ctx context.Context, filter preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventtypes/management/values"), + autorest.WithPath("/providers/Microsoft.Insights/eventtypes/management/values"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/CHANGELOG.md b/services/preview/monitor/mgmt/2018-03-01/insights/CHANGELOG.md index 52911e4cc5e4..6b157cd0d578 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/CHANGELOG.md +++ b/services/preview/monitor/mgmt/2018-03-01/insights/CHANGELOG.md @@ -1,2 +1,158 @@ -# Change History +# Unreleased +## Breaking Changes + +### Removed Constants + +1. Operator.OperatorNotEquals +1. Sensitivity.SensitivityHigh +1. Sensitivity.SensitivityLow +1. Sensitivity.SensitivityMedium +1. Unit.UnitBitsPerSecond +1. Unit.UnitByteSeconds +1. Unit.UnitBytes +1. Unit.UnitBytesPerSecond +1. Unit.UnitCores +1. Unit.UnitCount +1. Unit.UnitCountPerSecond +1. Unit.UnitMilliCores +1. Unit.UnitMilliSeconds +1. Unit.UnitNanoCores +1. Unit.UnitPercent +1. Unit.UnitSeconds +1. Unit.UnitUnspecified + +### Removed Funcs + +1. *BaselineResponse.UnmarshalJSON([]byte) error +1. BaselineResponse.MarshalJSON() ([]byte, error) +1. MetricBaselineClient.CalculateBaseline(context.Context, string, TimeSeriesInformation) (CalculateBaselineResponse, error) +1. MetricBaselineClient.CalculateBaselinePreparer(context.Context, string, TimeSeriesInformation) (*http.Request, error) +1. MetricBaselineClient.CalculateBaselineResponder(*http.Response) (CalculateBaselineResponse, error) +1. MetricBaselineClient.CalculateBaselineSender(*http.Request) (*http.Response, error) +1. MetricBaselineClient.Get(context.Context, string, string, string, *string, string, string, ResultType) (BaselineResponse, error) +1. MetricBaselineClient.GetPreparer(context.Context, string, string, string, *string, string, string, ResultType) (*http.Request, error) +1. MetricBaselineClient.GetResponder(*http.Response) (BaselineResponse, error) +1. MetricBaselineClient.GetSender(*http.Request) (*http.Response, error) +1. NewMetricBaselineClient(string) MetricBaselineClient +1. NewMetricBaselineClientWithBaseURI(string, string) MetricBaselineClient +1. PossibleSensitivityValues() []Sensitivity +1. PossibleUnitValues() []Unit + +### Struct Changes + +#### Removed Structs + +1. Baseline +1. BaselineMetadataValue +1. BaselineProperties +1. BaselineResponse +1. CalculateBaselineResponse +1. MetricBaselineClient +1. TimeSeriesInformation + +#### Removed Struct Fields + +1. MetricAlertResourcePatch.*MetricAlertProperties + +### Signature Changes + +#### Struct Fields + +1. DynamicMetricCriteria.TimeAggregation changed type from interface{} to AggregationTypeEnum +1. Metric.Unit changed type from Unit to MetricUnit +1. MetricCriteria.TimeAggregation changed type from interface{} to AggregationTypeEnum +1. MetricDefinition.Unit changed type from Unit to MetricUnit +1. MultiMetricCriteria.TimeAggregation changed type from interface{} to AggregationTypeEnum + +## Additive Changes + +### New Constants + +1. AggregationTypeEnum.AggregationTypeEnumAverage +1. AggregationTypeEnum.AggregationTypeEnumCount +1. AggregationTypeEnum.AggregationTypeEnumMaximum +1. AggregationTypeEnum.AggregationTypeEnumMinimum +1. AggregationTypeEnum.AggregationTypeEnumTotal +1. ConditionalOperator.ConditionalOperatorGreaterThanOrEqual +1. ConditionalOperator.ConditionalOperatorLessThanOrEqual +1. MetricClass.Availability +1. MetricClass.Errors +1. MetricClass.Latency +1. MetricClass.Saturation +1. MetricClass.Transactions +1. MetricStatisticType.MetricStatisticTypeCount +1. MetricUnit.MetricUnitBitsPerSecond +1. MetricUnit.MetricUnitByteSeconds +1. MetricUnit.MetricUnitBytes +1. MetricUnit.MetricUnitBytesPerSecond +1. MetricUnit.MetricUnitCores +1. MetricUnit.MetricUnitCount +1. MetricUnit.MetricUnitCountPerSecond +1. MetricUnit.MetricUnitMilliCores +1. MetricUnit.MetricUnitMilliSeconds +1. MetricUnit.MetricUnitNanoCores +1. MetricUnit.MetricUnitPercent +1. MetricUnit.MetricUnitSeconds +1. MetricUnit.MetricUnitUnspecified +1. ScaleType.ServiceAllowedNextValue + +### New Funcs + +1. *MetricAlertPropertiesPatch.UnmarshalJSON([]byte) error +1. MetricAlertPropertiesPatch.MarshalJSON() ([]byte, error) +1. PossibleAggregationTypeEnumValues() []AggregationTypeEnum +1. PossibleMetricClassValues() []MetricClass +1. PossibleMetricUnitValues() []MetricUnit + +### Struct Changes + +#### New Structs + +1. ErrorContract +1. MetricAlertPropertiesPatch + +#### New Struct Fields + +1. ActionGroupResource.Etag +1. ActionGroupResource.Kind +1. ActivityLogAlertResource.Etag +1. ActivityLogAlertResource.Kind +1. AlertRule.Action +1. AlertRule.ProvisioningState +1. AlertRuleResource.Etag +1. AlertRuleResource.Kind +1. AutoscaleSetting.TargetResourceLocation +1. AutoscaleSettingResource.Etag +1. AutoscaleSettingResource.Kind +1. LogProfileResource.Etag +1. LogProfileResource.Kind +1. LogSearchRule.AutoMitigate +1. LogSearchRule.CreatedWithAPIVersion +1. LogSearchRule.DisplayName +1. LogSearchRule.IsLegacyLogAnalyticsRule +1. LogSearchRuleResource.Etag +1. LogSearchRuleResource.Kind +1. Metric.DisplayDescription +1. Metric.ErrorCode +1. Metric.ErrorMessage +1. MetricAlertProperties.IsMigrated +1. MetricAlertResource.Etag +1. MetricAlertResource.Kind +1. MetricAlertResourcePatch.*MetricAlertPropertiesPatch +1. MetricDefinition.Category +1. MetricDefinition.DisplayDescription +1. MetricDefinition.MetricClass +1. MetricTrigger.DividePerInstance +1. MetricTrigger.MetricResourceLocation +1. Resource.Etag +1. Resource.Kind +1. RuleDataSource.LegacyResourceID +1. RuleDataSource.MetricNamespace +1. RuleDataSource.ResourceLocation +1. RuleManagementEventDataSource.LegacyResourceID +1. RuleManagementEventDataSource.MetricNamespace +1. RuleManagementEventDataSource.ResourceLocation +1. RuleMetricDataSource.LegacyResourceID +1. RuleMetricDataSource.MetricNamespace +1. RuleMetricDataSource.ResourceLocation diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/_meta.json b/services/preview/monitor/mgmt/2018-03-01/insights/_meta.json index b55c341f8840..633f28221323 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/_meta.json +++ b/services/preview/monitor/mgmt/2018-03-01/insights/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "83f6c7b9ac240d3862e909245f0a61d70ae33908", "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", "tag": "package-2018-03", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/actiongroups.go b/services/preview/monitor/mgmt/2018-03-01/insights/actiongroups.go index 43753cb5b294..b63e41582c58 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/actiongroups.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/actiongroups.go @@ -33,7 +33,7 @@ func NewActionGroupsClientWithBaseURI(baseURI string, subscriptionID string) Act // CreateOrUpdate create a new action group or update an existing one. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. // actionGroup - the action group to create or use for the update. func (client ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (result ActionGroupResource, err error) { @@ -48,12 +48,17 @@ func (client ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGro }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: actionGroup, Constraints: []validation.Constraint{{Target: "actionGroup.ActionGroup", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.MaxLength, Rule: 12, Chain: nil}}}, {Target: "actionGroup.ActionGroup.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ActionGroupsClient", "CreateOrUpdate", err.Error()) } @@ -122,7 +127,7 @@ func (client ActionGroupsClient) CreateOrUpdateResponder(resp *http.Response) (r // Delete delete an action group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. func (client ActionGroupsClient) Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -135,6 +140,15 @@ func (client ActionGroupsClient) Delete(ctx context.Context, resourceGroupName s tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, actionGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", nil, "Failure preparing request") @@ -198,7 +212,7 @@ func (client ActionGroupsClient) DeleteResponder(resp *http.Response) (result au // EnableReceiver 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. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. // enableRequest - the receiver to re-enable. func (client ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (result autorest.Response, err error) { @@ -213,8 +227,13 @@ func (client ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGro }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: enableRequest, - Constraints: []validation.Constraint{{Target: "enableRequest.ReceiverName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "enableRequest.ReceiverName", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ActionGroupsClient", "EnableReceiver", err.Error()) } @@ -282,7 +301,7 @@ func (client ActionGroupsClient) EnableReceiverResponder(resp *http.Response) (r // Get get an action group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. func (client ActionGroupsClient) Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result ActionGroupResource, err error) { if tracing.IsEnabled() { @@ -295,6 +314,15 @@ func (client ActionGroupsClient) Get(ctx context.Context, resourceGroupName stri tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, actionGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Get", nil, "Failure preparing request") @@ -358,7 +386,7 @@ func (client ActionGroupsClient) GetResponder(resp *http.Response) (result Actio // ListByResourceGroup get a list of all action groups in a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client ActionGroupsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActionGroupList, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.ListByResourceGroup") @@ -370,6 +398,15 @@ func (client ActionGroupsClient) ListByResourceGroup(ctx context.Context, resour tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -442,6 +479,12 @@ func (client ActionGroupsClient) ListBySubscriptionID(ctx context.Context) (resu tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "ListBySubscriptionID", err.Error()) + } + req, err := client.ListBySubscriptionIDPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", nil, "Failure preparing request") @@ -503,7 +546,7 @@ func (client ActionGroupsClient) ListBySubscriptionIDResponder(resp *http.Respon // Update updates an existing action group's tags. To update other fields use the CreateOrUpdate method. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. // actionGroupPatch - parameters supplied to the operation. func (client ActionGroupsClient) Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (result ActionGroupResource, err error) { @@ -517,6 +560,15 @@ func (client ActionGroupsClient) Update(ctx context.Context, resourceGroupName s tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, actionGroupName, actionGroupPatch) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Update", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/activitylogalerts.go b/services/preview/monitor/mgmt/2018-03-01/insights/activitylogalerts.go index 44aaf3ef1e4a..f897b08a6f0c 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/activitylogalerts.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/activitylogalerts.go @@ -34,7 +34,7 @@ func NewActivityLogAlertsClientWithBaseURI(baseURI string, subscriptionID string // CreateOrUpdate create a new activity log alert or update an existing one. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // activityLogAlertName - the name of the activity log alert. // activityLogAlert - the activity log alert to create or use for the update. func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (result ActivityLogAlertResource, err error) { @@ -49,6 +49,11 @@ func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resour }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: activityLogAlert, Constraints: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Scopes", Name: validation.Null, Rule: true, Chain: nil}, @@ -124,7 +129,7 @@ func (client ActivityLogAlertsClient) CreateOrUpdateResponder(resp *http.Respons // Delete delete an activity log alert. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // activityLogAlertName - the name of the activity log alert. func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -137,6 +142,15 @@ func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupN tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, activityLogAlertName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", nil, "Failure preparing request") @@ -199,7 +213,7 @@ func (client ActivityLogAlertsClient) DeleteResponder(resp *http.Response) (resu // Get get an activity log alert. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // activityLogAlertName - the name of the activity log alert. func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result ActivityLogAlertResource, err error) { if tracing.IsEnabled() { @@ -212,6 +226,15 @@ func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, activityLogAlertName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Get", nil, "Failure preparing request") @@ -275,7 +298,7 @@ func (client ActivityLogAlertsClient) GetResponder(resp *http.Response) (result // ListByResourceGroup get a list of all activity log alerts in a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActivityLogAlertList, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.ListByResourceGroup") @@ -287,6 +310,15 @@ func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, r tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -359,6 +391,12 @@ func (client ActivityLogAlertsClient) ListBySubscriptionID(ctx context.Context) tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "ListBySubscriptionID", err.Error()) + } + req, err := client.ListBySubscriptionIDPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", nil, "Failure preparing request") @@ -420,7 +458,7 @@ func (client ActivityLogAlertsClient) ListBySubscriptionIDResponder(resp *http.R // Update updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // activityLogAlertName - the name of the activity log alert. // activityLogAlertPatch - parameters supplied to the operation. func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (result ActivityLogAlertResource, err error) { @@ -434,6 +472,15 @@ func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupN tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, activityLogAlertName, activityLogAlertPatch) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Update", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/activitylogs.go b/services/preview/monitor/mgmt/2018-03-01/insights/activitylogs.go index 16dd215e6ad9..fc6927fa0e16 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/activitylogs.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/activitylogs.go @@ -10,6 +10,7 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" "net/http" ) @@ -60,6 +61,12 @@ func (client ActivityLogsClient) List(ctx context.Context, filter string, select tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogsClient", "List", err.Error()) + } + result.fn = client.listNextResults req, err := client.ListPreparer(ctx, filter, selectParameter) if err != nil { @@ -105,7 +112,7 @@ func (client ActivityLogsClient) ListPreparer(ctx context.Context, filter string preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/eventtypes/management/values", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/eventtypes/management/values", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/alertruleincidents.go b/services/preview/monitor/mgmt/2018-03-01/insights/alertruleincidents.go index c3bf26828d8e..a7dcd9cba31e 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/alertruleincidents.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/alertruleincidents.go @@ -10,6 +10,7 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" "net/http" ) @@ -33,7 +34,7 @@ func NewAlertRuleIncidentsClientWithBaseURI(baseURI string, subscriptionID strin // Get gets an incident associated to an alert rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // incidentName - the name of the incident to retrieve. func (client AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result Incident, err error) { @@ -47,6 +48,15 @@ func (client AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupNam tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRuleIncidentsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName, incidentName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "Get", nil, "Failure preparing request") @@ -111,7 +121,7 @@ func (client AlertRuleIncidentsClient) GetResponder(resp *http.Response) (result // ListByAlertRule gets a list of incidents associated to an alert rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client AlertRuleIncidentsClient) ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result IncidentListResult, err error) { if tracing.IsEnabled() { @@ -124,6 +134,15 @@ func (client AlertRuleIncidentsClient) ListByAlertRule(ctx context.Context, reso tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRuleIncidentsClient", "ListByAlertRule", err.Error()) + } + req, err := client.ListByAlertRulePreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/alertrules.go b/services/preview/monitor/mgmt/2018-03-01/insights/alertrules.go index f5a2ab682384..888ed122e267 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/alertrules.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/alertrules.go @@ -33,7 +33,7 @@ func NewAlertRulesClientWithBaseURI(baseURI string, subscriptionID string) Alert // CreateOrUpdate creates or updates a classic metric alert rule. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to create or update. func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (result AlertRuleResource, err error) { @@ -48,11 +48,16 @@ func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroup }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.AlertRule", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.AlertRule.Name", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.AlertRule.IsEnabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AlertRulesClient", "CreateOrUpdate", err.Error()) } @@ -95,7 +100,7 @@ func (client AlertRulesClient) CreateOrUpdatePreparer(ctx context.Context, resou autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -121,7 +126,7 @@ func (client AlertRulesClient) CreateOrUpdateResponder(resp *http.Response) (res // Delete deletes a classic metric alert rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -134,6 +139,15 @@ func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName str tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", nil, "Failure preparing request") @@ -172,7 +186,7 @@ func (client AlertRulesClient) DeletePreparer(ctx context.Context, resourceGroup preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -196,7 +210,7 @@ func (client AlertRulesClient) DeleteResponder(resp *http.Response) (result auto // Get gets a classic metric alert rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result AlertRuleResource, err error) { if tracing.IsEnabled() { @@ -209,6 +223,15 @@ func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Get", nil, "Failure preparing request") @@ -247,7 +270,7 @@ func (client AlertRulesClient) GetPreparer(ctx context.Context, resourceGroupNam preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -272,7 +295,7 @@ func (client AlertRulesClient) GetResponder(resp *http.Response) (result AlertRu // ListByResourceGroup list the classic metric alert rules within a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client AlertRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AlertRuleResourceCollection, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.ListByResourceGroup") @@ -284,6 +307,15 @@ func (client AlertRulesClient) ListByResourceGroup(ctx context.Context, resource tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -321,7 +353,7 @@ func (client AlertRulesClient) ListByResourceGroupPreparer(ctx context.Context, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -356,6 +388,12 @@ func (client AlertRulesClient) ListBySubscription(ctx context.Context) (result A tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "ListBySubscription", err.Error()) + } + req, err := client.ListBySubscriptionPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", nil, "Failure preparing request") @@ -392,7 +430,7 @@ func (client AlertRulesClient) ListBySubscriptionPreparer(ctx context.Context) ( preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/alertrules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -417,7 +455,7 @@ func (client AlertRulesClient) ListBySubscriptionResponder(resp *http.Response) // Update updates an existing classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // alertRulesResource - parameters supplied to the operation. func (client AlertRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (result AlertRuleResource, err error) { @@ -431,6 +469,15 @@ func (client AlertRulesClient) Update(ctx context.Context, resourceGroupName str tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, alertRulesResource) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Update", nil, "Failure preparing request") @@ -470,7 +517,7 @@ func (client AlertRulesClient) UpdatePreparer(ctx context.Context, resourceGroup autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithJSON(alertRulesResource), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/autoscalesettings.go b/services/preview/monitor/mgmt/2018-03-01/insights/autoscalesettings.go index 86f253d0fb89..d9118bd2d049 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/autoscalesettings.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/autoscalesettings.go @@ -34,7 +34,7 @@ func NewAutoscaleSettingsClientWithBaseURI(baseURI string, subscriptionID string // CreateOrUpdate creates or updates an autoscale setting. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // autoscaleSettingName - the autoscale setting name. // parameters - parameters supplied to the operation. func (client AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (result AutoscaleSettingResource, err error) { @@ -49,11 +49,16 @@ func (client AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resour }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.AutoscaleSetting", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.MaxItems, Rule: 20, Chain: nil}}}, - }}}}}); err != nil { + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AutoscaleSettingsClient", "CreateOrUpdate", err.Error()) } @@ -96,7 +101,7 @@ func (client AutoscaleSettingsClient) CreateOrUpdatePreparer(ctx context.Context autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -122,7 +127,7 @@ func (client AutoscaleSettingsClient) CreateOrUpdateResponder(resp *http.Respons // Delete deletes and autoscale setting // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // autoscaleSettingName - the autoscale setting name. func (client AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -135,6 +140,15 @@ func (client AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupN tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, autoscaleSettingName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", nil, "Failure preparing request") @@ -173,7 +187,7 @@ func (client AutoscaleSettingsClient) DeletePreparer(ctx context.Context, resour preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -197,7 +211,7 @@ func (client AutoscaleSettingsClient) DeleteResponder(resp *http.Response) (resu // Get gets an autoscale setting // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // autoscaleSettingName - the autoscale setting name. func (client AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result AutoscaleSettingResource, err error) { if tracing.IsEnabled() { @@ -210,6 +224,15 @@ func (client AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, autoscaleSettingName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Get", nil, "Failure preparing request") @@ -248,7 +271,7 @@ func (client AutoscaleSettingsClient) GetPreparer(ctx context.Context, resourceG preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -273,7 +296,7 @@ func (client AutoscaleSettingsClient) GetResponder(resp *http.Response) (result // ListByResourceGroup lists the autoscale settings for a resource group // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client AutoscaleSettingsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.ListByResourceGroup") @@ -285,6 +308,15 @@ func (client AutoscaleSettingsClient) ListByResourceGroup(ctx context.Context, r tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "ListByResourceGroup", err.Error()) + } + result.fn = client.listByResourceGroupNextResults req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { @@ -327,7 +359,7 @@ func (client AutoscaleSettingsClient) ListByResourceGroupPreparer(ctx context.Co preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -399,6 +431,12 @@ func (client AutoscaleSettingsClient) ListBySubscription(ctx context.Context) (r tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "ListBySubscription", err.Error()) + } + result.fn = client.listBySubscriptionNextResults req, err := client.ListBySubscriptionPreparer(ctx) if err != nil { @@ -440,7 +478,7 @@ func (client AutoscaleSettingsClient) ListBySubscriptionPreparer(ctx context.Con preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/autoscalesettings", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -502,7 +540,7 @@ func (client AutoscaleSettingsClient) ListBySubscriptionComplete(ctx context.Con // Update updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // autoscaleSettingName - the autoscale setting name. // autoscaleSettingResource - parameters supplied to the operation. func (client AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (result AutoscaleSettingResource, err error) { @@ -516,6 +554,15 @@ func (client AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupN tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, autoscaleSettingName, autoscaleSettingResource) if err != nil { err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Update", nil, "Failure preparing request") @@ -555,7 +602,7 @@ func (client AutoscaleSettingsClient) UpdatePreparer(ctx context.Context, resour autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithJSON(autoscaleSettingResource), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/diagnosticsettings.go b/services/preview/monitor/mgmt/2018-03-01/insights/diagnosticsettings.go index 9708c52c2499..db8aa282d0f3 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/diagnosticsettings.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/diagnosticsettings.go @@ -85,7 +85,7 @@ func (client DiagnosticSettingsClient) CreateOrUpdatePreparer(ctx context.Contex autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -161,7 +161,7 @@ func (client DiagnosticSettingsClient) DeletePreparer(ctx context.Context, resou preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -235,7 +235,7 @@ func (client DiagnosticSettingsClient) GetPreparer(ctx context.Context, resource preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -308,7 +308,7 @@ func (client DiagnosticSettingsClient) ListPreparer(ctx context.Context, resourc preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/diagnosticsettingscategory.go b/services/preview/monitor/mgmt/2018-03-01/insights/diagnosticsettingscategory.go index 48365ed67e65..07b7295848ef 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/diagnosticsettingscategory.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/diagnosticsettingscategory.go @@ -83,7 +83,7 @@ func (client DiagnosticSettingsCategoryClient) GetPreparer(ctx context.Context, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -156,7 +156,7 @@ func (client DiagnosticSettingsCategoryClient) ListPreparer(ctx context.Context, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/enums.go b/services/preview/monitor/mgmt/2018-03-01/insights/enums.go index 1bab3243cf63..7d182889b1e1 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/enums.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/enums.go @@ -29,6 +29,27 @@ func PossibleAggregationTypeValues() []AggregationType { return []AggregationType{Average, Count, Maximum, Minimum, None, Total} } +// AggregationTypeEnum enumerates the values for aggregation type enum. +type AggregationTypeEnum string + +const ( + // AggregationTypeEnumAverage ... + AggregationTypeEnumAverage AggregationTypeEnum = "Average" + // AggregationTypeEnumCount ... + AggregationTypeEnumCount AggregationTypeEnum = "Count" + // AggregationTypeEnumMaximum ... + AggregationTypeEnumMaximum AggregationTypeEnum = "Maximum" + // AggregationTypeEnumMinimum ... + AggregationTypeEnumMinimum AggregationTypeEnum = "Minimum" + // AggregationTypeEnumTotal ... + AggregationTypeEnumTotal AggregationTypeEnum = "Total" +) + +// PossibleAggregationTypeEnumValues returns an array of possible values for the AggregationTypeEnum const type. +func PossibleAggregationTypeEnumValues() []AggregationTypeEnum { + return []AggregationTypeEnum{AggregationTypeEnumAverage, AggregationTypeEnumCount, AggregationTypeEnumMaximum, AggregationTypeEnumMinimum, AggregationTypeEnumTotal} +} + // AlertSeverity enumerates the values for alert severity. type AlertSeverity string @@ -96,13 +117,17 @@ const ( ConditionalOperatorEqual ConditionalOperator = "Equal" // ConditionalOperatorGreaterThan ... ConditionalOperatorGreaterThan ConditionalOperator = "GreaterThan" + // ConditionalOperatorGreaterThanOrEqual ... + ConditionalOperatorGreaterThanOrEqual ConditionalOperator = "GreaterThanOrEqual" // ConditionalOperatorLessThan ... ConditionalOperatorLessThan ConditionalOperator = "LessThan" + // ConditionalOperatorLessThanOrEqual ... + ConditionalOperatorLessThanOrEqual ConditionalOperator = "LessThanOrEqual" ) // PossibleConditionalOperatorValues returns an array of possible values for the ConditionalOperator const type. func PossibleConditionalOperatorValues() []ConditionalOperator { - return []ConditionalOperator{ConditionalOperatorEqual, ConditionalOperatorGreaterThan, ConditionalOperatorLessThan} + return []ConditionalOperator{ConditionalOperatorEqual, ConditionalOperatorGreaterThan, ConditionalOperatorGreaterThanOrEqual, ConditionalOperatorLessThan, ConditionalOperatorLessThanOrEqual} } // ConditionOperator enumerates the values for condition operator. @@ -211,12 +236,35 @@ func PossibleEventLevelValues() []EventLevel { return []EventLevel{Critical, Error, Informational, Verbose, Warning} } +// MetricClass enumerates the values for metric class. +type MetricClass string + +const ( + // Availability ... + Availability MetricClass = "Availability" + // Errors ... + Errors MetricClass = "Errors" + // Latency ... + Latency MetricClass = "Latency" + // Saturation ... + Saturation MetricClass = "Saturation" + // Transactions ... + Transactions MetricClass = "Transactions" +) + +// PossibleMetricClassValues returns an array of possible values for the MetricClass const type. +func PossibleMetricClassValues() []MetricClass { + return []MetricClass{Availability, Errors, Latency, Saturation, Transactions} +} + // MetricStatisticType enumerates the values for metric statistic type. type MetricStatisticType string const ( // MetricStatisticTypeAverage ... MetricStatisticTypeAverage MetricStatisticType = "Average" + // MetricStatisticTypeCount ... + MetricStatisticTypeCount MetricStatisticType = "Count" // MetricStatisticTypeMax ... MetricStatisticTypeMax MetricStatisticType = "Max" // MetricStatisticTypeMin ... @@ -227,7 +275,7 @@ const ( // PossibleMetricStatisticTypeValues returns an array of possible values for the MetricStatisticType const type. func PossibleMetricStatisticTypeValues() []MetricStatisticType { - return []MetricStatisticType{MetricStatisticTypeAverage, MetricStatisticTypeMax, MetricStatisticTypeMin, MetricStatisticTypeSum} + return []MetricStatisticType{MetricStatisticTypeAverage, MetricStatisticTypeCount, MetricStatisticTypeMax, MetricStatisticTypeMin, MetricStatisticTypeSum} } // MetricTriggerType enumerates the values for metric trigger type. @@ -245,6 +293,43 @@ func PossibleMetricTriggerTypeValues() []MetricTriggerType { return []MetricTriggerType{MetricTriggerTypeConsecutive, MetricTriggerTypeTotal} } +// MetricUnit enumerates the values for metric unit. +type MetricUnit string + +const ( + // MetricUnitBitsPerSecond ... + MetricUnitBitsPerSecond MetricUnit = "BitsPerSecond" + // MetricUnitBytes ... + MetricUnitBytes MetricUnit = "Bytes" + // MetricUnitByteSeconds ... + MetricUnitByteSeconds MetricUnit = "ByteSeconds" + // MetricUnitBytesPerSecond ... + MetricUnitBytesPerSecond MetricUnit = "BytesPerSecond" + // MetricUnitCores ... + MetricUnitCores MetricUnit = "Cores" + // MetricUnitCount ... + MetricUnitCount MetricUnit = "Count" + // MetricUnitCountPerSecond ... + MetricUnitCountPerSecond MetricUnit = "CountPerSecond" + // MetricUnitMilliCores ... + MetricUnitMilliCores MetricUnit = "MilliCores" + // MetricUnitMilliSeconds ... + MetricUnitMilliSeconds MetricUnit = "MilliSeconds" + // MetricUnitNanoCores ... + MetricUnitNanoCores MetricUnit = "NanoCores" + // MetricUnitPercent ... + MetricUnitPercent MetricUnit = "Percent" + // MetricUnitSeconds ... + MetricUnitSeconds MetricUnit = "Seconds" + // MetricUnitUnspecified ... + MetricUnitUnspecified MetricUnit = "Unspecified" +) + +// PossibleMetricUnitValues returns an array of possible values for the MetricUnit const type. +func PossibleMetricUnitValues() []MetricUnit { + return []MetricUnit{MetricUnitBitsPerSecond, MetricUnitBytes, MetricUnitByteSeconds, MetricUnitBytesPerSecond, MetricUnitCores, MetricUnitCount, MetricUnitCountPerSecond, MetricUnitMilliCores, MetricUnitMilliSeconds, MetricUnitNanoCores, MetricUnitPercent, MetricUnitSeconds, MetricUnitUnspecified} +} + // OdataType enumerates the values for odata type. type OdataType string @@ -348,13 +433,11 @@ const ( OperatorLessThan Operator = "LessThan" // OperatorLessThanOrEqual ... OperatorLessThanOrEqual Operator = "LessThanOrEqual" - // OperatorNotEquals ... - OperatorNotEquals Operator = "NotEquals" ) // PossibleOperatorValues returns an array of possible values for the Operator const type. func PossibleOperatorValues() []Operator { - return []Operator{OperatorEquals, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorLessThan, OperatorLessThanOrEqual, OperatorNotEquals} + return []Operator{OperatorEquals, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorLessThan, OperatorLessThanOrEqual} } // ProvisioningState enumerates the values for provisioning state. @@ -490,28 +573,13 @@ const ( ExactCount ScaleType = "ExactCount" // PercentChangeCount ... PercentChangeCount ScaleType = "PercentChangeCount" + // ServiceAllowedNextValue ... + ServiceAllowedNextValue ScaleType = "ServiceAllowedNextValue" ) // PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. func PossibleScaleTypeValues() []ScaleType { - return []ScaleType{ChangeCount, ExactCount, PercentChangeCount} -} - -// Sensitivity enumerates the values for sensitivity. -type Sensitivity string - -const ( - // SensitivityHigh ... - SensitivityHigh Sensitivity = "High" - // SensitivityLow ... - SensitivityLow Sensitivity = "Low" - // SensitivityMedium ... - SensitivityMedium Sensitivity = "Medium" -) - -// PossibleSensitivityValues returns an array of possible values for the Sensitivity const type. -func PossibleSensitivityValues() []Sensitivity { - return []Sensitivity{SensitivityHigh, SensitivityLow, SensitivityMedium} + return []ScaleType{ChangeCount, ExactCount, PercentChangeCount, ServiceAllowedNextValue} } // TimeAggregationOperator enumerates the values for time aggregation operator. @@ -557,40 +625,3 @@ const ( func PossibleTimeAggregationTypeValues() []TimeAggregationType { return []TimeAggregationType{TimeAggregationTypeAverage, TimeAggregationTypeCount, TimeAggregationTypeLast, TimeAggregationTypeMaximum, TimeAggregationTypeMinimum, TimeAggregationTypeTotal} } - -// Unit enumerates the values for unit. -type Unit string - -const ( - // UnitBitsPerSecond ... - UnitBitsPerSecond Unit = "BitsPerSecond" - // UnitBytes ... - UnitBytes Unit = "Bytes" - // UnitByteSeconds ... - UnitByteSeconds Unit = "ByteSeconds" - // UnitBytesPerSecond ... - UnitBytesPerSecond Unit = "BytesPerSecond" - // UnitCores ... - UnitCores Unit = "Cores" - // UnitCount ... - UnitCount Unit = "Count" - // UnitCountPerSecond ... - UnitCountPerSecond Unit = "CountPerSecond" - // UnitMilliCores ... - UnitMilliCores Unit = "MilliCores" - // UnitMilliSeconds ... - UnitMilliSeconds Unit = "MilliSeconds" - // UnitNanoCores ... - UnitNanoCores Unit = "NanoCores" - // UnitPercent ... - UnitPercent Unit = "Percent" - // UnitSeconds ... - UnitSeconds Unit = "Seconds" - // UnitUnspecified ... - UnitUnspecified Unit = "Unspecified" -) - -// PossibleUnitValues returns an array of possible values for the Unit const type. -func PossibleUnitValues() []Unit { - return []Unit{UnitBitsPerSecond, UnitBytes, UnitByteSeconds, UnitBytesPerSecond, UnitCores, UnitCount, UnitCountPerSecond, UnitMilliCores, UnitMilliSeconds, UnitNanoCores, UnitPercent, UnitSeconds, UnitUnspecified} -} diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/eventcategories.go b/services/preview/monitor/mgmt/2018-03-01/insights/eventcategories.go index 86e59b424363..f43c5468ac51 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/eventcategories.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/eventcategories.go @@ -75,7 +75,7 @@ func (client EventCategoriesClient) ListPreparer(ctx context.Context) (*http.Req preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventcategories"), + autorest.WithPath("/providers/Microsoft.Insights/eventcategories"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/insightsapi/interfaces.go b/services/preview/monitor/mgmt/2018-03-01/insights/insightsapi/interfaces.go index 90e873ce9135..e726df63b83d 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/insightsapi/interfaces.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/insightsapi/interfaces.go @@ -144,14 +144,6 @@ type MetricsClientAPI interface { var _ MetricsClientAPI = (*insights.MetricsClient)(nil) -// MetricBaselineClientAPI contains the set of methods on the MetricBaselineClient type. -type MetricBaselineClientAPI interface { - CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation insights.TimeSeriesInformation) (result insights.CalculateBaselineResponse, err error) - Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType insights.ResultType) (result insights.BaselineResponse, err error) -} - -var _ MetricBaselineClientAPI = (*insights.MetricBaselineClient)(nil) - // MetricAlertsClientAPI contains the set of methods on the MetricAlertsClient type. type MetricAlertsClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.MetricAlertResource) (result insights.MetricAlertResource, err error) diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/logprofiles.go b/services/preview/monitor/mgmt/2018-03-01/insights/logprofiles.go index ad1500b87bc9..cfa5e8be2997 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/logprofiles.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/logprofiles.go @@ -56,7 +56,9 @@ func (client LogProfilesClient) CreateOrUpdate(ctx context.Context, logProfileNa {Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, }}, - }}}}}); err != nil { + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.LogProfilesClient", "CreateOrUpdate", err.Error()) } @@ -98,7 +100,7 @@ func (client LogProfilesClient) CreateOrUpdatePreparer(ctx context.Context, logP autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -136,6 +138,12 @@ func (client LogProfilesClient) Delete(ctx context.Context, logProfileName strin tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, logProfileName) if err != nil { err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", nil, "Failure preparing request") @@ -173,7 +181,7 @@ func (client LogProfilesClient) DeletePreparer(ctx context.Context, logProfileNa preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -209,6 +217,12 @@ func (client LogProfilesClient) Get(ctx context.Context, logProfileName string) tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, logProfileName) if err != nil { err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Get", nil, "Failure preparing request") @@ -246,7 +260,7 @@ func (client LogProfilesClient) GetPreparer(ctx context.Context, logProfileName preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -281,6 +295,12 @@ func (client LogProfilesClient) List(ctx context.Context) (result LogProfileColl tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "List", err.Error()) + } + req, err := client.ListPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "List", nil, "Failure preparing request") @@ -317,7 +337,7 @@ func (client LogProfilesClient) ListPreparer(ctx context.Context) (*http.Request preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -355,6 +375,12 @@ func (client LogProfilesClient) Update(ctx context.Context, logProfileName strin tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, logProfileName, logProfilesResource) if err != nil { err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Update", nil, "Failure preparing request") @@ -393,7 +419,7 @@ func (client LogProfilesClient) UpdatePreparer(ctx context.Context, logProfileNa autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithJSON(logProfilesResource), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/metricalerts.go b/services/preview/monitor/mgmt/2018-03-01/insights/metricalerts.go index 94231b6fa34e..f9706664d9be 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/metricalerts.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/metricalerts.go @@ -33,7 +33,7 @@ func NewMetricAlertsClientWithBaseURI(baseURI string, subscriptionID string) Met // CreateOrUpdate create or update an metric alert definition. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to create or update. func (client MetricAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource) (result MetricAlertResource, err error) { @@ -48,11 +48,16 @@ func (client MetricAlertsClient) CreateOrUpdate(ctx context.Context, resourceGro }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.MetricAlertProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.MetricAlertProperties.Description", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.Severity", Name: validation.Null, Rule: true, Chain: nil}, + Chain: []validation.Constraint{{Target: "parameters.MetricAlertProperties.Severity", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.MetricAlertProperties.Enabled", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.MetricAlertProperties.Scopes", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.MetricAlertProperties.EvaluationFrequency", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.MetricAlertProperties.WindowSize", Name: validation.Null, Rule: true, Chain: nil}, }}}}}); err != nil { @@ -124,7 +129,7 @@ func (client MetricAlertsClient) CreateOrUpdateResponder(resp *http.Response) (r // Delete delete an alert rule definition. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client MetricAlertsClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -137,6 +142,15 @@ func (client MetricAlertsClient) Delete(ctx context.Context, resourceGroupName s tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", nil, "Failure preparing request") @@ -199,7 +213,7 @@ func (client MetricAlertsClient) DeleteResponder(resp *http.Response) (result au // Get retrieve an alert rule definition. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client MetricAlertsClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertResource, err error) { if tracing.IsEnabled() { @@ -212,6 +226,15 @@ func (client MetricAlertsClient) Get(ctx context.Context, resourceGroupName stri tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Get", nil, "Failure preparing request") @@ -275,7 +298,7 @@ func (client MetricAlertsClient) GetResponder(resp *http.Response) (result Metri // ListByResourceGroup retrieve alert rule definitions in a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client MetricAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result MetricAlertResourceCollection, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.ListByResourceGroup") @@ -287,6 +310,15 @@ func (client MetricAlertsClient) ListByResourceGroup(ctx context.Context, resour tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -359,6 +391,12 @@ func (client MetricAlertsClient) ListBySubscription(ctx context.Context) (result tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "ListBySubscription", err.Error()) + } + req, err := client.ListBySubscriptionPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", nil, "Failure preparing request") @@ -420,7 +458,7 @@ func (client MetricAlertsClient) ListBySubscriptionResponder(resp *http.Response // Update update an metric alert definition. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to update. func (client MetricAlertsClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch) (result MetricAlertResource, err error) { @@ -434,6 +472,15 @@ func (client MetricAlertsClient) Update(ctx context.Context, resourceGroupName s tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Update", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/metricalertsstatus.go b/services/preview/monitor/mgmt/2018-03-01/insights/metricalertsstatus.go index 43cfaed42765..4709142160be 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/metricalertsstatus.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/metricalertsstatus.go @@ -10,6 +10,7 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" "net/http" ) @@ -33,7 +34,7 @@ func NewMetricAlertsStatusClientWithBaseURI(baseURI string, subscriptionID strin // List retrieve an alert rule status. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client MetricAlertsStatusClient) List(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertStatusCollection, err error) { if tracing.IsEnabled() { @@ -46,6 +47,15 @@ func (client MetricAlertsStatusClient) List(ctx context.Context, resourceGroupNa tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsStatusClient", "List", err.Error()) + } + req, err := client.ListPreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "List", nil, "Failure preparing request") @@ -109,7 +119,7 @@ func (client MetricAlertsStatusClient) ListResponder(resp *http.Response) (resul // ListByName retrieve an alert rule status. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // statusName - the name of the status. func (client MetricAlertsStatusClient) ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (result MetricAlertStatusCollection, err error) { @@ -123,6 +133,15 @@ func (client MetricAlertsStatusClient) ListByName(ctx context.Context, resourceG tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsStatusClient", "ListByName", err.Error()) + } + req, err := client.ListByNamePreparer(ctx, resourceGroupName, ruleName, statusName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/metricbaseline.go b/services/preview/monitor/mgmt/2018-03-01/insights/metricbaseline.go deleted file mode 100644 index d395fc67bc59..000000000000 --- a/services/preview/monitor/mgmt/2018-03-01/insights/metricbaseline.go +++ /dev/null @@ -1,217 +0,0 @@ -package insights - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// MetricBaselineClient is the monitor Management Client -type MetricBaselineClient struct { - BaseClient -} - -// NewMetricBaselineClient creates an instance of the MetricBaselineClient client. -func NewMetricBaselineClient(subscriptionID string) MetricBaselineClient { - return NewMetricBaselineClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricBaselineClientWithBaseURI creates an instance of the MetricBaselineClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewMetricBaselineClientWithBaseURI(baseURI string, subscriptionID string) MetricBaselineClient { - return MetricBaselineClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CalculateBaseline **Lists the baseline values for a resource**. -// Parameters: -// resourceURI - 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 -// timeSeriesInformation - information that need to be specified to calculate a baseline on a time series. -func (client MetricBaselineClient) CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (result CalculateBaselineResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricBaselineClient.CalculateBaseline") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: timeSeriesInformation, - Constraints: []validation.Constraint{{Target: "timeSeriesInformation.Sensitivities", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "timeSeriesInformation.Values", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.MetricBaselineClient", "CalculateBaseline", err.Error()) - } - - req, err := client.CalculateBaselinePreparer(ctx, resourceURI, timeSeriesInformation) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", nil, "Failure preparing request") - return - } - - resp, err := client.CalculateBaselineSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure sending request") - return - } - - result, err = client.CalculateBaselineResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure responding to request") - return - } - - return -} - -// CalculateBaselinePreparer prepares the CalculateBaseline request. -func (client MetricBaselineClient) CalculateBaselinePreparer(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/calculatebaseline", pathParameters), - autorest.WithJSON(timeSeriesInformation), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CalculateBaselineSender sends the CalculateBaseline request. The method will close the -// http.Response Body if it receives an error. -func (client MetricBaselineClient) CalculateBaselineSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CalculateBaselineResponder handles the response to the CalculateBaseline request. The method always -// closes the http.Response Body. -func (client MetricBaselineClient) CalculateBaselineResponder(resp *http.Response) (result CalculateBaselineResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get **Gets the baseline values for a specific metric**. -// Parameters: -// resourceURI - 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 -// metricName - the name of the metric to retrieve the baseline for. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// aggregation - the aggregation type of the metric to retrieve the baseline for. -// sensitivities - the list of sensitivities (comma separated) to retrieve. -// resultType - allows retrieving only metadata of the baseline. On data request all information is retrieved. -func (client MetricBaselineClient) Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (result BaselineResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricBaselineClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceURI, metricName, timespan, interval, aggregation, sensitivities, resultType) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client MetricBaselineClient) GetPreparer(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "metricName": autorest.Encode("path", metricName), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if len(sensitivities) > 0 { - queryParameters["sensitivities"] = autorest.Encode("query", sensitivities) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/baseline/{metricName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client MetricBaselineClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client MetricBaselineClient) GetResponder(resp *http.Response) (result BaselineResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/metricdefinitions.go b/services/preview/monitor/mgmt/2018-03-01/insights/metricdefinitions.go index 69fc2e0b465a..c316b154fe7e 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/metricdefinitions.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/metricdefinitions.go @@ -85,7 +85,7 @@ func (client MetricDefinitionsClient) ListPreparer(ctx context.Context, resource preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricDefinitions", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metricDefinitions", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/metrics.go b/services/preview/monitor/mgmt/2018-03-01/insights/metrics.go index 97687a09b498..f2329253c944 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/metrics.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/metrics.go @@ -36,7 +36,8 @@ func NewMetricsClientWithBaseURI(baseURI string, subscriptionID string) MetricsC // timespan - the timespan of the query. It is a string with the following format // 'startDateTime_ISO/endDateTime_ISO'. // interval - the interval (i.e. timegrain) of the query. -// metricnames - the names of the metrics (comma separated) to retrieve. +// metricnames - the names of the metrics (comma separated) to retrieve. Special case: If a metricname itself +// has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be **'Metric%2Name1'** // aggregation - the list of aggregation types (comma separated) to retrieve. // top - the maximum number of records to retrieve. // Valid only if $filter is specified. @@ -44,13 +45,16 @@ func NewMetricsClientWithBaseURI(baseURI string, subscriptionID string) MetricsC // orderby - the aggregation to use for sorting results and the direction of the sort. // Only one order can be specified. // Examples: sum asc. -// 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 -// ‘*’**. +// 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 '*'**. Special case: When +// dimension name or dimension value uses round brackets. Eg: When dimension name is **dim (test) 1** Instead +// of using $filter= "dim (test) 1 eq '*' " use **$filter= "dim %2528test%2529 1 eq '*' "** When dimension name +// is **dim (test) 3** and dimension value is **dim3 (test) val** Instead of using $filter= "dim (test) 3 eq +// 'dim3 (test) val' " use **$filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "** // resultType - reduces the set of data collected. The syntax allowed depends on the operation. See the // operation's description for details. // metricnamespace - metric namespace to query metric definitions for. @@ -128,7 +132,7 @@ func (client MetricsClient) ListPreparer(ctx context.Context, resourceURI string preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metrics", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metrics", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/models.go b/services/preview/monitor/mgmt/2018-03-01/insights/models.go index f9cabd91d30a..335855468edd 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/models.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/models.go @@ -212,6 +212,10 @@ type ActionGroupResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for ActionGroupResource. @@ -292,6 +296,24 @@ func (agr *ActionGroupResource) UnmarshalJSON(body []byte) error { } agr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + agr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agr.Etag = &etag + } } } @@ -437,6 +459,10 @@ type ActivityLogAlertResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for ActivityLogAlertResource. @@ -517,6 +543,24 @@ func (alar *ActivityLogAlertResource) UnmarshalJSON(body []byte) error { } alar.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + alar.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + alar.Etag = &etag + } } } @@ -585,10 +629,14 @@ type AlertRule struct { Name *string `json:"name,omitempty"` // Description - the description of the alert rule that will be included in the alert email. Description *string `json:"description,omitempty"` + // ProvisioningState - the provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` // IsEnabled - the flag that indicates whether the alert rule is enabled. IsEnabled *bool `json:"isEnabled,omitempty"` // Condition - the condition that results in the alert rule being activated. Condition BasicRuleCondition `json:"condition,omitempty"` + // Action - action that is performed when the alert rule becomes active, and when an alert condition is resolved. + Action BasicRuleAction `json:"action,omitempty"` // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. Actions *[]BasicRuleAction `json:"actions,omitempty"` // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. @@ -604,10 +652,14 @@ func (ar AlertRule) MarshalJSON() ([]byte, error) { if ar.Description != nil { objectMap["description"] = ar.Description } + if ar.ProvisioningState != nil { + objectMap["provisioningState"] = ar.ProvisioningState + } if ar.IsEnabled != nil { objectMap["isEnabled"] = ar.IsEnabled } objectMap["condition"] = ar.Condition + objectMap["action"] = ar.Action if ar.Actions != nil { objectMap["actions"] = ar.Actions } @@ -641,6 +693,15 @@ func (ar *AlertRule) UnmarshalJSON(body []byte) error { } ar.Description = &description } + case "provisioningState": + if v != nil { + var provisioningState string + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + ar.ProvisioningState = &provisioningState + } case "isEnabled": if v != nil { var isEnabled bool @@ -658,6 +719,14 @@ func (ar *AlertRule) UnmarshalJSON(body []byte) error { } ar.Condition = condition } + case "action": + if v != nil { + action, err := unmarshalBasicRuleAction(*v) + if err != nil { + return err + } + ar.Action = action + } case "actions": if v != nil { actions, err := unmarshalBasicRuleActionArray(*v) @@ -696,6 +765,10 @@ type AlertRuleResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for AlertRuleResource. @@ -776,6 +849,24 @@ func (arr *AlertRuleResource) UnmarshalJSON(body []byte) error { } arr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + arr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + arr.Etag = &etag + } } } @@ -895,6 +986,8 @@ type AutoscaleSetting struct { Name *string `json:"name,omitempty"` // TargetResourceURI - the resource identifier of the resource that the autoscale setting should be added to. TargetResourceURI *string `json:"targetResourceUri,omitempty"` + // TargetResourceLocation - the location of the resource that the autoscale setting should be added to. + TargetResourceLocation *string `json:"targetResourceLocation,omitempty"` } // AutoscaleSettingResource the autoscale setting resource. @@ -912,6 +1005,10 @@ type AutoscaleSettingResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for AutoscaleSettingResource. @@ -992,6 +1089,24 @@ func (asr *AutoscaleSettingResource) UnmarshalJSON(body []byte) error { } asr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + asr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + asr.Etag = &etag + } } } @@ -1241,124 +1356,6 @@ type AzureFunctionReceiver struct { HTTPTriggerURL *string `json:"httpTriggerUrl,omitempty"` } -// Baseline the baseline values for a single sensitivity value. -type Baseline struct { - // Sensitivity - the sensitivity of the baseline. Possible values include: 'SensitivityLow', 'SensitivityMedium', 'SensitivityHigh' - Sensitivity Sensitivity `json:"sensitivity,omitempty"` - // LowThresholds - The low thresholds of the baseline. - LowThresholds *[]float64 `json:"lowThresholds,omitempty"` - // HighThresholds - The high thresholds of the baseline. - HighThresholds *[]float64 `json:"highThresholds,omitempty"` -} - -// BaselineMetadataValue represents a baseline metadata value. -type BaselineMetadataValue struct { - // Name - the name of the metadata. - Name *LocalizableString `json:"name,omitempty"` - // Value - the value of the metadata. - Value *string `json:"value,omitempty"` -} - -// BaselineProperties the baseline properties class. -type BaselineProperties struct { - // 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. - Timespan *string `json:"timespan,omitempty"` - // 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. - Interval *string `json:"interval,omitempty"` - // Aggregation - The aggregation type of the metric. - Aggregation *string `json:"aggregation,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Baseline - the baseline values for each sensitivity. - Baseline *[]Baseline `json:"baseline,omitempty"` - // Metadata - the baseline metadata values. - Metadata *[]BaselineMetadataValue `json:"metadata,omitempty"` -} - -// BaselineResponse the response to a baseline query. -type BaselineResponse struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; the metric baseline Id. - ID *string `json:"id,omitempty"` - // Type - READ-ONLY; the resource type of the baseline resource. - Type *string `json:"type,omitempty"` - // Name - READ-ONLY; the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString `json:"name,omitempty"` - // BaselineProperties - the properties of the baseline. - *BaselineProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for BaselineResponse. -func (br BaselineResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if br.BaselineProperties != nil { - objectMap["properties"] = br.BaselineProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BaselineResponse struct. -func (br *BaselineResponse) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - br.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - br.Type = &typeVar - } - case "name": - if v != nil { - var name LocalizableString - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - br.Name = &name - } - case "properties": - if v != nil { - var baselineProperties BaselineProperties - err = json.Unmarshal(*v, &baselineProperties) - if err != nil { - return err - } - br.BaselineProperties = &baselineProperties - } - } - } - - return nil -} - -// CalculateBaselineResponse the response to a calculate baseline call. -type CalculateBaselineResponse struct { - autorest.Response `json:"-"` - // Type - the resource type of the baseline resource. - Type *string `json:"type,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Baseline - the baseline values for each sensitivity. - Baseline *[]Baseline `json:"baseline,omitempty"` -} - // Criteria specifies the criteria for converting log to metric. type Criteria struct { // MetricName - Name of the metric @@ -1582,8 +1579,8 @@ type DynamicMetricCriteria struct { MetricName *string `json:"metricName,omitempty"` // MetricNamespace - Namespace of the metric. MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` + // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' + TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` // Dimensions - List of dimension conditions. Dimensions *[]MetricDimension `json:"dimensions,omitempty"` // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. @@ -1617,7 +1614,7 @@ func (dmc DynamicMetricCriteria) MarshalJSON() ([]byte, error) { if dmc.MetricNamespace != nil { objectMap["metricNamespace"] = dmc.MetricNamespace } - if dmc.TimeAggregation != nil { + if dmc.TimeAggregation != "" { objectMap["timeAggregation"] = dmc.TimeAggregation } if dmc.Dimensions != nil { @@ -1741,7 +1738,7 @@ func (dmc *DynamicMetricCriteria) UnmarshalJSON(body []byte) error { } case "timeAggregation": if v != nil { - var timeAggregation interface{} + var timeAggregation AggregationTypeEnum err = json.Unmarshal(*v, &timeAggregation) if err != nil { return err @@ -1828,6 +1825,12 @@ type EnableRequest struct { ReceiverName *string `json:"receiverName,omitempty"` } +// ErrorContract describes the format of Error response. +type ErrorContract struct { + // Error - The error details. + Error *ErrorResponse `json:"error,omitempty"` +} + // ErrorResponse describes the format of Error response. type ErrorResponse struct { // Code - Error code @@ -2239,7 +2242,7 @@ type LogicAppReceiver struct { // LogMetricTrigger a log metrics trigger descriptor. type LogMetricTrigger struct { - // ThresholdOperator - Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' + // ThresholdOperator - Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'ConditionalOperatorGreaterThanOrEqual', 'ConditionalOperatorLessThanOrEqual', 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` // Threshold - The threshold of the metric trigger. Threshold *float64 `json:"threshold,omitempty"` @@ -2285,6 +2288,10 @@ type LogProfileResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for LogProfileResource. @@ -2365,6 +2372,24 @@ func (lpr *LogProfileResource) UnmarshalJSON(body []byte) error { } lpr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + lpr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + lpr.Etag = &etag + } } } @@ -2426,8 +2451,16 @@ func (lprp *LogProfileResourcePatch) UnmarshalJSON(body []byte) error { // LogSearchRule log Search Rule Definition type LogSearchRule struct { + // CreatedWithAPIVersion - READ-ONLY; The api-version used when creating this alert rule + CreatedWithAPIVersion *string `json:"createdWithApiVersion,omitempty"` + // IsLegacyLogAnalyticsRule - READ-ONLY; True if alert rule is legacy Log Analytic rule + IsLegacyLogAnalyticsRule *bool `json:"isLegacyLogAnalyticsRule,omitempty"` // Description - The description of the Log Search rule. Description *string `json:"description,omitempty"` + // DisplayName - The display name of the alert rule + DisplayName *string `json:"displayName,omitempty"` + // AutoMitigate - The flag that indicates whether the alert should be automatically resolved or not. The default is false. + AutoMitigate *bool `json:"autoMitigate,omitempty"` // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'True', 'False' Enabled Enabled `json:"enabled,omitempty"` // LastUpdatedTime - READ-ONLY; Last time the rule was updated in IS08601 format. @@ -2448,6 +2481,12 @@ func (lsr LogSearchRule) MarshalJSON() ([]byte, error) { if lsr.Description != nil { objectMap["description"] = lsr.Description } + if lsr.DisplayName != nil { + objectMap["displayName"] = lsr.DisplayName + } + if lsr.AutoMitigate != nil { + objectMap["autoMitigate"] = lsr.AutoMitigate + } if lsr.Enabled != "" { objectMap["enabled"] = lsr.Enabled } @@ -2470,6 +2509,24 @@ func (lsr *LogSearchRule) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { + case "createdWithApiVersion": + if v != nil { + var createdWithAPIVersion string + err = json.Unmarshal(*v, &createdWithAPIVersion) + if err != nil { + return err + } + lsr.CreatedWithAPIVersion = &createdWithAPIVersion + } + case "isLegacyLogAnalyticsRule": + if v != nil { + var isLegacyLogAnalyticsRule bool + err = json.Unmarshal(*v, &isLegacyLogAnalyticsRule) + if err != nil { + return err + } + lsr.IsLegacyLogAnalyticsRule = &isLegacyLogAnalyticsRule + } case "description": if v != nil { var description string @@ -2479,6 +2536,24 @@ func (lsr *LogSearchRule) UnmarshalJSON(body []byte) error { } lsr.Description = &description } + case "displayName": + if v != nil { + var displayName string + err = json.Unmarshal(*v, &displayName) + if err != nil { + return err + } + lsr.DisplayName = &displayName + } + case "autoMitigate": + if v != nil { + var autoMitigate bool + err = json.Unmarshal(*v, &autoMitigate) + if err != nil { + return err + } + lsr.AutoMitigate = &autoMitigate + } case "enabled": if v != nil { var enabled Enabled @@ -2559,6 +2634,10 @@ type LogSearchRuleResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for LogSearchRuleResource. @@ -2639,6 +2718,24 @@ func (lsrr *LogSearchRuleResource) UnmarshalJSON(body []byte) error { } lsrr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + lsrr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + lsrr.Etag = &etag + } } } @@ -2872,8 +2969,14 @@ type Metric struct { Type *string `json:"type,omitempty"` // Name - the name and the display name of the metric, i.e. it is localizable string. Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' - Unit Unit `json:"unit,omitempty"` + // DisplayDescription - Detailed description of this metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + // ErrorCode - 'Success' or the error details on query failures for this metric. + ErrorCode *string `json:"errorCode,omitempty"` + // ErrorMessage - Error message encountered querying this specific metric. + ErrorMessage *string `json:"errorMessage,omitempty"` + // Unit - The unit of the metric. Possible values include: 'MetricUnitCount', 'MetricUnitBytes', 'MetricUnitSeconds', 'MetricUnitCountPerSecond', 'MetricUnitBytesPerSecond', 'MetricUnitPercent', 'MetricUnitMilliSeconds', 'MetricUnitByteSeconds', 'MetricUnitUnspecified', 'MetricUnitCores', 'MetricUnitMilliCores', 'MetricUnitNanoCores', 'MetricUnitBitsPerSecond' + Unit MetricUnit `json:"unit,omitempty"` // Timeseries - the time series returned when a data query is performed. Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"` } @@ -2882,7 +2985,7 @@ type Metric struct { type MetricAlertAction struct { // ActionGroupID - the id of the action group to use. ActionGroupID *string `json:"actionGroupId,omitempty"` - // WebHookProperties - The properties of a webhook object. + // WebHookProperties - This field allows specifying custom properties, which would be appended to the alert payload sent as input to the webhook. WebHookProperties map[string]*string `json:"webHookProperties"` } @@ -3143,9 +3246,9 @@ type MetricAlertProperties struct { EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. WindowSize *string `json:"windowSize,omitempty"` - // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource. TargetResourceType *string `json:"targetResourceType,omitempty"` - // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource. TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` // Criteria - defines the specific alert criteria information. Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` @@ -3155,6 +3258,8 @@ type MetricAlertProperties struct { Actions *[]MetricAlertAction `json:"actions,omitempty"` // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` + // IsMigrated - READ-ONLY; the value indicating whether this alert rule is migrated. + IsMigrated *bool `json:"isMigrated,omitempty"` } // MarshalJSON is the custom marshaler for MetricAlertProperties. @@ -3310,6 +3415,213 @@ func (mapVar *MetricAlertProperties) UnmarshalJSON(body []byte) error { } mapVar.LastUpdatedTime = &lastUpdatedTime } + case "isMigrated": + if v != nil { + var isMigrated bool + err = json.Unmarshal(*v, &isMigrated) + if err != nil { + return err + } + mapVar.IsMigrated = &isMigrated + } + } + } + + return nil +} + +// MetricAlertPropertiesPatch an alert rule properties for patch. +type MetricAlertPropertiesPatch struct { + // Description - the description of the metric alert that will be included in the alert email. + Description *string `json:"description,omitempty"` + // Severity - Alert severity {0, 1, 2, 3, 4} + Severity *int32 `json:"severity,omitempty"` + // Enabled - the flag that indicates whether the metric alert is enabled. + Enabled *bool `json:"enabled,omitempty"` + // Scopes - the list of resource id's that this metric alert is scoped to. + Scopes *[]string `json:"scopes,omitempty"` + // EvaluationFrequency - how often the metric alert is evaluated represented in ISO 8601 duration format. + EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` + // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. + WindowSize *string `json:"windowSize,omitempty"` + // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + TargetResourceType *string `json:"targetResourceType,omitempty"` + // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` + // Criteria - defines the specific alert criteria information. + Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` + // AutoMitigate - the flag that indicates whether the alert should be auto resolved or not. The default is true. + AutoMitigate *bool `json:"autoMitigate,omitempty"` + // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + Actions *[]MetricAlertAction `json:"actions,omitempty"` + // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. + LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` + // IsMigrated - READ-ONLY; the value indicating whether this alert rule is migrated. + IsMigrated *bool `json:"isMigrated,omitempty"` +} + +// MarshalJSON is the custom marshaler for MetricAlertPropertiesPatch. +func (mapp MetricAlertPropertiesPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mapp.Description != nil { + objectMap["description"] = mapp.Description + } + if mapp.Severity != nil { + objectMap["severity"] = mapp.Severity + } + if mapp.Enabled != nil { + objectMap["enabled"] = mapp.Enabled + } + if mapp.Scopes != nil { + objectMap["scopes"] = mapp.Scopes + } + if mapp.EvaluationFrequency != nil { + objectMap["evaluationFrequency"] = mapp.EvaluationFrequency + } + if mapp.WindowSize != nil { + objectMap["windowSize"] = mapp.WindowSize + } + if mapp.TargetResourceType != nil { + objectMap["targetResourceType"] = mapp.TargetResourceType + } + if mapp.TargetResourceRegion != nil { + objectMap["targetResourceRegion"] = mapp.TargetResourceRegion + } + objectMap["criteria"] = mapp.Criteria + if mapp.AutoMitigate != nil { + objectMap["autoMitigate"] = mapp.AutoMitigate + } + if mapp.Actions != nil { + objectMap["actions"] = mapp.Actions + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MetricAlertPropertiesPatch struct. +func (mapp *MetricAlertPropertiesPatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + mapp.Description = &description + } + case "severity": + if v != nil { + var severity int32 + err = json.Unmarshal(*v, &severity) + if err != nil { + return err + } + mapp.Severity = &severity + } + case "enabled": + if v != nil { + var enabled bool + err = json.Unmarshal(*v, &enabled) + if err != nil { + return err + } + mapp.Enabled = &enabled + } + case "scopes": + if v != nil { + var scopes []string + err = json.Unmarshal(*v, &scopes) + if err != nil { + return err + } + mapp.Scopes = &scopes + } + case "evaluationFrequency": + if v != nil { + var evaluationFrequency string + err = json.Unmarshal(*v, &evaluationFrequency) + if err != nil { + return err + } + mapp.EvaluationFrequency = &evaluationFrequency + } + case "windowSize": + if v != nil { + var windowSize string + err = json.Unmarshal(*v, &windowSize) + if err != nil { + return err + } + mapp.WindowSize = &windowSize + } + case "targetResourceType": + if v != nil { + var targetResourceType string + err = json.Unmarshal(*v, &targetResourceType) + if err != nil { + return err + } + mapp.TargetResourceType = &targetResourceType + } + case "targetResourceRegion": + if v != nil { + var targetResourceRegion string + err = json.Unmarshal(*v, &targetResourceRegion) + if err != nil { + return err + } + mapp.TargetResourceRegion = &targetResourceRegion + } + case "criteria": + if v != nil { + criteria, err := unmarshalBasicMetricAlertCriteria(*v) + if err != nil { + return err + } + mapp.Criteria = criteria + } + case "autoMitigate": + if v != nil { + var autoMitigate bool + err = json.Unmarshal(*v, &autoMitigate) + if err != nil { + return err + } + mapp.AutoMitigate = &autoMitigate + } + case "actions": + if v != nil { + var actions []MetricAlertAction + err = json.Unmarshal(*v, &actions) + if err != nil { + return err + } + mapp.Actions = &actions + } + case "lastUpdatedTime": + if v != nil { + var lastUpdatedTime date.Time + err = json.Unmarshal(*v, &lastUpdatedTime) + if err != nil { + return err + } + mapp.LastUpdatedTime = &lastUpdatedTime + } + case "isMigrated": + if v != nil { + var isMigrated bool + err = json.Unmarshal(*v, &isMigrated) + if err != nil { + return err + } + mapp.IsMigrated = &isMigrated + } } } @@ -3331,6 +3643,10 @@ type MetricAlertResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for MetricAlertResource. @@ -3411,6 +3727,24 @@ func (mar *MetricAlertResource) UnmarshalJSON(body []byte) error { } mar.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + mar.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + mar.Etag = &etag + } } } @@ -3428,8 +3762,8 @@ type MetricAlertResourceCollection struct { type MetricAlertResourcePatch struct { // Tags - Resource tags Tags map[string]*string `json:"tags"` - // MetricAlertProperties - The alert rule properties of the resource. - *MetricAlertProperties `json:"properties,omitempty"` + // MetricAlertPropertiesPatch - The alert rule properties of the resource. + *MetricAlertPropertiesPatch `json:"properties,omitempty"` } // MarshalJSON is the custom marshaler for MetricAlertResourcePatch. @@ -3438,8 +3772,8 @@ func (marp MetricAlertResourcePatch) MarshalJSON() ([]byte, error) { if marp.Tags != nil { objectMap["tags"] = marp.Tags } - if marp.MetricAlertProperties != nil { - objectMap["properties"] = marp.MetricAlertProperties + if marp.MetricAlertPropertiesPatch != nil { + objectMap["properties"] = marp.MetricAlertPropertiesPatch } return json.Marshal(objectMap) } @@ -3464,12 +3798,12 @@ func (marp *MetricAlertResourcePatch) UnmarshalJSON(body []byte) error { } case "properties": if v != nil { - var metricAlertProperties MetricAlertProperties - err = json.Unmarshal(*v, &metricAlertProperties) + var metricAlertPropertiesPatch MetricAlertPropertiesPatch + err = json.Unmarshal(*v, &metricAlertPropertiesPatch) if err != nil { return err } - marp.MetricAlertProperties = &metricAlertProperties + marp.MetricAlertPropertiesPatch = &metricAlertPropertiesPatch } } } @@ -3629,7 +3963,7 @@ type MetricAvailability struct { // MetricCriteria criterion to filter metrics. type MetricCriteria struct { - // Operator - the criteria operator. Possible values include: 'OperatorEquals', 'OperatorNotEquals', 'OperatorGreaterThan', 'OperatorGreaterThanOrEqual', 'OperatorLessThan', 'OperatorLessThanOrEqual' + // Operator - the criteria operator. Possible values include: 'OperatorEquals', 'OperatorGreaterThan', 'OperatorGreaterThanOrEqual', 'OperatorLessThan', 'OperatorLessThanOrEqual' Operator Operator `json:"operator,omitempty"` // Threshold - the criteria threshold value that activates the alert. Threshold *float64 `json:"threshold,omitempty"` @@ -3641,8 +3975,8 @@ type MetricCriteria struct { MetricName *string `json:"metricName,omitempty"` // MetricNamespace - Namespace of the metric. MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` + // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' + TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` // Dimensions - List of dimension conditions. Dimensions *[]MetricDimension `json:"dimensions,omitempty"` // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. @@ -3670,7 +4004,7 @@ func (mc MetricCriteria) MarshalJSON() ([]byte, error) { if mc.MetricNamespace != nil { objectMap["metricNamespace"] = mc.MetricNamespace } - if mc.TimeAggregation != nil { + if mc.TimeAggregation != "" { objectMap["timeAggregation"] = mc.TimeAggregation } if mc.Dimensions != nil { @@ -3776,7 +4110,7 @@ func (mc *MetricCriteria) UnmarshalJSON(body []byte) error { } case "timeAggregation": if v != nil { - var timeAggregation interface{} + var timeAggregation AggregationTypeEnum err = json.Unmarshal(*v, &timeAggregation) if err != nil { return err @@ -3826,8 +4160,14 @@ type MetricDefinition struct { Namespace *string `json:"namespace,omitempty"` // Name - the name and the display name of the metric, i.e. it is a localizable string. Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' - Unit Unit `json:"unit,omitempty"` + // DisplayDescription - Detailed description of this metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + // Category - Custom category name for this metric. + Category *string `json:"category,omitempty"` + // MetricClass - The class of the metric. Possible values include: 'Availability', 'Transactions', 'Errors', 'Latency', 'Saturation' + MetricClass MetricClass `json:"metricClass,omitempty"` + // Unit - The unit of the metric. Possible values include: 'MetricUnitCount', 'MetricUnitBytes', 'MetricUnitSeconds', 'MetricUnitCountPerSecond', 'MetricUnitBytesPerSecond', 'MetricUnitPercent', 'MetricUnitMilliSeconds', 'MetricUnitByteSeconds', 'MetricUnitUnspecified', 'MetricUnitCores', 'MetricUnitMilliCores', 'MetricUnitNanoCores', 'MetricUnitBitsPerSecond' + Unit MetricUnit `json:"unit,omitempty"` // PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' PrimaryAggregationType AggregationType `json:"primaryAggregationType,omitempty"` // SupportedAggregationTypes - the collection of what aggregation types are supported. @@ -3877,9 +4217,11 @@ type MetricTrigger struct { MetricNamespace *string `json:"metricNamespace,omitempty"` // MetricResourceURI - the resource identifier of the resource the rule monitors. MetricResourceURI *string `json:"metricResourceUri,omitempty"` + // MetricResourceLocation - the location of the resource the rule monitors. + MetricResourceLocation *string `json:"metricResourceLocation,omitempty"` // TimeGrain - 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. TimeGrain *string `json:"timeGrain,omitempty"` - // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum' + // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum', 'MetricStatisticTypeCount' Statistic MetricStatisticType `json:"statistic,omitempty"` // TimeWindow - 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. TimeWindow *string `json:"timeWindow,omitempty"` @@ -3891,6 +4233,8 @@ type MetricTrigger struct { Threshold *float64 `json:"threshold,omitempty"` // Dimensions - List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. Dimensions *[]ScaleRuleMetricDimension `json:"dimensions,omitempty"` + // DividePerInstance - a value indicating whether metric should divide per instance. + DividePerInstance *bool `json:"dividePerInstance,omitempty"` } // MetricValue represents a metric value. @@ -3926,8 +4270,8 @@ type MultiMetricCriteria struct { MetricName *string `json:"metricName,omitempty"` // MetricNamespace - Namespace of the metric. MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` + // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' + TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` // Dimensions - List of dimension conditions. Dimensions *[]MetricDimension `json:"dimensions,omitempty"` // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. @@ -3990,7 +4334,7 @@ func (mmc MultiMetricCriteria) MarshalJSON() ([]byte, error) { if mmc.MetricNamespace != nil { objectMap["metricNamespace"] = mmc.MetricNamespace } - if mmc.TimeAggregation != nil { + if mmc.TimeAggregation != "" { objectMap["timeAggregation"] = mmc.TimeAggregation } if mmc.Dimensions != nil { @@ -4078,7 +4422,7 @@ func (mmc *MultiMetricCriteria) UnmarshalJSON(body []byte) error { } case "timeAggregation": if v != nil { - var timeAggregation interface{} + var timeAggregation AggregationTypeEnum err = json.Unmarshal(*v, &timeAggregation) if err != nil { return err @@ -4195,6 +4539,10 @@ type Resource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for Resource. @@ -4212,15 +4560,15 @@ func (r Resource) MarshalJSON() ([]byte, error) { // Response the response to a metrics query. type Response struct { autorest.Response `json:"-"` - // Cost - The integer value representing the cost of the query, for data case. + // Cost - The integer value representing the relative cost of the query. Cost *float64 `json:"cost,omitempty"` // 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. Timespan *string `json:"timespan,omitempty"` // 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. Interval *string `json:"interval,omitempty"` - // Namespace - The namespace of the metrics been queried + // Namespace - The namespace of the metrics being queried Namespace *string `json:"namespace,omitempty"` - // Resourceregion - The region of the resource been queried for metrics. + // Resourceregion - The region of the resource being queried for metrics. Resourceregion *string `json:"resourceregion,omitempty"` // Value - the value of the collection. Value *[]Metric `json:"value,omitempty"` @@ -4460,6 +4808,12 @@ type BasicRuleDataSource interface { type RuleDataSource struct { // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' OdataType OdataType `json:"odata.type,omitempty"` } @@ -4512,6 +4866,15 @@ func (rds RuleDataSource) MarshalJSON() ([]byte, error) { if rds.ResourceURI != nil { objectMap["resourceUri"] = rds.ResourceURI } + if rds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rds.LegacyResourceID + } + if rds.ResourceLocation != nil { + objectMap["resourceLocation"] = rds.ResourceLocation + } + if rds.MetricNamespace != nil { + objectMap["metricNamespace"] = rds.MetricNamespace + } if rds.OdataType != "" { objectMap["odata.type"] = rds.OdataType } @@ -4614,6 +4977,12 @@ type RuleManagementEventDataSource struct { Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' OdataType OdataType `json:"odata.type,omitempty"` } @@ -4652,6 +5021,15 @@ func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { if rmeds.ResourceURI != nil { objectMap["resourceUri"] = rmeds.ResourceURI } + if rmeds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rmeds.LegacyResourceID + } + if rmeds.ResourceLocation != nil { + objectMap["resourceLocation"] = rmeds.ResourceLocation + } + if rmeds.MetricNamespace != nil { + objectMap["metricNamespace"] = rmeds.MetricNamespace + } if rmeds.OdataType != "" { objectMap["odata.type"] = rmeds.OdataType } @@ -4685,6 +5063,12 @@ type RuleMetricDataSource struct { MetricName *string `json:"metricName,omitempty"` // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' OdataType OdataType `json:"odata.type,omitempty"` } @@ -4699,6 +5083,15 @@ func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) { if rmds.ResourceURI != nil { objectMap["resourceUri"] = rmds.ResourceURI } + if rmds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rmds.LegacyResourceID + } + if rmds.ResourceLocation != nil { + objectMap["resourceLocation"] = rmds.ResourceLocation + } + if rmds.MetricNamespace != nil { + objectMap["metricNamespace"] = rmds.MetricNamespace + } if rmds.OdataType != "" { objectMap["odata.type"] = rmds.OdataType } @@ -4776,7 +5169,7 @@ func (rwa RuleWebhookAction) AsBasicRuleAction() (BasicRuleAction, bool) { type ScaleAction struct { // Direction - the scale direction. Whether the scaling action increases or decreases the number of instances. Possible values include: 'ScaleDirectionNone', 'ScaleDirectionIncrease', 'ScaleDirectionDecrease' Direction ScaleDirection `json:"direction,omitempty"` - // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount' + // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount', 'ServiceAllowedNextValue' Type ScaleType `json:"type,omitempty"` // Value - the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1. Value *string `json:"value,omitempty"` @@ -5011,16 +5404,6 @@ type TimeSeriesElement struct { Data *[]MetricValue `json:"data,omitempty"` } -// TimeSeriesInformation the time series info needed for calculating the baseline. -type TimeSeriesInformation struct { - // Sensitivities - the list of sensitivities for calculating the baseline. - Sensitivities *[]string `json:"sensitivities,omitempty"` - // Values - The metric values to calculate the baseline. - Values *[]float64 `json:"values,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` -} - // TimeWindow a specific date-time for the profile. type TimeWindow struct { // TimeZone - 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 @@ -5033,7 +5416,7 @@ type TimeWindow struct { // TriggerCondition the condition that results in the Log Search rule. type TriggerCondition struct { - // ThresholdOperator - Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' + // ThresholdOperator - Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'ConditionalOperatorGreaterThanOrEqual', 'ConditionalOperatorLessThanOrEqual', 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` // Threshold - Result or count threshold based on which rule should be triggered. Threshold *float64 `json:"threshold,omitempty"` diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/operations.go b/services/preview/monitor/mgmt/2018-03-01/insights/operations.go index 3f82351c7f23..afb74dc9248f 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/operations.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/operations.go @@ -74,7 +74,7 @@ func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/operations"), + autorest.WithPath("/providers/Microsoft.Insights/operations"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/scheduledqueryrules.go b/services/preview/monitor/mgmt/2018-03-01/insights/scheduledqueryrules.go index c9d43964ecb0..22b09a5f8997 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/scheduledqueryrules.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/scheduledqueryrules.go @@ -34,7 +34,7 @@ func NewScheduledQueryRulesClientWithBaseURI(baseURI string, subscriptionID stri // CreateOrUpdate creates or updates an log search rule. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to create or update. func (client ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResource) (result LogSearchRuleResource, err error) { @@ -49,6 +49,11 @@ func (client ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, reso }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.LogSearchRule", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source", Name: validation.Null, Rule: true, @@ -100,7 +105,7 @@ func (client ScheduledQueryRulesClient) CreateOrUpdatePreparer(ctx context.Conte autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -126,7 +131,7 @@ func (client ScheduledQueryRulesClient) CreateOrUpdateResponder(resp *http.Respo // Delete deletes a Log Search rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client ScheduledQueryRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -139,6 +144,15 @@ func (client ScheduledQueryRulesClient) Delete(ctx context.Context, resourceGrou tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", nil, "Failure preparing request") @@ -177,7 +191,7 @@ func (client ScheduledQueryRulesClient) DeletePreparer(ctx context.Context, reso preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -201,7 +215,7 @@ func (client ScheduledQueryRulesClient) DeleteResponder(resp *http.Response) (re // Get gets an Log Search rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client ScheduledQueryRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result LogSearchRuleResource, err error) { if tracing.IsEnabled() { @@ -214,6 +228,15 @@ func (client ScheduledQueryRulesClient) Get(ctx context.Context, resourceGroupNa tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Get", nil, "Failure preparing request") @@ -252,7 +275,7 @@ func (client ScheduledQueryRulesClient) GetPreparer(ctx context.Context, resourc preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -277,7 +300,7 @@ func (client ScheduledQueryRulesClient) GetResponder(resp *http.Response) (resul // ListByResourceGroup list the Log Search rules within a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // filter - the filter to apply on the operation. For more information please see // https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx func (client ScheduledQueryRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result LogSearchRuleResourceCollection, err error) { @@ -291,6 +314,15 @@ func (client ScheduledQueryRulesClient) ListByResourceGroup(ctx context.Context, tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -331,7 +363,7 @@ func (client ScheduledQueryRulesClient) ListByResourceGroupPreparer(ctx context. preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -369,6 +401,12 @@ func (client ScheduledQueryRulesClient) ListBySubscription(ctx context.Context, tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "ListBySubscription", err.Error()) + } + req, err := client.ListBySubscriptionPreparer(ctx, filter) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", nil, "Failure preparing request") @@ -408,7 +446,7 @@ func (client ScheduledQueryRulesClient) ListBySubscriptionPreparer(ctx context.C preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/scheduledQueryRules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -433,7 +471,7 @@ func (client ScheduledQueryRulesClient) ListBySubscriptionResponder(resp *http.R // Update update log search Rule. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to update. func (client ScheduledQueryRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResourcePatch) (result LogSearchRuleResource, err error) { @@ -447,6 +485,15 @@ func (client ScheduledQueryRulesClient) Update(ctx context.Context, resourceGrou tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Update", nil, "Failure preparing request") @@ -486,7 +533,7 @@ func (client ScheduledQueryRulesClient) UpdatePreparer(ctx context.Context, reso autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/tenantactivitylogs.go b/services/preview/monitor/mgmt/2018-03-01/insights/tenantactivitylogs.go index 7501f047bb38..7c6ee7981381 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/tenantactivitylogs.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/tenantactivitylogs.go @@ -107,7 +107,7 @@ func (client TenantActivityLogsClient) ListPreparer(ctx context.Context, filter preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventtypes/management/values"), + autorest.WithPath("/providers/Microsoft.Insights/eventtypes/management/values"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/CHANGELOG.md b/services/preview/monitor/mgmt/2018-09-01/insights/CHANGELOG.md index 52911e4cc5e4..776b21565fc6 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/CHANGELOG.md +++ b/services/preview/monitor/mgmt/2018-09-01/insights/CHANGELOG.md @@ -1,2 +1,191 @@ -# Change History +# Unreleased +## Breaking Changes + +### Removed Constants + +1. Operator.OperatorNotEquals +1. Sensitivity.SensitivityHigh +1. Sensitivity.SensitivityLow +1. Sensitivity.SensitivityMedium +1. Unit.UnitBitsPerSecond +1. Unit.UnitByteSeconds +1. Unit.UnitBytes +1. Unit.UnitBytesPerSecond +1. Unit.UnitCores +1. Unit.UnitCount +1. Unit.UnitCountPerSecond +1. Unit.UnitMilliCores +1. Unit.UnitMilliSeconds +1. Unit.UnitNanoCores +1. Unit.UnitPercent +1. Unit.UnitSeconds +1. Unit.UnitUnspecified + +### Removed Funcs + +1. *BaselineResponse.UnmarshalJSON([]byte) error +1. BaselineResponse.MarshalJSON() ([]byte, error) +1. MetricBaselineClient.CalculateBaseline(context.Context, string, TimeSeriesInformation) (CalculateBaselineResponse, error) +1. MetricBaselineClient.CalculateBaselinePreparer(context.Context, string, TimeSeriesInformation) (*http.Request, error) +1. MetricBaselineClient.CalculateBaselineResponder(*http.Response) (CalculateBaselineResponse, error) +1. MetricBaselineClient.CalculateBaselineSender(*http.Request) (*http.Response, error) +1. MetricBaselineClient.Get(context.Context, string, string, string, *string, string, string, ResultType) (BaselineResponse, error) +1. MetricBaselineClient.GetPreparer(context.Context, string, string, string, *string, string, string, ResultType) (*http.Request, error) +1. MetricBaselineClient.GetResponder(*http.Response) (BaselineResponse, error) +1. MetricBaselineClient.GetSender(*http.Request) (*http.Response, error) +1. MetricNamespacesClient.List(context.Context, string, string) (MetricNamespaceCollection, error) +1. MetricNamespacesClient.ListPreparer(context.Context, string, string) (*http.Request, error) +1. MetricNamespacesClient.ListResponder(*http.Response) (MetricNamespaceCollection, error) +1. MetricNamespacesClient.ListSender(*http.Request) (*http.Response, error) +1. NewMetricBaselineClient(string) MetricBaselineClient +1. NewMetricBaselineClientWithBaseURI(string, string) MetricBaselineClient +1. NewMetricNamespacesClient(string) MetricNamespacesClient +1. NewMetricNamespacesClientWithBaseURI(string, string) MetricNamespacesClient +1. PossibleSensitivityValues() []Sensitivity +1. PossibleUnitValues() []Unit + +### Struct Changes + +#### Removed Structs + +1. Baseline +1. BaselineMetadataValue +1. BaselineProperties +1. BaselineResponse +1. CalculateBaselineResponse +1. MetricBaselineClient +1. MetricNamespace +1. MetricNamespaceCollection +1. MetricNamespaceName +1. MetricNamespacesClient +1. TimeSeriesInformation + +#### Removed Struct Fields + +1. MetricAlertResourcePatch.*MetricAlertProperties + +### Signature Changes + +#### Const Types + +1. High changed type from DynamicThresholdSensitivity to BaselineSensitivity +1. Low changed type from DynamicThresholdSensitivity to BaselineSensitivity +1. Medium changed type from DynamicThresholdSensitivity to BaselineSensitivity + +#### Struct Fields + +1. DynamicMetricCriteria.TimeAggregation changed type from interface{} to AggregationTypeEnum +1. Metric.Unit changed type from Unit to MetricUnit +1. MetricCriteria.TimeAggregation changed type from interface{} to AggregationTypeEnum +1. MetricDefinition.Unit changed type from Unit to MetricUnit +1. MultiMetricCriteria.TimeAggregation changed type from interface{} to AggregationTypeEnum + +## Additive Changes + +### New Constants + +1. AggregationTypeEnum.AggregationTypeEnumAverage +1. AggregationTypeEnum.AggregationTypeEnumCount +1. AggregationTypeEnum.AggregationTypeEnumMaximum +1. AggregationTypeEnum.AggregationTypeEnumMinimum +1. AggregationTypeEnum.AggregationTypeEnumTotal +1. ConditionalOperator.ConditionalOperatorGreaterThanOrEqual +1. ConditionalOperator.ConditionalOperatorLessThanOrEqual +1. DynamicThresholdSensitivity.DynamicThresholdSensitivityHigh +1. DynamicThresholdSensitivity.DynamicThresholdSensitivityLow +1. DynamicThresholdSensitivity.DynamicThresholdSensitivityMedium +1. MetricClass.Availability +1. MetricClass.Errors +1. MetricClass.Latency +1. MetricClass.Saturation +1. MetricClass.Transactions +1. MetricStatisticType.MetricStatisticTypeCount +1. MetricUnit.MetricUnitBitsPerSecond +1. MetricUnit.MetricUnitByteSeconds +1. MetricUnit.MetricUnitBytes +1. MetricUnit.MetricUnitBytesPerSecond +1. MetricUnit.MetricUnitCores +1. MetricUnit.MetricUnitCount +1. MetricUnit.MetricUnitCountPerSecond +1. MetricUnit.MetricUnitMilliCores +1. MetricUnit.MetricUnitMilliSeconds +1. MetricUnit.MetricUnitNanoCores +1. MetricUnit.MetricUnitPercent +1. MetricUnit.MetricUnitSeconds +1. MetricUnit.MetricUnitUnspecified +1. ScaleType.ServiceAllowedNextValue + +### New Funcs + +1. *MetricAlertPropertiesPatch.UnmarshalJSON([]byte) error +1. BaselinesClient.List(context.Context, string, string, string, string, *string, string, string, string, ResultType) (MetricBaselinesResponse, error) +1. BaselinesClient.ListPreparer(context.Context, string, string, string, string, *string, string, string, string, ResultType) (*http.Request, error) +1. BaselinesClient.ListResponder(*http.Response) (MetricBaselinesResponse, error) +1. BaselinesClient.ListSender(*http.Request) (*http.Response, error) +1. MetricAlertPropertiesPatch.MarshalJSON() ([]byte, error) +1. NewBaselinesClient(string) BaselinesClient +1. NewBaselinesClientWithBaseURI(string, string) BaselinesClient +1. PossibleAggregationTypeEnumValues() []AggregationTypeEnum +1. PossibleBaselineSensitivityValues() []BaselineSensitivity +1. PossibleMetricClassValues() []MetricClass +1. PossibleMetricUnitValues() []MetricUnit + +### Struct Changes + +#### New Structs + +1. BaselineMetadata +1. BaselinesClient +1. ErrorContract +1. MetricAlertPropertiesPatch +1. MetricBaselinesResponse +1. MetricSingleDimension +1. SingleBaseline +1. SingleMetricBaseline +1. TimeSeriesBaseline + +#### New Struct Fields + +1. ActionGroupResource.Etag +1. ActionGroupResource.Kind +1. ActivityLogAlertResource.Etag +1. ActivityLogAlertResource.Kind +1. AlertRule.Action +1. AlertRule.ProvisioningState +1. AlertRuleResource.Etag +1. AlertRuleResource.Kind +1. AutoscaleSetting.TargetResourceLocation +1. AutoscaleSettingResource.Etag +1. AutoscaleSettingResource.Kind +1. LogProfileResource.Etag +1. LogProfileResource.Kind +1. LogSearchRule.AutoMitigate +1. LogSearchRule.CreatedWithAPIVersion +1. LogSearchRule.DisplayName +1. LogSearchRule.IsLegacyLogAnalyticsRule +1. LogSearchRuleResource.Etag +1. LogSearchRuleResource.Kind +1. Metric.DisplayDescription +1. Metric.ErrorCode +1. Metric.ErrorMessage +1. MetricAlertProperties.IsMigrated +1. MetricAlertResource.Etag +1. MetricAlertResource.Kind +1. MetricAlertResourcePatch.*MetricAlertPropertiesPatch +1. MetricDefinition.Category +1. MetricDefinition.DisplayDescription +1. MetricDefinition.MetricClass +1. MetricTrigger.DividePerInstance +1. MetricTrigger.MetricResourceLocation +1. Resource.Etag +1. Resource.Kind +1. RuleDataSource.LegacyResourceID +1. RuleDataSource.MetricNamespace +1. RuleDataSource.ResourceLocation +1. RuleManagementEventDataSource.LegacyResourceID +1. RuleManagementEventDataSource.MetricNamespace +1. RuleManagementEventDataSource.ResourceLocation +1. RuleMetricDataSource.LegacyResourceID +1. RuleMetricDataSource.MetricNamespace +1. RuleMetricDataSource.ResourceLocation diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/_meta.json b/services/preview/monitor/mgmt/2018-09-01/insights/_meta.json index 481c5b77032a..98809f980c54 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/_meta.json +++ b/services/preview/monitor/mgmt/2018-09-01/insights/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "83f6c7b9ac240d3862e909245f0a61d70ae33908", "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", "tag": "package-2018-09", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/actiongroups.go b/services/preview/monitor/mgmt/2018-09-01/insights/actiongroups.go index 20bdb629e8c1..d2fccb5ce09e 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/actiongroups.go +++ b/services/preview/monitor/mgmt/2018-09-01/insights/actiongroups.go @@ -33,7 +33,7 @@ func NewActionGroupsClientWithBaseURI(baseURI string, subscriptionID string) Act // CreateOrUpdate create a new action group or update an existing one. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. // actionGroup - the action group to create or use for the update. func (client ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (result ActionGroupResource, err error) { @@ -48,12 +48,17 @@ func (client ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGro }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: actionGroup, Constraints: []validation.Constraint{{Target: "actionGroup.ActionGroup", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.MaxLength, Rule: 12, Chain: nil}}}, {Target: "actionGroup.ActionGroup.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ActionGroupsClient", "CreateOrUpdate", err.Error()) } @@ -122,7 +127,7 @@ func (client ActionGroupsClient) CreateOrUpdateResponder(resp *http.Response) (r // Delete delete an action group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. func (client ActionGroupsClient) Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -135,6 +140,15 @@ func (client ActionGroupsClient) Delete(ctx context.Context, resourceGroupName s tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, actionGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", nil, "Failure preparing request") @@ -198,7 +212,7 @@ func (client ActionGroupsClient) DeleteResponder(resp *http.Response) (result au // EnableReceiver 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. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. // enableRequest - the receiver to re-enable. func (client ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (result autorest.Response, err error) { @@ -213,8 +227,13 @@ func (client ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGro }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: enableRequest, - Constraints: []validation.Constraint{{Target: "enableRequest.ReceiverName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "enableRequest.ReceiverName", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ActionGroupsClient", "EnableReceiver", err.Error()) } @@ -282,7 +301,7 @@ func (client ActionGroupsClient) EnableReceiverResponder(resp *http.Response) (r // Get get an action group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. func (client ActionGroupsClient) Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result ActionGroupResource, err error) { if tracing.IsEnabled() { @@ -295,6 +314,15 @@ func (client ActionGroupsClient) Get(ctx context.Context, resourceGroupName stri tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, actionGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Get", nil, "Failure preparing request") @@ -358,7 +386,7 @@ func (client ActionGroupsClient) GetResponder(resp *http.Response) (result Actio // ListByResourceGroup get a list of all action groups in a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client ActionGroupsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActionGroupList, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.ListByResourceGroup") @@ -370,6 +398,15 @@ func (client ActionGroupsClient) ListByResourceGroup(ctx context.Context, resour tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -442,6 +479,12 @@ func (client ActionGroupsClient) ListBySubscriptionID(ctx context.Context) (resu tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "ListBySubscriptionID", err.Error()) + } + req, err := client.ListBySubscriptionIDPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", nil, "Failure preparing request") @@ -503,7 +546,7 @@ func (client ActionGroupsClient) ListBySubscriptionIDResponder(resp *http.Respon // Update updates an existing action group's tags. To update other fields use the CreateOrUpdate method. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. // actionGroupPatch - parameters supplied to the operation. func (client ActionGroupsClient) Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (result ActionGroupResource, err error) { @@ -517,6 +560,15 @@ func (client ActionGroupsClient) Update(ctx context.Context, resourceGroupName s tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, actionGroupName, actionGroupPatch) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Update", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/activitylogalerts.go b/services/preview/monitor/mgmt/2018-09-01/insights/activitylogalerts.go index 44aaf3ef1e4a..f897b08a6f0c 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/activitylogalerts.go +++ b/services/preview/monitor/mgmt/2018-09-01/insights/activitylogalerts.go @@ -34,7 +34,7 @@ func NewActivityLogAlertsClientWithBaseURI(baseURI string, subscriptionID string // CreateOrUpdate create a new activity log alert or update an existing one. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // activityLogAlertName - the name of the activity log alert. // activityLogAlert - the activity log alert to create or use for the update. func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (result ActivityLogAlertResource, err error) { @@ -49,6 +49,11 @@ func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resour }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: activityLogAlert, Constraints: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Scopes", Name: validation.Null, Rule: true, Chain: nil}, @@ -124,7 +129,7 @@ func (client ActivityLogAlertsClient) CreateOrUpdateResponder(resp *http.Respons // Delete delete an activity log alert. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // activityLogAlertName - the name of the activity log alert. func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -137,6 +142,15 @@ func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupN tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, activityLogAlertName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", nil, "Failure preparing request") @@ -199,7 +213,7 @@ func (client ActivityLogAlertsClient) DeleteResponder(resp *http.Response) (resu // Get get an activity log alert. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // activityLogAlertName - the name of the activity log alert. func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result ActivityLogAlertResource, err error) { if tracing.IsEnabled() { @@ -212,6 +226,15 @@ func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, activityLogAlertName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Get", nil, "Failure preparing request") @@ -275,7 +298,7 @@ func (client ActivityLogAlertsClient) GetResponder(resp *http.Response) (result // ListByResourceGroup get a list of all activity log alerts in a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActivityLogAlertList, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.ListByResourceGroup") @@ -287,6 +310,15 @@ func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, r tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -359,6 +391,12 @@ func (client ActivityLogAlertsClient) ListBySubscriptionID(ctx context.Context) tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "ListBySubscriptionID", err.Error()) + } + req, err := client.ListBySubscriptionIDPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", nil, "Failure preparing request") @@ -420,7 +458,7 @@ func (client ActivityLogAlertsClient) ListBySubscriptionIDResponder(resp *http.R // Update updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // activityLogAlertName - the name of the activity log alert. // activityLogAlertPatch - parameters supplied to the operation. func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (result ActivityLogAlertResource, err error) { @@ -434,6 +472,15 @@ func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupN tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, activityLogAlertName, activityLogAlertPatch) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Update", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/activitylogs.go b/services/preview/monitor/mgmt/2018-09-01/insights/activitylogs.go index 16dd215e6ad9..fc6927fa0e16 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/activitylogs.go +++ b/services/preview/monitor/mgmt/2018-09-01/insights/activitylogs.go @@ -10,6 +10,7 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" "net/http" ) @@ -60,6 +61,12 @@ func (client ActivityLogsClient) List(ctx context.Context, filter string, select tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogsClient", "List", err.Error()) + } + result.fn = client.listNextResults req, err := client.ListPreparer(ctx, filter, selectParameter) if err != nil { @@ -105,7 +112,7 @@ func (client ActivityLogsClient) ListPreparer(ctx context.Context, filter string preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/eventtypes/management/values", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/eventtypes/management/values", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/alertruleincidents.go b/services/preview/monitor/mgmt/2018-09-01/insights/alertruleincidents.go index c3bf26828d8e..a7dcd9cba31e 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/alertruleincidents.go +++ b/services/preview/monitor/mgmt/2018-09-01/insights/alertruleincidents.go @@ -10,6 +10,7 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" "net/http" ) @@ -33,7 +34,7 @@ func NewAlertRuleIncidentsClientWithBaseURI(baseURI string, subscriptionID strin // Get gets an incident associated to an alert rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // incidentName - the name of the incident to retrieve. func (client AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result Incident, err error) { @@ -47,6 +48,15 @@ func (client AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupNam tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRuleIncidentsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName, incidentName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "Get", nil, "Failure preparing request") @@ -111,7 +121,7 @@ func (client AlertRuleIncidentsClient) GetResponder(resp *http.Response) (result // ListByAlertRule gets a list of incidents associated to an alert rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client AlertRuleIncidentsClient) ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result IncidentListResult, err error) { if tracing.IsEnabled() { @@ -124,6 +134,15 @@ func (client AlertRuleIncidentsClient) ListByAlertRule(ctx context.Context, reso tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRuleIncidentsClient", "ListByAlertRule", err.Error()) + } + req, err := client.ListByAlertRulePreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/alertrules.go b/services/preview/monitor/mgmt/2018-09-01/insights/alertrules.go index f5a2ab682384..888ed122e267 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/alertrules.go +++ b/services/preview/monitor/mgmt/2018-09-01/insights/alertrules.go @@ -33,7 +33,7 @@ func NewAlertRulesClientWithBaseURI(baseURI string, subscriptionID string) Alert // CreateOrUpdate creates or updates a classic metric alert rule. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to create or update. func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (result AlertRuleResource, err error) { @@ -48,11 +48,16 @@ func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroup }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.AlertRule", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.AlertRule.Name", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.AlertRule.IsEnabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AlertRulesClient", "CreateOrUpdate", err.Error()) } @@ -95,7 +100,7 @@ func (client AlertRulesClient) CreateOrUpdatePreparer(ctx context.Context, resou autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -121,7 +126,7 @@ func (client AlertRulesClient) CreateOrUpdateResponder(resp *http.Response) (res // Delete deletes a classic metric alert rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -134,6 +139,15 @@ func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName str tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", nil, "Failure preparing request") @@ -172,7 +186,7 @@ func (client AlertRulesClient) DeletePreparer(ctx context.Context, resourceGroup preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -196,7 +210,7 @@ func (client AlertRulesClient) DeleteResponder(resp *http.Response) (result auto // Get gets a classic metric alert rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result AlertRuleResource, err error) { if tracing.IsEnabled() { @@ -209,6 +223,15 @@ func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Get", nil, "Failure preparing request") @@ -247,7 +270,7 @@ func (client AlertRulesClient) GetPreparer(ctx context.Context, resourceGroupNam preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -272,7 +295,7 @@ func (client AlertRulesClient) GetResponder(resp *http.Response) (result AlertRu // ListByResourceGroup list the classic metric alert rules within a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client AlertRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AlertRuleResourceCollection, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.ListByResourceGroup") @@ -284,6 +307,15 @@ func (client AlertRulesClient) ListByResourceGroup(ctx context.Context, resource tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -321,7 +353,7 @@ func (client AlertRulesClient) ListByResourceGroupPreparer(ctx context.Context, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -356,6 +388,12 @@ func (client AlertRulesClient) ListBySubscription(ctx context.Context) (result A tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "ListBySubscription", err.Error()) + } + req, err := client.ListBySubscriptionPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", nil, "Failure preparing request") @@ -392,7 +430,7 @@ func (client AlertRulesClient) ListBySubscriptionPreparer(ctx context.Context) ( preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/alertrules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -417,7 +455,7 @@ func (client AlertRulesClient) ListBySubscriptionResponder(resp *http.Response) // Update updates an existing classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // alertRulesResource - parameters supplied to the operation. func (client AlertRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (result AlertRuleResource, err error) { @@ -431,6 +469,15 @@ func (client AlertRulesClient) Update(ctx context.Context, resourceGroupName str tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, alertRulesResource) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Update", nil, "Failure preparing request") @@ -470,7 +517,7 @@ func (client AlertRulesClient) UpdatePreparer(ctx context.Context, resourceGroup autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithJSON(alertRulesResource), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/autoscalesettings.go b/services/preview/monitor/mgmt/2018-09-01/insights/autoscalesettings.go index 86f253d0fb89..d9118bd2d049 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/autoscalesettings.go +++ b/services/preview/monitor/mgmt/2018-09-01/insights/autoscalesettings.go @@ -34,7 +34,7 @@ func NewAutoscaleSettingsClientWithBaseURI(baseURI string, subscriptionID string // CreateOrUpdate creates or updates an autoscale setting. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // autoscaleSettingName - the autoscale setting name. // parameters - parameters supplied to the operation. func (client AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (result AutoscaleSettingResource, err error) { @@ -49,11 +49,16 @@ func (client AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resour }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.AutoscaleSetting", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.MaxItems, Rule: 20, Chain: nil}}}, - }}}}}); err != nil { + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AutoscaleSettingsClient", "CreateOrUpdate", err.Error()) } @@ -96,7 +101,7 @@ func (client AutoscaleSettingsClient) CreateOrUpdatePreparer(ctx context.Context autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -122,7 +127,7 @@ func (client AutoscaleSettingsClient) CreateOrUpdateResponder(resp *http.Respons // Delete deletes and autoscale setting // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // autoscaleSettingName - the autoscale setting name. func (client AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -135,6 +140,15 @@ func (client AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupN tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, autoscaleSettingName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", nil, "Failure preparing request") @@ -173,7 +187,7 @@ func (client AutoscaleSettingsClient) DeletePreparer(ctx context.Context, resour preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -197,7 +211,7 @@ func (client AutoscaleSettingsClient) DeleteResponder(resp *http.Response) (resu // Get gets an autoscale setting // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // autoscaleSettingName - the autoscale setting name. func (client AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result AutoscaleSettingResource, err error) { if tracing.IsEnabled() { @@ -210,6 +224,15 @@ func (client AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, autoscaleSettingName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Get", nil, "Failure preparing request") @@ -248,7 +271,7 @@ func (client AutoscaleSettingsClient) GetPreparer(ctx context.Context, resourceG preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -273,7 +296,7 @@ func (client AutoscaleSettingsClient) GetResponder(resp *http.Response) (result // ListByResourceGroup lists the autoscale settings for a resource group // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client AutoscaleSettingsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.ListByResourceGroup") @@ -285,6 +308,15 @@ func (client AutoscaleSettingsClient) ListByResourceGroup(ctx context.Context, r tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "ListByResourceGroup", err.Error()) + } + result.fn = client.listByResourceGroupNextResults req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { @@ -327,7 +359,7 @@ func (client AutoscaleSettingsClient) ListByResourceGroupPreparer(ctx context.Co preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -399,6 +431,12 @@ func (client AutoscaleSettingsClient) ListBySubscription(ctx context.Context) (r tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "ListBySubscription", err.Error()) + } + result.fn = client.listBySubscriptionNextResults req, err := client.ListBySubscriptionPreparer(ctx) if err != nil { @@ -440,7 +478,7 @@ func (client AutoscaleSettingsClient) ListBySubscriptionPreparer(ctx context.Con preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/autoscalesettings", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -502,7 +540,7 @@ func (client AutoscaleSettingsClient) ListBySubscriptionComplete(ctx context.Con // Update updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // autoscaleSettingName - the autoscale setting name. // autoscaleSettingResource - parameters supplied to the operation. func (client AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (result AutoscaleSettingResource, err error) { @@ -516,6 +554,15 @@ func (client AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupN tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, autoscaleSettingName, autoscaleSettingResource) if err != nil { err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Update", nil, "Failure preparing request") @@ -555,7 +602,7 @@ func (client AutoscaleSettingsClient) UpdatePreparer(ctx context.Context, resour autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithJSON(autoscaleSettingResource), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/baselines.go b/services/preview/monitor/mgmt/2018-09-01/insights/baselines.go similarity index 94% rename from services/preview/monitor/mgmt/2021-04-01-preview/insights/baselines.go rename to services/preview/monitor/mgmt/2018-09-01/insights/baselines.go index 337ce4d1fa0f..fb5215fc0109 100644 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/baselines.go +++ b/services/preview/monitor/mgmt/2018-09-01/insights/baselines.go @@ -10,7 +10,6 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" "net/http" ) @@ -64,12 +63,6 @@ func (client BaselinesClient) List(ctx context.Context, resourceURI string, metr tracing.EndSpan(ctx, sc, err) }() } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceURI, - Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.BaselinesClient", "List", err.Error()) - } - req, err := client.ListPreparer(ctx, resourceURI, metricnames, metricnamespace, timespan, interval, aggregation, sensitivities, filter, resultType) if err != nil { err = autorest.NewErrorWithError(err, "insights.BaselinesClient", "List", nil, "Failure preparing request") @@ -98,7 +91,7 @@ func (client BaselinesClient) ListPreparer(ctx context.Context, resourceURI stri "resourceUri": resourceURI, } - const APIVersion = "2019-03-01" + const APIVersion = "2018-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/diagnosticsettings.go b/services/preview/monitor/mgmt/2018-09-01/insights/diagnosticsettings.go index 9708c52c2499..db8aa282d0f3 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/diagnosticsettings.go +++ b/services/preview/monitor/mgmt/2018-09-01/insights/diagnosticsettings.go @@ -85,7 +85,7 @@ func (client DiagnosticSettingsClient) CreateOrUpdatePreparer(ctx context.Contex autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -161,7 +161,7 @@ func (client DiagnosticSettingsClient) DeletePreparer(ctx context.Context, resou preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -235,7 +235,7 @@ func (client DiagnosticSettingsClient) GetPreparer(ctx context.Context, resource preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -308,7 +308,7 @@ func (client DiagnosticSettingsClient) ListPreparer(ctx context.Context, resourc preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/diagnosticsettingscategory.go b/services/preview/monitor/mgmt/2018-09-01/insights/diagnosticsettingscategory.go index 48365ed67e65..07b7295848ef 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/diagnosticsettingscategory.go +++ b/services/preview/monitor/mgmt/2018-09-01/insights/diagnosticsettingscategory.go @@ -83,7 +83,7 @@ func (client DiagnosticSettingsCategoryClient) GetPreparer(ctx context.Context, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -156,7 +156,7 @@ func (client DiagnosticSettingsCategoryClient) ListPreparer(ctx context.Context, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/enums.go b/services/preview/monitor/mgmt/2018-09-01/insights/enums.go index 1bab3243cf63..6cc3023f9f61 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/enums.go +++ b/services/preview/monitor/mgmt/2018-09-01/insights/enums.go @@ -29,6 +29,27 @@ func PossibleAggregationTypeValues() []AggregationType { return []AggregationType{Average, Count, Maximum, Minimum, None, Total} } +// AggregationTypeEnum enumerates the values for aggregation type enum. +type AggregationTypeEnum string + +const ( + // AggregationTypeEnumAverage ... + AggregationTypeEnumAverage AggregationTypeEnum = "Average" + // AggregationTypeEnumCount ... + AggregationTypeEnumCount AggregationTypeEnum = "Count" + // AggregationTypeEnumMaximum ... + AggregationTypeEnumMaximum AggregationTypeEnum = "Maximum" + // AggregationTypeEnumMinimum ... + AggregationTypeEnumMinimum AggregationTypeEnum = "Minimum" + // AggregationTypeEnumTotal ... + AggregationTypeEnumTotal AggregationTypeEnum = "Total" +) + +// PossibleAggregationTypeEnumValues returns an array of possible values for the AggregationTypeEnum const type. +func PossibleAggregationTypeEnumValues() []AggregationTypeEnum { + return []AggregationTypeEnum{AggregationTypeEnumAverage, AggregationTypeEnumCount, AggregationTypeEnumMaximum, AggregationTypeEnumMinimum, AggregationTypeEnumTotal} +} + // AlertSeverity enumerates the values for alert severity. type AlertSeverity string @@ -50,6 +71,23 @@ func PossibleAlertSeverityValues() []AlertSeverity { return []AlertSeverity{Four, One, Three, Two, Zero} } +// BaselineSensitivity enumerates the values for baseline sensitivity. +type BaselineSensitivity string + +const ( + // High ... + High BaselineSensitivity = "High" + // Low ... + Low BaselineSensitivity = "Low" + // Medium ... + Medium BaselineSensitivity = "Medium" +) + +// PossibleBaselineSensitivityValues returns an array of possible values for the BaselineSensitivity const type. +func PossibleBaselineSensitivityValues() []BaselineSensitivity { + return []BaselineSensitivity{High, Low, Medium} +} + // CategoryType enumerates the values for category type. type CategoryType string @@ -96,13 +134,17 @@ const ( ConditionalOperatorEqual ConditionalOperator = "Equal" // ConditionalOperatorGreaterThan ... ConditionalOperatorGreaterThan ConditionalOperator = "GreaterThan" + // ConditionalOperatorGreaterThanOrEqual ... + ConditionalOperatorGreaterThanOrEqual ConditionalOperator = "GreaterThanOrEqual" // ConditionalOperatorLessThan ... ConditionalOperatorLessThan ConditionalOperator = "LessThan" + // ConditionalOperatorLessThanOrEqual ... + ConditionalOperatorLessThanOrEqual ConditionalOperator = "LessThanOrEqual" ) // PossibleConditionalOperatorValues returns an array of possible values for the ConditionalOperator const type. func PossibleConditionalOperatorValues() []ConditionalOperator { - return []ConditionalOperator{ConditionalOperatorEqual, ConditionalOperatorGreaterThan, ConditionalOperatorLessThan} + return []ConditionalOperator{ConditionalOperatorEqual, ConditionalOperatorGreaterThan, ConditionalOperatorGreaterThanOrEqual, ConditionalOperatorLessThan, ConditionalOperatorLessThanOrEqual} } // ConditionOperator enumerates the values for condition operator. @@ -162,17 +204,17 @@ func PossibleDynamicThresholdOperatorValues() []DynamicThresholdOperator { type DynamicThresholdSensitivity string const ( - // High ... - High DynamicThresholdSensitivity = "High" - // Low ... - Low DynamicThresholdSensitivity = "Low" - // Medium ... - Medium DynamicThresholdSensitivity = "Medium" + // DynamicThresholdSensitivityHigh ... + DynamicThresholdSensitivityHigh DynamicThresholdSensitivity = "High" + // DynamicThresholdSensitivityLow ... + DynamicThresholdSensitivityLow DynamicThresholdSensitivity = "Low" + // DynamicThresholdSensitivityMedium ... + DynamicThresholdSensitivityMedium DynamicThresholdSensitivity = "Medium" ) // PossibleDynamicThresholdSensitivityValues returns an array of possible values for the DynamicThresholdSensitivity const type. func PossibleDynamicThresholdSensitivityValues() []DynamicThresholdSensitivity { - return []DynamicThresholdSensitivity{High, Low, Medium} + return []DynamicThresholdSensitivity{DynamicThresholdSensitivityHigh, DynamicThresholdSensitivityLow, DynamicThresholdSensitivityMedium} } // Enabled enumerates the values for enabled. @@ -211,12 +253,35 @@ func PossibleEventLevelValues() []EventLevel { return []EventLevel{Critical, Error, Informational, Verbose, Warning} } +// MetricClass enumerates the values for metric class. +type MetricClass string + +const ( + // Availability ... + Availability MetricClass = "Availability" + // Errors ... + Errors MetricClass = "Errors" + // Latency ... + Latency MetricClass = "Latency" + // Saturation ... + Saturation MetricClass = "Saturation" + // Transactions ... + Transactions MetricClass = "Transactions" +) + +// PossibleMetricClassValues returns an array of possible values for the MetricClass const type. +func PossibleMetricClassValues() []MetricClass { + return []MetricClass{Availability, Errors, Latency, Saturation, Transactions} +} + // MetricStatisticType enumerates the values for metric statistic type. type MetricStatisticType string const ( // MetricStatisticTypeAverage ... MetricStatisticTypeAverage MetricStatisticType = "Average" + // MetricStatisticTypeCount ... + MetricStatisticTypeCount MetricStatisticType = "Count" // MetricStatisticTypeMax ... MetricStatisticTypeMax MetricStatisticType = "Max" // MetricStatisticTypeMin ... @@ -227,7 +292,7 @@ const ( // PossibleMetricStatisticTypeValues returns an array of possible values for the MetricStatisticType const type. func PossibleMetricStatisticTypeValues() []MetricStatisticType { - return []MetricStatisticType{MetricStatisticTypeAverage, MetricStatisticTypeMax, MetricStatisticTypeMin, MetricStatisticTypeSum} + return []MetricStatisticType{MetricStatisticTypeAverage, MetricStatisticTypeCount, MetricStatisticTypeMax, MetricStatisticTypeMin, MetricStatisticTypeSum} } // MetricTriggerType enumerates the values for metric trigger type. @@ -245,6 +310,43 @@ func PossibleMetricTriggerTypeValues() []MetricTriggerType { return []MetricTriggerType{MetricTriggerTypeConsecutive, MetricTriggerTypeTotal} } +// MetricUnit enumerates the values for metric unit. +type MetricUnit string + +const ( + // MetricUnitBitsPerSecond ... + MetricUnitBitsPerSecond MetricUnit = "BitsPerSecond" + // MetricUnitBytes ... + MetricUnitBytes MetricUnit = "Bytes" + // MetricUnitByteSeconds ... + MetricUnitByteSeconds MetricUnit = "ByteSeconds" + // MetricUnitBytesPerSecond ... + MetricUnitBytesPerSecond MetricUnit = "BytesPerSecond" + // MetricUnitCores ... + MetricUnitCores MetricUnit = "Cores" + // MetricUnitCount ... + MetricUnitCount MetricUnit = "Count" + // MetricUnitCountPerSecond ... + MetricUnitCountPerSecond MetricUnit = "CountPerSecond" + // MetricUnitMilliCores ... + MetricUnitMilliCores MetricUnit = "MilliCores" + // MetricUnitMilliSeconds ... + MetricUnitMilliSeconds MetricUnit = "MilliSeconds" + // MetricUnitNanoCores ... + MetricUnitNanoCores MetricUnit = "NanoCores" + // MetricUnitPercent ... + MetricUnitPercent MetricUnit = "Percent" + // MetricUnitSeconds ... + MetricUnitSeconds MetricUnit = "Seconds" + // MetricUnitUnspecified ... + MetricUnitUnspecified MetricUnit = "Unspecified" +) + +// PossibleMetricUnitValues returns an array of possible values for the MetricUnit const type. +func PossibleMetricUnitValues() []MetricUnit { + return []MetricUnit{MetricUnitBitsPerSecond, MetricUnitBytes, MetricUnitByteSeconds, MetricUnitBytesPerSecond, MetricUnitCores, MetricUnitCount, MetricUnitCountPerSecond, MetricUnitMilliCores, MetricUnitMilliSeconds, MetricUnitNanoCores, MetricUnitPercent, MetricUnitSeconds, MetricUnitUnspecified} +} + // OdataType enumerates the values for odata type. type OdataType string @@ -348,13 +450,11 @@ const ( OperatorLessThan Operator = "LessThan" // OperatorLessThanOrEqual ... OperatorLessThanOrEqual Operator = "LessThanOrEqual" - // OperatorNotEquals ... - OperatorNotEquals Operator = "NotEquals" ) // PossibleOperatorValues returns an array of possible values for the Operator const type. func PossibleOperatorValues() []Operator { - return []Operator{OperatorEquals, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorLessThan, OperatorLessThanOrEqual, OperatorNotEquals} + return []Operator{OperatorEquals, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorLessThan, OperatorLessThanOrEqual} } // ProvisioningState enumerates the values for provisioning state. @@ -490,28 +590,13 @@ const ( ExactCount ScaleType = "ExactCount" // PercentChangeCount ... PercentChangeCount ScaleType = "PercentChangeCount" + // ServiceAllowedNextValue ... + ServiceAllowedNextValue ScaleType = "ServiceAllowedNextValue" ) // PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. func PossibleScaleTypeValues() []ScaleType { - return []ScaleType{ChangeCount, ExactCount, PercentChangeCount} -} - -// Sensitivity enumerates the values for sensitivity. -type Sensitivity string - -const ( - // SensitivityHigh ... - SensitivityHigh Sensitivity = "High" - // SensitivityLow ... - SensitivityLow Sensitivity = "Low" - // SensitivityMedium ... - SensitivityMedium Sensitivity = "Medium" -) - -// PossibleSensitivityValues returns an array of possible values for the Sensitivity const type. -func PossibleSensitivityValues() []Sensitivity { - return []Sensitivity{SensitivityHigh, SensitivityLow, SensitivityMedium} + return []ScaleType{ChangeCount, ExactCount, PercentChangeCount, ServiceAllowedNextValue} } // TimeAggregationOperator enumerates the values for time aggregation operator. @@ -557,40 +642,3 @@ const ( func PossibleTimeAggregationTypeValues() []TimeAggregationType { return []TimeAggregationType{TimeAggregationTypeAverage, TimeAggregationTypeCount, TimeAggregationTypeLast, TimeAggregationTypeMaximum, TimeAggregationTypeMinimum, TimeAggregationTypeTotal} } - -// Unit enumerates the values for unit. -type Unit string - -const ( - // UnitBitsPerSecond ... - UnitBitsPerSecond Unit = "BitsPerSecond" - // UnitBytes ... - UnitBytes Unit = "Bytes" - // UnitByteSeconds ... - UnitByteSeconds Unit = "ByteSeconds" - // UnitBytesPerSecond ... - UnitBytesPerSecond Unit = "BytesPerSecond" - // UnitCores ... - UnitCores Unit = "Cores" - // UnitCount ... - UnitCount Unit = "Count" - // UnitCountPerSecond ... - UnitCountPerSecond Unit = "CountPerSecond" - // UnitMilliCores ... - UnitMilliCores Unit = "MilliCores" - // UnitMilliSeconds ... - UnitMilliSeconds Unit = "MilliSeconds" - // UnitNanoCores ... - UnitNanoCores Unit = "NanoCores" - // UnitPercent ... - UnitPercent Unit = "Percent" - // UnitSeconds ... - UnitSeconds Unit = "Seconds" - // UnitUnspecified ... - UnitUnspecified Unit = "Unspecified" -) - -// PossibleUnitValues returns an array of possible values for the Unit const type. -func PossibleUnitValues() []Unit { - return []Unit{UnitBitsPerSecond, UnitBytes, UnitByteSeconds, UnitBytesPerSecond, UnitCores, UnitCount, UnitCountPerSecond, UnitMilliCores, UnitMilliSeconds, UnitNanoCores, UnitPercent, UnitSeconds, UnitUnspecified} -} diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/eventcategories.go b/services/preview/monitor/mgmt/2018-09-01/insights/eventcategories.go index 86e59b424363..f43c5468ac51 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/eventcategories.go +++ b/services/preview/monitor/mgmt/2018-09-01/insights/eventcategories.go @@ -75,7 +75,7 @@ func (client EventCategoriesClient) ListPreparer(ctx context.Context) (*http.Req preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventcategories"), + autorest.WithPath("/providers/Microsoft.Insights/eventcategories"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/insightsapi/interfaces.go b/services/preview/monitor/mgmt/2018-09-01/insights/insightsapi/interfaces.go index 84152c80c3ca..33aa44690b15 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/insightsapi/interfaces.go +++ b/services/preview/monitor/mgmt/2018-09-01/insights/insightsapi/interfaces.go @@ -144,14 +144,6 @@ type MetricsClientAPI interface { var _ MetricsClientAPI = (*insights.MetricsClient)(nil) -// MetricBaselineClientAPI contains the set of methods on the MetricBaselineClient type. -type MetricBaselineClientAPI interface { - CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation insights.TimeSeriesInformation) (result insights.CalculateBaselineResponse, err error) - Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType insights.ResultType) (result insights.BaselineResponse, err error) -} - -var _ MetricBaselineClientAPI = (*insights.MetricBaselineClient)(nil) - // MetricAlertsClientAPI contains the set of methods on the MetricAlertsClient type. type MetricAlertsClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.MetricAlertResource) (result insights.MetricAlertResource, err error) @@ -184,9 +176,9 @@ type ScheduledQueryRulesClientAPI interface { var _ ScheduledQueryRulesClientAPI = (*insights.ScheduledQueryRulesClient)(nil) -// MetricNamespacesClientAPI contains the set of methods on the MetricNamespacesClient type. -type MetricNamespacesClientAPI interface { - List(ctx context.Context, resourceURI string, startTime string) (result insights.MetricNamespaceCollection, err error) +// BaselinesClientAPI contains the set of methods on the BaselinesClient type. +type BaselinesClientAPI interface { + List(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType insights.ResultType) (result insights.MetricBaselinesResponse, err error) } -var _ MetricNamespacesClientAPI = (*insights.MetricNamespacesClient)(nil) +var _ BaselinesClientAPI = (*insights.BaselinesClient)(nil) diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/logprofiles.go b/services/preview/monitor/mgmt/2018-09-01/insights/logprofiles.go index ad1500b87bc9..cfa5e8be2997 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/logprofiles.go +++ b/services/preview/monitor/mgmt/2018-09-01/insights/logprofiles.go @@ -56,7 +56,9 @@ func (client LogProfilesClient) CreateOrUpdate(ctx context.Context, logProfileNa {Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, }}, - }}}}}); err != nil { + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.LogProfilesClient", "CreateOrUpdate", err.Error()) } @@ -98,7 +100,7 @@ func (client LogProfilesClient) CreateOrUpdatePreparer(ctx context.Context, logP autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -136,6 +138,12 @@ func (client LogProfilesClient) Delete(ctx context.Context, logProfileName strin tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, logProfileName) if err != nil { err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", nil, "Failure preparing request") @@ -173,7 +181,7 @@ func (client LogProfilesClient) DeletePreparer(ctx context.Context, logProfileNa preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -209,6 +217,12 @@ func (client LogProfilesClient) Get(ctx context.Context, logProfileName string) tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, logProfileName) if err != nil { err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Get", nil, "Failure preparing request") @@ -246,7 +260,7 @@ func (client LogProfilesClient) GetPreparer(ctx context.Context, logProfileName preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -281,6 +295,12 @@ func (client LogProfilesClient) List(ctx context.Context) (result LogProfileColl tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "List", err.Error()) + } + req, err := client.ListPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "List", nil, "Failure preparing request") @@ -317,7 +337,7 @@ func (client LogProfilesClient) ListPreparer(ctx context.Context) (*http.Request preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -355,6 +375,12 @@ func (client LogProfilesClient) Update(ctx context.Context, logProfileName strin tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, logProfileName, logProfilesResource) if err != nil { err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Update", nil, "Failure preparing request") @@ -393,7 +419,7 @@ func (client LogProfilesClient) UpdatePreparer(ctx context.Context, logProfileNa autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithJSON(logProfilesResource), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/metricalerts.go b/services/preview/monitor/mgmt/2018-09-01/insights/metricalerts.go index 94231b6fa34e..f9706664d9be 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/metricalerts.go +++ b/services/preview/monitor/mgmt/2018-09-01/insights/metricalerts.go @@ -33,7 +33,7 @@ func NewMetricAlertsClientWithBaseURI(baseURI string, subscriptionID string) Met // CreateOrUpdate create or update an metric alert definition. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to create or update. func (client MetricAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource) (result MetricAlertResource, err error) { @@ -48,11 +48,16 @@ func (client MetricAlertsClient) CreateOrUpdate(ctx context.Context, resourceGro }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.MetricAlertProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.MetricAlertProperties.Description", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.Severity", Name: validation.Null, Rule: true, Chain: nil}, + Chain: []validation.Constraint{{Target: "parameters.MetricAlertProperties.Severity", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.MetricAlertProperties.Enabled", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.MetricAlertProperties.Scopes", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.MetricAlertProperties.EvaluationFrequency", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.MetricAlertProperties.WindowSize", Name: validation.Null, Rule: true, Chain: nil}, }}}}}); err != nil { @@ -124,7 +129,7 @@ func (client MetricAlertsClient) CreateOrUpdateResponder(resp *http.Response) (r // Delete delete an alert rule definition. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client MetricAlertsClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -137,6 +142,15 @@ func (client MetricAlertsClient) Delete(ctx context.Context, resourceGroupName s tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", nil, "Failure preparing request") @@ -199,7 +213,7 @@ func (client MetricAlertsClient) DeleteResponder(resp *http.Response) (result au // Get retrieve an alert rule definition. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client MetricAlertsClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertResource, err error) { if tracing.IsEnabled() { @@ -212,6 +226,15 @@ func (client MetricAlertsClient) Get(ctx context.Context, resourceGroupName stri tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Get", nil, "Failure preparing request") @@ -275,7 +298,7 @@ func (client MetricAlertsClient) GetResponder(resp *http.Response) (result Metri // ListByResourceGroup retrieve alert rule definitions in a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client MetricAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result MetricAlertResourceCollection, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.ListByResourceGroup") @@ -287,6 +310,15 @@ func (client MetricAlertsClient) ListByResourceGroup(ctx context.Context, resour tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -359,6 +391,12 @@ func (client MetricAlertsClient) ListBySubscription(ctx context.Context) (result tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "ListBySubscription", err.Error()) + } + req, err := client.ListBySubscriptionPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", nil, "Failure preparing request") @@ -420,7 +458,7 @@ func (client MetricAlertsClient) ListBySubscriptionResponder(resp *http.Response // Update update an metric alert definition. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to update. func (client MetricAlertsClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch) (result MetricAlertResource, err error) { @@ -434,6 +472,15 @@ func (client MetricAlertsClient) Update(ctx context.Context, resourceGroupName s tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Update", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/metricalertsstatus.go b/services/preview/monitor/mgmt/2018-09-01/insights/metricalertsstatus.go index 43cfaed42765..4709142160be 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/metricalertsstatus.go +++ b/services/preview/monitor/mgmt/2018-09-01/insights/metricalertsstatus.go @@ -10,6 +10,7 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" "net/http" ) @@ -33,7 +34,7 @@ func NewMetricAlertsStatusClientWithBaseURI(baseURI string, subscriptionID strin // List retrieve an alert rule status. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client MetricAlertsStatusClient) List(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertStatusCollection, err error) { if tracing.IsEnabled() { @@ -46,6 +47,15 @@ func (client MetricAlertsStatusClient) List(ctx context.Context, resourceGroupNa tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsStatusClient", "List", err.Error()) + } + req, err := client.ListPreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "List", nil, "Failure preparing request") @@ -109,7 +119,7 @@ func (client MetricAlertsStatusClient) ListResponder(resp *http.Response) (resul // ListByName retrieve an alert rule status. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // statusName - the name of the status. func (client MetricAlertsStatusClient) ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (result MetricAlertStatusCollection, err error) { @@ -123,6 +133,15 @@ func (client MetricAlertsStatusClient) ListByName(ctx context.Context, resourceG tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsStatusClient", "ListByName", err.Error()) + } + req, err := client.ListByNamePreparer(ctx, resourceGroupName, ruleName, statusName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/metricbaseline.go b/services/preview/monitor/mgmt/2018-09-01/insights/metricbaseline.go deleted file mode 100644 index d395fc67bc59..000000000000 --- a/services/preview/monitor/mgmt/2018-09-01/insights/metricbaseline.go +++ /dev/null @@ -1,217 +0,0 @@ -package insights - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// MetricBaselineClient is the monitor Management Client -type MetricBaselineClient struct { - BaseClient -} - -// NewMetricBaselineClient creates an instance of the MetricBaselineClient client. -func NewMetricBaselineClient(subscriptionID string) MetricBaselineClient { - return NewMetricBaselineClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricBaselineClientWithBaseURI creates an instance of the MetricBaselineClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewMetricBaselineClientWithBaseURI(baseURI string, subscriptionID string) MetricBaselineClient { - return MetricBaselineClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CalculateBaseline **Lists the baseline values for a resource**. -// Parameters: -// resourceURI - 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 -// timeSeriesInformation - information that need to be specified to calculate a baseline on a time series. -func (client MetricBaselineClient) CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (result CalculateBaselineResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricBaselineClient.CalculateBaseline") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: timeSeriesInformation, - Constraints: []validation.Constraint{{Target: "timeSeriesInformation.Sensitivities", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "timeSeriesInformation.Values", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.MetricBaselineClient", "CalculateBaseline", err.Error()) - } - - req, err := client.CalculateBaselinePreparer(ctx, resourceURI, timeSeriesInformation) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", nil, "Failure preparing request") - return - } - - resp, err := client.CalculateBaselineSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure sending request") - return - } - - result, err = client.CalculateBaselineResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure responding to request") - return - } - - return -} - -// CalculateBaselinePreparer prepares the CalculateBaseline request. -func (client MetricBaselineClient) CalculateBaselinePreparer(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/calculatebaseline", pathParameters), - autorest.WithJSON(timeSeriesInformation), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CalculateBaselineSender sends the CalculateBaseline request. The method will close the -// http.Response Body if it receives an error. -func (client MetricBaselineClient) CalculateBaselineSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CalculateBaselineResponder handles the response to the CalculateBaseline request. The method always -// closes the http.Response Body. -func (client MetricBaselineClient) CalculateBaselineResponder(resp *http.Response) (result CalculateBaselineResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get **Gets the baseline values for a specific metric**. -// Parameters: -// resourceURI - 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 -// metricName - the name of the metric to retrieve the baseline for. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// aggregation - the aggregation type of the metric to retrieve the baseline for. -// sensitivities - the list of sensitivities (comma separated) to retrieve. -// resultType - allows retrieving only metadata of the baseline. On data request all information is retrieved. -func (client MetricBaselineClient) Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (result BaselineResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricBaselineClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceURI, metricName, timespan, interval, aggregation, sensitivities, resultType) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client MetricBaselineClient) GetPreparer(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "metricName": autorest.Encode("path", metricName), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if len(sensitivities) > 0 { - queryParameters["sensitivities"] = autorest.Encode("query", sensitivities) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/baseline/{metricName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client MetricBaselineClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client MetricBaselineClient) GetResponder(resp *http.Response) (result BaselineResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/metricdefinitions.go b/services/preview/monitor/mgmt/2018-09-01/insights/metricdefinitions.go index 69fc2e0b465a..c316b154fe7e 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/metricdefinitions.go +++ b/services/preview/monitor/mgmt/2018-09-01/insights/metricdefinitions.go @@ -85,7 +85,7 @@ func (client MetricDefinitionsClient) ListPreparer(ctx context.Context, resource preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricDefinitions", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metricDefinitions", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/metrics.go b/services/preview/monitor/mgmt/2018-09-01/insights/metrics.go index 97687a09b498..f2329253c944 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/metrics.go +++ b/services/preview/monitor/mgmt/2018-09-01/insights/metrics.go @@ -36,7 +36,8 @@ func NewMetricsClientWithBaseURI(baseURI string, subscriptionID string) MetricsC // timespan - the timespan of the query. It is a string with the following format // 'startDateTime_ISO/endDateTime_ISO'. // interval - the interval (i.e. timegrain) of the query. -// metricnames - the names of the metrics (comma separated) to retrieve. +// metricnames - the names of the metrics (comma separated) to retrieve. Special case: If a metricname itself +// has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be **'Metric%2Name1'** // aggregation - the list of aggregation types (comma separated) to retrieve. // top - the maximum number of records to retrieve. // Valid only if $filter is specified. @@ -44,13 +45,16 @@ func NewMetricsClientWithBaseURI(baseURI string, subscriptionID string) MetricsC // orderby - the aggregation to use for sorting results and the direction of the sort. // Only one order can be specified. // Examples: sum asc. -// 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 -// ‘*’**. +// 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 '*'**. Special case: When +// dimension name or dimension value uses round brackets. Eg: When dimension name is **dim (test) 1** Instead +// of using $filter= "dim (test) 1 eq '*' " use **$filter= "dim %2528test%2529 1 eq '*' "** When dimension name +// is **dim (test) 3** and dimension value is **dim3 (test) val** Instead of using $filter= "dim (test) 3 eq +// 'dim3 (test) val' " use **$filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "** // resultType - reduces the set of data collected. The syntax allowed depends on the operation. See the // operation's description for details. // metricnamespace - metric namespace to query metric definitions for. @@ -128,7 +132,7 @@ func (client MetricsClient) ListPreparer(ctx context.Context, resourceURI string preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metrics", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metrics", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/models.go b/services/preview/monitor/mgmt/2018-09-01/insights/models.go index 9776717b154a..91c9b5e127b2 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/models.go +++ b/services/preview/monitor/mgmt/2018-09-01/insights/models.go @@ -214,6 +214,10 @@ type ActionGroupResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for ActionGroupResource. @@ -294,6 +298,24 @@ func (agr *ActionGroupResource) UnmarshalJSON(body []byte) error { } agr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + agr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agr.Etag = &etag + } } } @@ -439,6 +461,10 @@ type ActivityLogAlertResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for ActivityLogAlertResource. @@ -519,6 +545,24 @@ func (alar *ActivityLogAlertResource) UnmarshalJSON(body []byte) error { } alar.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + alar.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + alar.Etag = &etag + } } } @@ -587,10 +631,14 @@ type AlertRule struct { Name *string `json:"name,omitempty"` // Description - the description of the alert rule that will be included in the alert email. Description *string `json:"description,omitempty"` + // ProvisioningState - the provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` // IsEnabled - the flag that indicates whether the alert rule is enabled. IsEnabled *bool `json:"isEnabled,omitempty"` // Condition - the condition that results in the alert rule being activated. Condition BasicRuleCondition `json:"condition,omitempty"` + // Action - action that is performed when the alert rule becomes active, and when an alert condition is resolved. + Action BasicRuleAction `json:"action,omitempty"` // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. Actions *[]BasicRuleAction `json:"actions,omitempty"` // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. @@ -606,10 +654,14 @@ func (ar AlertRule) MarshalJSON() ([]byte, error) { if ar.Description != nil { objectMap["description"] = ar.Description } + if ar.ProvisioningState != nil { + objectMap["provisioningState"] = ar.ProvisioningState + } if ar.IsEnabled != nil { objectMap["isEnabled"] = ar.IsEnabled } objectMap["condition"] = ar.Condition + objectMap["action"] = ar.Action if ar.Actions != nil { objectMap["actions"] = ar.Actions } @@ -643,6 +695,15 @@ func (ar *AlertRule) UnmarshalJSON(body []byte) error { } ar.Description = &description } + case "provisioningState": + if v != nil { + var provisioningState string + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + ar.ProvisioningState = &provisioningState + } case "isEnabled": if v != nil { var isEnabled bool @@ -660,6 +721,14 @@ func (ar *AlertRule) UnmarshalJSON(body []byte) error { } ar.Condition = condition } + case "action": + if v != nil { + action, err := unmarshalBasicRuleAction(*v) + if err != nil { + return err + } + ar.Action = action + } case "actions": if v != nil { actions, err := unmarshalBasicRuleActionArray(*v) @@ -698,6 +767,10 @@ type AlertRuleResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for AlertRuleResource. @@ -778,6 +851,24 @@ func (arr *AlertRuleResource) UnmarshalJSON(body []byte) error { } arr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + arr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + arr.Etag = &etag + } } } @@ -905,6 +996,8 @@ type AutoscaleSetting struct { Name *string `json:"name,omitempty"` // TargetResourceURI - the resource identifier of the resource that the autoscale setting should be added to. TargetResourceURI *string `json:"targetResourceUri,omitempty"` + // TargetResourceLocation - the location of the resource that the autoscale setting should be added to. + TargetResourceLocation *string `json:"targetResourceLocation,omitempty"` } // AutoscaleSettingResource the autoscale setting resource. @@ -922,6 +1015,10 @@ type AutoscaleSettingResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for AutoscaleSettingResource. @@ -1002,6 +1099,24 @@ func (asr *AutoscaleSettingResource) UnmarshalJSON(body []byte) error { } asr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + asr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + asr.Etag = &etag + } } } @@ -1251,124 +1366,14 @@ type AzureFunctionReceiver struct { HTTPTriggerURL *string `json:"httpTriggerUrl,omitempty"` } -// Baseline the baseline values for a single sensitivity value. -type Baseline struct { - // Sensitivity - the sensitivity of the baseline. Possible values include: 'SensitivityLow', 'SensitivityMedium', 'SensitivityHigh' - Sensitivity Sensitivity `json:"sensitivity,omitempty"` - // LowThresholds - The low thresholds of the baseline. - LowThresholds *[]float64 `json:"lowThresholds,omitempty"` - // HighThresholds - The high thresholds of the baseline. - HighThresholds *[]float64 `json:"highThresholds,omitempty"` -} - -// BaselineMetadataValue represents a baseline metadata value. -type BaselineMetadataValue struct { - // Name - the name of the metadata. - Name *LocalizableString `json:"name,omitempty"` - // Value - the value of the metadata. +// BaselineMetadata represents a baseline metadata value. +type BaselineMetadata struct { + // Name - Name of the baseline metadata. + Name *string `json:"name,omitempty"` + // Value - Value of the baseline metadata. Value *string `json:"value,omitempty"` } -// BaselineProperties the baseline properties class. -type BaselineProperties struct { - // 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. - Timespan *string `json:"timespan,omitempty"` - // 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. - Interval *string `json:"interval,omitempty"` - // Aggregation - The aggregation type of the metric. - Aggregation *string `json:"aggregation,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Baseline - the baseline values for each sensitivity. - Baseline *[]Baseline `json:"baseline,omitempty"` - // Metadata - the baseline metadata values. - Metadata *[]BaselineMetadataValue `json:"metadata,omitempty"` -} - -// BaselineResponse the response to a baseline query. -type BaselineResponse struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; the metric baseline Id. - ID *string `json:"id,omitempty"` - // Type - READ-ONLY; the resource type of the baseline resource. - Type *string `json:"type,omitempty"` - // Name - READ-ONLY; the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString `json:"name,omitempty"` - // BaselineProperties - the properties of the baseline. - *BaselineProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for BaselineResponse. -func (br BaselineResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if br.BaselineProperties != nil { - objectMap["properties"] = br.BaselineProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BaselineResponse struct. -func (br *BaselineResponse) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - br.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - br.Type = &typeVar - } - case "name": - if v != nil { - var name LocalizableString - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - br.Name = &name - } - case "properties": - if v != nil { - var baselineProperties BaselineProperties - err = json.Unmarshal(*v, &baselineProperties) - if err != nil { - return err - } - br.BaselineProperties = &baselineProperties - } - } - } - - return nil -} - -// CalculateBaselineResponse the response to a calculate baseline call. -type CalculateBaselineResponse struct { - autorest.Response `json:"-"` - // Type - the resource type of the baseline resource. - Type *string `json:"type,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Baseline - the baseline values for each sensitivity. - Baseline *[]Baseline `json:"baseline,omitempty"` -} - // Criteria specifies the criteria for converting log to metric. type Criteria struct { // MetricName - Name of the metric @@ -1578,7 +1583,7 @@ type Dimension struct { type DynamicMetricCriteria struct { // Operator - The operator used to compare the metric value against the threshold. Possible values include: 'DynamicThresholdOperatorGreaterThan', 'DynamicThresholdOperatorLessThan', 'DynamicThresholdOperatorGreaterOrLessThan' Operator DynamicThresholdOperator `json:"operator,omitempty"` - // AlertSensitivity - The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern. Possible values include: 'Low', 'Medium', 'High' + // AlertSensitivity - The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern. Possible values include: 'DynamicThresholdSensitivityLow', 'DynamicThresholdSensitivityMedium', 'DynamicThresholdSensitivityHigh' AlertSensitivity DynamicThresholdSensitivity `json:"alertSensitivity,omitempty"` // FailingPeriods - The minimum number of violations required within the selected lookback time window required to raise an alert. FailingPeriods *DynamicThresholdFailingPeriods `json:"failingPeriods,omitempty"` @@ -1592,8 +1597,8 @@ type DynamicMetricCriteria struct { MetricName *string `json:"metricName,omitempty"` // MetricNamespace - Namespace of the metric. MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` + // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' + TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` // Dimensions - List of dimension conditions. Dimensions *[]MetricDimension `json:"dimensions,omitempty"` // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. @@ -1627,7 +1632,7 @@ func (dmc DynamicMetricCriteria) MarshalJSON() ([]byte, error) { if dmc.MetricNamespace != nil { objectMap["metricNamespace"] = dmc.MetricNamespace } - if dmc.TimeAggregation != nil { + if dmc.TimeAggregation != "" { objectMap["timeAggregation"] = dmc.TimeAggregation } if dmc.Dimensions != nil { @@ -1751,7 +1756,7 @@ func (dmc *DynamicMetricCriteria) UnmarshalJSON(body []byte) error { } case "timeAggregation": if v != nil { - var timeAggregation interface{} + var timeAggregation AggregationTypeEnum err = json.Unmarshal(*v, &timeAggregation) if err != nil { return err @@ -1838,6 +1843,12 @@ type EnableRequest struct { ReceiverName *string `json:"receiverName,omitempty"` } +// ErrorContract describes the format of Error response. +type ErrorContract struct { + // Error - The error details. + Error *ErrorResponse `json:"error,omitempty"` +} + // ErrorResponse describes the format of Error response. type ErrorResponse struct { // Code - Error code @@ -2249,7 +2260,7 @@ type LogicAppReceiver struct { // LogMetricTrigger a log metrics trigger descriptor. type LogMetricTrigger struct { - // ThresholdOperator - Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' + // ThresholdOperator - Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'ConditionalOperatorGreaterThanOrEqual', 'ConditionalOperatorLessThanOrEqual', 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` // Threshold - The threshold of the metric trigger. Threshold *float64 `json:"threshold,omitempty"` @@ -2295,6 +2306,10 @@ type LogProfileResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for LogProfileResource. @@ -2375,6 +2390,24 @@ func (lpr *LogProfileResource) UnmarshalJSON(body []byte) error { } lpr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + lpr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + lpr.Etag = &etag + } } } @@ -2436,8 +2469,16 @@ func (lprp *LogProfileResourcePatch) UnmarshalJSON(body []byte) error { // LogSearchRule log Search Rule Definition type LogSearchRule struct { + // CreatedWithAPIVersion - READ-ONLY; The api-version used when creating this alert rule + CreatedWithAPIVersion *string `json:"createdWithApiVersion,omitempty"` + // IsLegacyLogAnalyticsRule - READ-ONLY; True if alert rule is legacy Log Analytic rule + IsLegacyLogAnalyticsRule *bool `json:"isLegacyLogAnalyticsRule,omitempty"` // Description - The description of the Log Search rule. Description *string `json:"description,omitempty"` + // DisplayName - The display name of the alert rule + DisplayName *string `json:"displayName,omitempty"` + // AutoMitigate - The flag that indicates whether the alert should be automatically resolved or not. The default is false. + AutoMitigate *bool `json:"autoMitigate,omitempty"` // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'True', 'False' Enabled Enabled `json:"enabled,omitempty"` // LastUpdatedTime - READ-ONLY; Last time the rule was updated in IS08601 format. @@ -2458,6 +2499,12 @@ func (lsr LogSearchRule) MarshalJSON() ([]byte, error) { if lsr.Description != nil { objectMap["description"] = lsr.Description } + if lsr.DisplayName != nil { + objectMap["displayName"] = lsr.DisplayName + } + if lsr.AutoMitigate != nil { + objectMap["autoMitigate"] = lsr.AutoMitigate + } if lsr.Enabled != "" { objectMap["enabled"] = lsr.Enabled } @@ -2480,6 +2527,24 @@ func (lsr *LogSearchRule) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { + case "createdWithApiVersion": + if v != nil { + var createdWithAPIVersion string + err = json.Unmarshal(*v, &createdWithAPIVersion) + if err != nil { + return err + } + lsr.CreatedWithAPIVersion = &createdWithAPIVersion + } + case "isLegacyLogAnalyticsRule": + if v != nil { + var isLegacyLogAnalyticsRule bool + err = json.Unmarshal(*v, &isLegacyLogAnalyticsRule) + if err != nil { + return err + } + lsr.IsLegacyLogAnalyticsRule = &isLegacyLogAnalyticsRule + } case "description": if v != nil { var description string @@ -2489,6 +2554,24 @@ func (lsr *LogSearchRule) UnmarshalJSON(body []byte) error { } lsr.Description = &description } + case "displayName": + if v != nil { + var displayName string + err = json.Unmarshal(*v, &displayName) + if err != nil { + return err + } + lsr.DisplayName = &displayName + } + case "autoMitigate": + if v != nil { + var autoMitigate bool + err = json.Unmarshal(*v, &autoMitigate) + if err != nil { + return err + } + lsr.AutoMitigate = &autoMitigate + } case "enabled": if v != nil { var enabled Enabled @@ -2569,6 +2652,10 @@ type LogSearchRuleResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for LogSearchRuleResource. @@ -2649,6 +2736,24 @@ func (lsrr *LogSearchRuleResource) UnmarshalJSON(body []byte) error { } lsrr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + lsrr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + lsrr.Etag = &etag + } } } @@ -2882,8 +2987,14 @@ type Metric struct { Type *string `json:"type,omitempty"` // Name - the name and the display name of the metric, i.e. it is localizable string. Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' - Unit Unit `json:"unit,omitempty"` + // DisplayDescription - Detailed description of this metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + // ErrorCode - 'Success' or the error details on query failures for this metric. + ErrorCode *string `json:"errorCode,omitempty"` + // ErrorMessage - Error message encountered querying this specific metric. + ErrorMessage *string `json:"errorMessage,omitempty"` + // Unit - The unit of the metric. Possible values include: 'MetricUnitCount', 'MetricUnitBytes', 'MetricUnitSeconds', 'MetricUnitCountPerSecond', 'MetricUnitBytesPerSecond', 'MetricUnitPercent', 'MetricUnitMilliSeconds', 'MetricUnitByteSeconds', 'MetricUnitUnspecified', 'MetricUnitCores', 'MetricUnitMilliCores', 'MetricUnitNanoCores', 'MetricUnitBitsPerSecond' + Unit MetricUnit `json:"unit,omitempty"` // Timeseries - the time series returned when a data query is performed. Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"` } @@ -2892,7 +3003,7 @@ type Metric struct { type MetricAlertAction struct { // ActionGroupID - the id of the action group to use. ActionGroupID *string `json:"actionGroupId,omitempty"` - // WebHookProperties - The properties of a webhook object. + // WebHookProperties - This field allows specifying custom properties, which would be appended to the alert payload sent as input to the webhook. WebHookProperties map[string]*string `json:"webHookProperties"` } @@ -3153,9 +3264,9 @@ type MetricAlertProperties struct { EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. WindowSize *string `json:"windowSize,omitempty"` - // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource. TargetResourceType *string `json:"targetResourceType,omitempty"` - // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource. TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` // Criteria - defines the specific alert criteria information. Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` @@ -3165,6 +3276,8 @@ type MetricAlertProperties struct { Actions *[]MetricAlertAction `json:"actions,omitempty"` // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` + // IsMigrated - READ-ONLY; the value indicating whether this alert rule is migrated. + IsMigrated *bool `json:"isMigrated,omitempty"` } // MarshalJSON is the custom marshaler for MetricAlertProperties. @@ -3320,6 +3433,213 @@ func (mapVar *MetricAlertProperties) UnmarshalJSON(body []byte) error { } mapVar.LastUpdatedTime = &lastUpdatedTime } + case "isMigrated": + if v != nil { + var isMigrated bool + err = json.Unmarshal(*v, &isMigrated) + if err != nil { + return err + } + mapVar.IsMigrated = &isMigrated + } + } + } + + return nil +} + +// MetricAlertPropertiesPatch an alert rule properties for patch. +type MetricAlertPropertiesPatch struct { + // Description - the description of the metric alert that will be included in the alert email. + Description *string `json:"description,omitempty"` + // Severity - Alert severity {0, 1, 2, 3, 4} + Severity *int32 `json:"severity,omitempty"` + // Enabled - the flag that indicates whether the metric alert is enabled. + Enabled *bool `json:"enabled,omitempty"` + // Scopes - the list of resource id's that this metric alert is scoped to. + Scopes *[]string `json:"scopes,omitempty"` + // EvaluationFrequency - how often the metric alert is evaluated represented in ISO 8601 duration format. + EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` + // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. + WindowSize *string `json:"windowSize,omitempty"` + // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + TargetResourceType *string `json:"targetResourceType,omitempty"` + // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` + // Criteria - defines the specific alert criteria information. + Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` + // AutoMitigate - the flag that indicates whether the alert should be auto resolved or not. The default is true. + AutoMitigate *bool `json:"autoMitigate,omitempty"` + // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + Actions *[]MetricAlertAction `json:"actions,omitempty"` + // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. + LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` + // IsMigrated - READ-ONLY; the value indicating whether this alert rule is migrated. + IsMigrated *bool `json:"isMigrated,omitempty"` +} + +// MarshalJSON is the custom marshaler for MetricAlertPropertiesPatch. +func (mapp MetricAlertPropertiesPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mapp.Description != nil { + objectMap["description"] = mapp.Description + } + if mapp.Severity != nil { + objectMap["severity"] = mapp.Severity + } + if mapp.Enabled != nil { + objectMap["enabled"] = mapp.Enabled + } + if mapp.Scopes != nil { + objectMap["scopes"] = mapp.Scopes + } + if mapp.EvaluationFrequency != nil { + objectMap["evaluationFrequency"] = mapp.EvaluationFrequency + } + if mapp.WindowSize != nil { + objectMap["windowSize"] = mapp.WindowSize + } + if mapp.TargetResourceType != nil { + objectMap["targetResourceType"] = mapp.TargetResourceType + } + if mapp.TargetResourceRegion != nil { + objectMap["targetResourceRegion"] = mapp.TargetResourceRegion + } + objectMap["criteria"] = mapp.Criteria + if mapp.AutoMitigate != nil { + objectMap["autoMitigate"] = mapp.AutoMitigate + } + if mapp.Actions != nil { + objectMap["actions"] = mapp.Actions + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MetricAlertPropertiesPatch struct. +func (mapp *MetricAlertPropertiesPatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + mapp.Description = &description + } + case "severity": + if v != nil { + var severity int32 + err = json.Unmarshal(*v, &severity) + if err != nil { + return err + } + mapp.Severity = &severity + } + case "enabled": + if v != nil { + var enabled bool + err = json.Unmarshal(*v, &enabled) + if err != nil { + return err + } + mapp.Enabled = &enabled + } + case "scopes": + if v != nil { + var scopes []string + err = json.Unmarshal(*v, &scopes) + if err != nil { + return err + } + mapp.Scopes = &scopes + } + case "evaluationFrequency": + if v != nil { + var evaluationFrequency string + err = json.Unmarshal(*v, &evaluationFrequency) + if err != nil { + return err + } + mapp.EvaluationFrequency = &evaluationFrequency + } + case "windowSize": + if v != nil { + var windowSize string + err = json.Unmarshal(*v, &windowSize) + if err != nil { + return err + } + mapp.WindowSize = &windowSize + } + case "targetResourceType": + if v != nil { + var targetResourceType string + err = json.Unmarshal(*v, &targetResourceType) + if err != nil { + return err + } + mapp.TargetResourceType = &targetResourceType + } + case "targetResourceRegion": + if v != nil { + var targetResourceRegion string + err = json.Unmarshal(*v, &targetResourceRegion) + if err != nil { + return err + } + mapp.TargetResourceRegion = &targetResourceRegion + } + case "criteria": + if v != nil { + criteria, err := unmarshalBasicMetricAlertCriteria(*v) + if err != nil { + return err + } + mapp.Criteria = criteria + } + case "autoMitigate": + if v != nil { + var autoMitigate bool + err = json.Unmarshal(*v, &autoMitigate) + if err != nil { + return err + } + mapp.AutoMitigate = &autoMitigate + } + case "actions": + if v != nil { + var actions []MetricAlertAction + err = json.Unmarshal(*v, &actions) + if err != nil { + return err + } + mapp.Actions = &actions + } + case "lastUpdatedTime": + if v != nil { + var lastUpdatedTime date.Time + err = json.Unmarshal(*v, &lastUpdatedTime) + if err != nil { + return err + } + mapp.LastUpdatedTime = &lastUpdatedTime + } + case "isMigrated": + if v != nil { + var isMigrated bool + err = json.Unmarshal(*v, &isMigrated) + if err != nil { + return err + } + mapp.IsMigrated = &isMigrated + } } } @@ -3341,6 +3661,10 @@ type MetricAlertResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for MetricAlertResource. @@ -3421,6 +3745,24 @@ func (mar *MetricAlertResource) UnmarshalJSON(body []byte) error { } mar.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + mar.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + mar.Etag = &etag + } } } @@ -3438,8 +3780,8 @@ type MetricAlertResourceCollection struct { type MetricAlertResourcePatch struct { // Tags - Resource tags Tags map[string]*string `json:"tags"` - // MetricAlertProperties - The alert rule properties of the resource. - *MetricAlertProperties `json:"properties,omitempty"` + // MetricAlertPropertiesPatch - The alert rule properties of the resource. + *MetricAlertPropertiesPatch `json:"properties,omitempty"` } // MarshalJSON is the custom marshaler for MetricAlertResourcePatch. @@ -3448,8 +3790,8 @@ func (marp MetricAlertResourcePatch) MarshalJSON() ([]byte, error) { if marp.Tags != nil { objectMap["tags"] = marp.Tags } - if marp.MetricAlertProperties != nil { - objectMap["properties"] = marp.MetricAlertProperties + if marp.MetricAlertPropertiesPatch != nil { + objectMap["properties"] = marp.MetricAlertPropertiesPatch } return json.Marshal(objectMap) } @@ -3474,12 +3816,12 @@ func (marp *MetricAlertResourcePatch) UnmarshalJSON(body []byte) error { } case "properties": if v != nil { - var metricAlertProperties MetricAlertProperties - err = json.Unmarshal(*v, &metricAlertProperties) + var metricAlertPropertiesPatch MetricAlertPropertiesPatch + err = json.Unmarshal(*v, &metricAlertPropertiesPatch) if err != nil { return err } - marp.MetricAlertProperties = &metricAlertProperties + marp.MetricAlertPropertiesPatch = &metricAlertPropertiesPatch } } } @@ -3637,9 +3979,22 @@ type MetricAvailability struct { Retention *string `json:"retention,omitempty"` } +// MetricBaselinesResponse a list of metric baselines. +type MetricBaselinesResponse struct { + autorest.Response `json:"-"` + // 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. + Timespan *string `json:"timespan,omitempty"` + // 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. + Interval *string `json:"interval,omitempty"` + // Namespace - The namespace of the metrics been queried. + Namespace *string `json:"namespace,omitempty"` + // Value - The baseline for each time series that was queried. + Value *[]SingleMetricBaseline `json:"value,omitempty"` +} + // MetricCriteria criterion to filter metrics. type MetricCriteria struct { - // Operator - the criteria operator. Possible values include: 'OperatorEquals', 'OperatorNotEquals', 'OperatorGreaterThan', 'OperatorGreaterThanOrEqual', 'OperatorLessThan', 'OperatorLessThanOrEqual' + // Operator - the criteria operator. Possible values include: 'OperatorEquals', 'OperatorGreaterThan', 'OperatorGreaterThanOrEqual', 'OperatorLessThan', 'OperatorLessThanOrEqual' Operator Operator `json:"operator,omitempty"` // Threshold - the criteria threshold value that activates the alert. Threshold *float64 `json:"threshold,omitempty"` @@ -3651,8 +4006,8 @@ type MetricCriteria struct { MetricName *string `json:"metricName,omitempty"` // MetricNamespace - Namespace of the metric. MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` + // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' + TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` // Dimensions - List of dimension conditions. Dimensions *[]MetricDimension `json:"dimensions,omitempty"` // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. @@ -3680,7 +4035,7 @@ func (mc MetricCriteria) MarshalJSON() ([]byte, error) { if mc.MetricNamespace != nil { objectMap["metricNamespace"] = mc.MetricNamespace } - if mc.TimeAggregation != nil { + if mc.TimeAggregation != "" { objectMap["timeAggregation"] = mc.TimeAggregation } if mc.Dimensions != nil { @@ -3786,7 +4141,7 @@ func (mc *MetricCriteria) UnmarshalJSON(body []byte) error { } case "timeAggregation": if v != nil { - var timeAggregation interface{} + var timeAggregation AggregationTypeEnum err = json.Unmarshal(*v, &timeAggregation) if err != nil { return err @@ -3836,8 +4191,14 @@ type MetricDefinition struct { Namespace *string `json:"namespace,omitempty"` // Name - the name and the display name of the metric, i.e. it is a localizable string. Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' - Unit Unit `json:"unit,omitempty"` + // DisplayDescription - Detailed description of this metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + // Category - Custom category name for this metric. + Category *string `json:"category,omitempty"` + // MetricClass - The class of the metric. Possible values include: 'Availability', 'Transactions', 'Errors', 'Latency', 'Saturation' + MetricClass MetricClass `json:"metricClass,omitempty"` + // Unit - The unit of the metric. Possible values include: 'MetricUnitCount', 'MetricUnitBytes', 'MetricUnitSeconds', 'MetricUnitCountPerSecond', 'MetricUnitBytesPerSecond', 'MetricUnitPercent', 'MetricUnitMilliSeconds', 'MetricUnitByteSeconds', 'MetricUnitUnspecified', 'MetricUnitCores', 'MetricUnitMilliCores', 'MetricUnitNanoCores', 'MetricUnitBitsPerSecond' + Unit MetricUnit `json:"unit,omitempty"` // PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' PrimaryAggregationType AggregationType `json:"primaryAggregationType,omitempty"` // SupportedAggregationTypes - the collection of what aggregation types are supported. @@ -3867,31 +4228,6 @@ type MetricDimension struct { Values *[]string `json:"values,omitempty"` } -// MetricNamespace metric namespace class specifies the metadata for a metric namespace. -type MetricNamespace struct { - // ID - The ID of the metricNamespace. - ID *string `json:"id,omitempty"` - // Type - The type of the namespace. - Type *string `json:"type,omitempty"` - // Name - The name of the namespace. - Name *string `json:"name,omitempty"` - // Properties - Properties which include the fully qualified namespace name. - Properties *MetricNamespaceName `json:"properties,omitempty"` -} - -// MetricNamespaceCollection represents collection of metric namespaces. -type MetricNamespaceCollection struct { - autorest.Response `json:"-"` - // Value - The values for the metric namespaces. - Value *[]MetricNamespace `json:"value,omitempty"` -} - -// MetricNamespaceName the fully qualified metric namespace name. -type MetricNamespaceName struct { - // MetricNamespaceName - The metric namespace name. - MetricNamespaceName *string `json:"metricNamespaceName,omitempty"` -} - // MetricSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. type MetricSettings struct { // TimeGrain - the timegrain of the metric in ISO8601 format. @@ -3904,6 +4240,14 @@ type MetricSettings struct { RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` } +// MetricSingleDimension the metric dimension name and value. +type MetricSingleDimension struct { + // Name - Name of the dimension. + Name *string `json:"name,omitempty"` + // Value - Value of the dimension. + Value *string `json:"value,omitempty"` +} + // MetricTrigger the trigger that results in a scaling action. type MetricTrigger struct { // MetricName - the name of the metric that defines what the rule monitors. @@ -3912,9 +4256,11 @@ type MetricTrigger struct { MetricNamespace *string `json:"metricNamespace,omitempty"` // MetricResourceURI - the resource identifier of the resource the rule monitors. MetricResourceURI *string `json:"metricResourceUri,omitempty"` + // MetricResourceLocation - the location of the resource the rule monitors. + MetricResourceLocation *string `json:"metricResourceLocation,omitempty"` // TimeGrain - 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. TimeGrain *string `json:"timeGrain,omitempty"` - // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum' + // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum', 'MetricStatisticTypeCount' Statistic MetricStatisticType `json:"statistic,omitempty"` // TimeWindow - 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. TimeWindow *string `json:"timeWindow,omitempty"` @@ -3926,6 +4272,8 @@ type MetricTrigger struct { Threshold *float64 `json:"threshold,omitempty"` // Dimensions - List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. Dimensions *[]ScaleRuleMetricDimension `json:"dimensions,omitempty"` + // DividePerInstance - a value indicating whether metric should divide per instance. + DividePerInstance *bool `json:"dividePerInstance,omitempty"` } // MetricValue represents a metric value. @@ -3961,8 +4309,8 @@ type MultiMetricCriteria struct { MetricName *string `json:"metricName,omitempty"` // MetricNamespace - Namespace of the metric. MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` + // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' + TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` // Dimensions - List of dimension conditions. Dimensions *[]MetricDimension `json:"dimensions,omitempty"` // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. @@ -4025,7 +4373,7 @@ func (mmc MultiMetricCriteria) MarshalJSON() ([]byte, error) { if mmc.MetricNamespace != nil { objectMap["metricNamespace"] = mmc.MetricNamespace } - if mmc.TimeAggregation != nil { + if mmc.TimeAggregation != "" { objectMap["timeAggregation"] = mmc.TimeAggregation } if mmc.Dimensions != nil { @@ -4113,7 +4461,7 @@ func (mmc *MultiMetricCriteria) UnmarshalJSON(body []byte) error { } case "timeAggregation": if v != nil { - var timeAggregation interface{} + var timeAggregation AggregationTypeEnum err = json.Unmarshal(*v, &timeAggregation) if err != nil { return err @@ -4230,6 +4578,10 @@ type Resource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for Resource. @@ -4247,15 +4599,15 @@ func (r Resource) MarshalJSON() ([]byte, error) { // Response the response to a metrics query. type Response struct { autorest.Response `json:"-"` - // Cost - The integer value representing the cost of the query, for data case. + // Cost - The integer value representing the relative cost of the query. Cost *float64 `json:"cost,omitempty"` // 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. Timespan *string `json:"timespan,omitempty"` // 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. Interval *string `json:"interval,omitempty"` - // Namespace - The namespace of the metrics been queried + // Namespace - The namespace of the metrics being queried Namespace *string `json:"namespace,omitempty"` - // Resourceregion - The region of the resource been queried for metrics. + // Resourceregion - The region of the resource being queried for metrics. Resourceregion *string `json:"resourceregion,omitempty"` // Value - the value of the collection. Value *[]Metric `json:"value,omitempty"` @@ -4495,6 +4847,12 @@ type BasicRuleDataSource interface { type RuleDataSource struct { // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' OdataType OdataType `json:"odata.type,omitempty"` } @@ -4547,6 +4905,15 @@ func (rds RuleDataSource) MarshalJSON() ([]byte, error) { if rds.ResourceURI != nil { objectMap["resourceUri"] = rds.ResourceURI } + if rds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rds.LegacyResourceID + } + if rds.ResourceLocation != nil { + objectMap["resourceLocation"] = rds.ResourceLocation + } + if rds.MetricNamespace != nil { + objectMap["metricNamespace"] = rds.MetricNamespace + } if rds.OdataType != "" { objectMap["odata.type"] = rds.OdataType } @@ -4649,6 +5016,12 @@ type RuleManagementEventDataSource struct { Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' OdataType OdataType `json:"odata.type,omitempty"` } @@ -4687,6 +5060,15 @@ func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { if rmeds.ResourceURI != nil { objectMap["resourceUri"] = rmeds.ResourceURI } + if rmeds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rmeds.LegacyResourceID + } + if rmeds.ResourceLocation != nil { + objectMap["resourceLocation"] = rmeds.ResourceLocation + } + if rmeds.MetricNamespace != nil { + objectMap["metricNamespace"] = rmeds.MetricNamespace + } if rmeds.OdataType != "" { objectMap["odata.type"] = rmeds.OdataType } @@ -4720,6 +5102,12 @@ type RuleMetricDataSource struct { MetricName *string `json:"metricName,omitempty"` // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' OdataType OdataType `json:"odata.type,omitempty"` } @@ -4734,6 +5122,15 @@ func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) { if rmds.ResourceURI != nil { objectMap["resourceUri"] = rmds.ResourceURI } + if rmds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rmds.LegacyResourceID + } + if rmds.ResourceLocation != nil { + objectMap["resourceLocation"] = rmds.ResourceLocation + } + if rmds.MetricNamespace != nil { + objectMap["metricNamespace"] = rmds.MetricNamespace + } if rmds.OdataType != "" { objectMap["odata.type"] = rmds.OdataType } @@ -4811,7 +5208,7 @@ func (rwa RuleWebhookAction) AsBasicRuleAction() (BasicRuleAction, bool) { type ScaleAction struct { // Direction - the scale direction. Whether the scaling action increases or decreases the number of instances. Possible values include: 'ScaleDirectionNone', 'ScaleDirectionIncrease', 'ScaleDirectionDecrease' Direction ScaleDirection `json:"direction,omitempty"` - // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount' + // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount', 'ServiceAllowedNextValue' Type ScaleType `json:"type,omitempty"` // Value - the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1. Value *string `json:"value,omitempty"` @@ -4867,6 +5264,28 @@ type SenderAuthorization struct { Scope *string `json:"scope,omitempty"` } +// SingleBaseline the baseline values for a single sensitivity value. +type SingleBaseline struct { + // Sensitivity - the sensitivity of the baseline. Possible values include: 'Low', 'Medium', 'High' + Sensitivity BaselineSensitivity `json:"sensitivity,omitempty"` + // LowThresholds - The low thresholds of the baseline. + LowThresholds *[]float64 `json:"lowThresholds,omitempty"` + // HighThresholds - The high thresholds of the baseline. + HighThresholds *[]float64 `json:"highThresholds,omitempty"` +} + +// SingleMetricBaseline the baseline results of a single metric. +type SingleMetricBaseline struct { + // ID - The metric baseline Id. + ID *string `json:"id,omitempty"` + // Type - The resource type of the metric baseline resource. + Type *string `json:"type,omitempty"` + // MetricName - The name of the metric for which the baselines were retrieved. + MetricName *string `json:"metricName,omitempty"` + // Baselines - The baseline for each time series that was queried. + Baselines *[]TimeSeriesBaseline `json:"baselines,omitempty"` +} + // SmsReceiver an SMS receiver. type SmsReceiver struct { // Name - The name of the SMS receiver. Names must be unique across all receivers within an action group. @@ -5038,6 +5457,20 @@ func (trc *ThresholdRuleCondition) UnmarshalJSON(body []byte) error { return nil } +// TimeSeriesBaseline the baseline values for a single time series. +type TimeSeriesBaseline struct { + // Aggregation - The aggregation type of the metric. + Aggregation *string `json:"aggregation,omitempty"` + // Dimensions - The dimensions of this time series. + Dimensions *[]MetricSingleDimension `json:"dimensions,omitempty"` + // Timestamps - The list of timestamps of the baselines. + Timestamps *[]date.Time `json:"timestamps,omitempty"` + // Data - The baseline values for each sensitivity. + Data *[]SingleBaseline `json:"data,omitempty"` + // MetadataValues - The baseline metadata values. + MetadataValues *[]BaselineMetadata `json:"metadataValues,omitempty"` +} + // TimeSeriesElement a time series result type. The discriminator value is always TimeSeries in this case. type TimeSeriesElement struct { // Metadatavalues - the metadata values returned if $filter was specified in the call. @@ -5046,16 +5479,6 @@ type TimeSeriesElement struct { Data *[]MetricValue `json:"data,omitempty"` } -// TimeSeriesInformation the time series info needed for calculating the baseline. -type TimeSeriesInformation struct { - // Sensitivities - the list of sensitivities for calculating the baseline. - Sensitivities *[]string `json:"sensitivities,omitempty"` - // Values - The metric values to calculate the baseline. - Values *[]float64 `json:"values,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` -} - // TimeWindow a specific date-time for the profile. type TimeWindow struct { // TimeZone - 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 @@ -5068,7 +5491,7 @@ type TimeWindow struct { // TriggerCondition the condition that results in the Log Search rule. type TriggerCondition struct { - // ThresholdOperator - Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' + // ThresholdOperator - Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'ConditionalOperatorGreaterThanOrEqual', 'ConditionalOperatorLessThanOrEqual', 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` // Threshold - Result or count threshold based on which rule should be triggered. Threshold *float64 `json:"threshold,omitempty"` diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/operations.go b/services/preview/monitor/mgmt/2018-09-01/insights/operations.go index 3f82351c7f23..afb74dc9248f 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/operations.go +++ b/services/preview/monitor/mgmt/2018-09-01/insights/operations.go @@ -74,7 +74,7 @@ func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/operations"), + autorest.WithPath("/providers/Microsoft.Insights/operations"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/scheduledqueryrules.go b/services/preview/monitor/mgmt/2018-09-01/insights/scheduledqueryrules.go index c9d43964ecb0..22b09a5f8997 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/scheduledqueryrules.go +++ b/services/preview/monitor/mgmt/2018-09-01/insights/scheduledqueryrules.go @@ -34,7 +34,7 @@ func NewScheduledQueryRulesClientWithBaseURI(baseURI string, subscriptionID stri // CreateOrUpdate creates or updates an log search rule. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to create or update. func (client ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResource) (result LogSearchRuleResource, err error) { @@ -49,6 +49,11 @@ func (client ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, reso }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.LogSearchRule", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source", Name: validation.Null, Rule: true, @@ -100,7 +105,7 @@ func (client ScheduledQueryRulesClient) CreateOrUpdatePreparer(ctx context.Conte autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -126,7 +131,7 @@ func (client ScheduledQueryRulesClient) CreateOrUpdateResponder(resp *http.Respo // Delete deletes a Log Search rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client ScheduledQueryRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -139,6 +144,15 @@ func (client ScheduledQueryRulesClient) Delete(ctx context.Context, resourceGrou tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", nil, "Failure preparing request") @@ -177,7 +191,7 @@ func (client ScheduledQueryRulesClient) DeletePreparer(ctx context.Context, reso preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -201,7 +215,7 @@ func (client ScheduledQueryRulesClient) DeleteResponder(resp *http.Response) (re // Get gets an Log Search rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client ScheduledQueryRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result LogSearchRuleResource, err error) { if tracing.IsEnabled() { @@ -214,6 +228,15 @@ func (client ScheduledQueryRulesClient) Get(ctx context.Context, resourceGroupNa tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Get", nil, "Failure preparing request") @@ -252,7 +275,7 @@ func (client ScheduledQueryRulesClient) GetPreparer(ctx context.Context, resourc preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -277,7 +300,7 @@ func (client ScheduledQueryRulesClient) GetResponder(resp *http.Response) (resul // ListByResourceGroup list the Log Search rules within a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // filter - the filter to apply on the operation. For more information please see // https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx func (client ScheduledQueryRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result LogSearchRuleResourceCollection, err error) { @@ -291,6 +314,15 @@ func (client ScheduledQueryRulesClient) ListByResourceGroup(ctx context.Context, tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -331,7 +363,7 @@ func (client ScheduledQueryRulesClient) ListByResourceGroupPreparer(ctx context. preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -369,6 +401,12 @@ func (client ScheduledQueryRulesClient) ListBySubscription(ctx context.Context, tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "ListBySubscription", err.Error()) + } + req, err := client.ListBySubscriptionPreparer(ctx, filter) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", nil, "Failure preparing request") @@ -408,7 +446,7 @@ func (client ScheduledQueryRulesClient) ListBySubscriptionPreparer(ctx context.C preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/scheduledQueryRules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -433,7 +471,7 @@ func (client ScheduledQueryRulesClient) ListBySubscriptionResponder(resp *http.R // Update update log search Rule. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to update. func (client ScheduledQueryRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResourcePatch) (result LogSearchRuleResource, err error) { @@ -447,6 +485,15 @@ func (client ScheduledQueryRulesClient) Update(ctx context.Context, resourceGrou tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Update", nil, "Failure preparing request") @@ -486,7 +533,7 @@ func (client ScheduledQueryRulesClient) UpdatePreparer(ctx context.Context, reso autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/tenantactivitylogs.go b/services/preview/monitor/mgmt/2018-09-01/insights/tenantactivitylogs.go index 7501f047bb38..7c6ee7981381 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/tenantactivitylogs.go +++ b/services/preview/monitor/mgmt/2018-09-01/insights/tenantactivitylogs.go @@ -107,7 +107,7 @@ func (client TenantActivityLogsClient) ListPreparer(ctx context.Context, filter preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventtypes/management/values"), + autorest.WithPath("/providers/Microsoft.Insights/eventtypes/management/values"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/CHANGELOG.md b/services/preview/monitor/mgmt/2018-11-01-preview/insights/CHANGELOG.md index 52911e4cc5e4..cdd456e71238 100644 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/CHANGELOG.md +++ b/services/preview/monitor/mgmt/2018-11-01-preview/insights/CHANGELOG.md @@ -1,2 +1,163 @@ -# Change History +# Unreleased +## Breaking Changes + +### Removed Constants + +1. Operator.OperatorNotEquals +1. Sensitivity.SensitivityHigh +1. Sensitivity.SensitivityLow +1. Sensitivity.SensitivityMedium +1. Unit.UnitBitsPerSecond +1. Unit.UnitByteSeconds +1. Unit.UnitBytes +1. Unit.UnitBytesPerSecond +1. Unit.UnitCores +1. Unit.UnitCount +1. Unit.UnitCountPerSecond +1. Unit.UnitMilliCores +1. Unit.UnitMilliSeconds +1. Unit.UnitNanoCores +1. Unit.UnitPercent +1. Unit.UnitSeconds +1. Unit.UnitUnspecified + +### Removed Funcs + +1. *BaselineResponse.UnmarshalJSON([]byte) error +1. BaselineResponse.MarshalJSON() ([]byte, error) +1. MetricBaselineClient.CalculateBaseline(context.Context, string, TimeSeriesInformation) (CalculateBaselineResponse, error) +1. MetricBaselineClient.CalculateBaselinePreparer(context.Context, string, TimeSeriesInformation) (*http.Request, error) +1. MetricBaselineClient.CalculateBaselineResponder(*http.Response) (CalculateBaselineResponse, error) +1. MetricBaselineClient.CalculateBaselineSender(*http.Request) (*http.Response, error) +1. MetricBaselineClient.Get(context.Context, string, string, string, *string, string, string, ResultType) (BaselineResponse, error) +1. MetricBaselineClient.GetPreparer(context.Context, string, string, string, *string, string, string, ResultType) (*http.Request, error) +1. MetricBaselineClient.GetResponder(*http.Response) (BaselineResponse, error) +1. MetricBaselineClient.GetSender(*http.Request) (*http.Response, error) +1. NewMetricBaselineClient(string) MetricBaselineClient +1. NewMetricBaselineClientWithBaseURI(string, string) MetricBaselineClient +1. PossibleSensitivityValues() []Sensitivity +1. PossibleUnitValues() []Unit + +### Struct Changes + +#### Removed Structs + +1. Baseline +1. BaselineMetadataValue +1. BaselineProperties +1. BaselineResponse +1. CalculateBaselineResponse +1. MetricBaselineClient +1. TimeSeriesInformation + +#### Removed Struct Fields + +1. MetricAlertResourcePatch.*MetricAlertProperties + +### Signature Changes + +#### Struct Fields + +1. DynamicMetricCriteria.TimeAggregation changed type from interface{} to AggregationTypeEnum +1. Metric.Unit changed type from Unit to MetricUnit +1. MetricCriteria.TimeAggregation changed type from interface{} to AggregationTypeEnum +1. MetricDefinition.Unit changed type from Unit to MetricUnit +1. MultiMetricCriteria.TimeAggregation changed type from interface{} to AggregationTypeEnum + +## Additive Changes + +### New Constants + +1. AggregationTypeEnum.AggregationTypeEnumAverage +1. AggregationTypeEnum.AggregationTypeEnumCount +1. AggregationTypeEnum.AggregationTypeEnumMaximum +1. AggregationTypeEnum.AggregationTypeEnumMinimum +1. AggregationTypeEnum.AggregationTypeEnumTotal +1. ConditionalOperator.ConditionalOperatorGreaterThanOrEqual +1. ConditionalOperator.ConditionalOperatorLessThanOrEqual +1. MetricClass.Availability +1. MetricClass.Errors +1. MetricClass.Latency +1. MetricClass.Saturation +1. MetricClass.Transactions +1. MetricStatisticType.MetricStatisticTypeCount +1. MetricUnit.MetricUnitBitsPerSecond +1. MetricUnit.MetricUnitByteSeconds +1. MetricUnit.MetricUnitBytes +1. MetricUnit.MetricUnitBytesPerSecond +1. MetricUnit.MetricUnitCores +1. MetricUnit.MetricUnitCount +1. MetricUnit.MetricUnitCountPerSecond +1. MetricUnit.MetricUnitMilliCores +1. MetricUnit.MetricUnitMilliSeconds +1. MetricUnit.MetricUnitNanoCores +1. MetricUnit.MetricUnitPercent +1. MetricUnit.MetricUnitSeconds +1. MetricUnit.MetricUnitUnspecified +1. NamespaceClassification.Custom +1. NamespaceClassification.Platform +1. NamespaceClassification.Qos +1. ScaleType.ServiceAllowedNextValue + +### New Funcs + +1. *MetricAlertPropertiesPatch.UnmarshalJSON([]byte) error +1. MetricAlertPropertiesPatch.MarshalJSON() ([]byte, error) +1. PossibleAggregationTypeEnumValues() []AggregationTypeEnum +1. PossibleMetricClassValues() []MetricClass +1. PossibleMetricUnitValues() []MetricUnit +1. PossibleNamespaceClassificationValues() []NamespaceClassification + +### Struct Changes + +#### New Structs + +1. ErrorContract +1. MetricAlertPropertiesPatch + +#### New Struct Fields + +1. ActionGroupResource.Etag +1. ActionGroupResource.Kind +1. ActivityLogAlertResource.Etag +1. ActivityLogAlertResource.Kind +1. AlertRule.Action +1. AlertRule.ProvisioningState +1. AlertRuleResource.Etag +1. AlertRuleResource.Kind +1. AutoscaleSetting.TargetResourceLocation +1. AutoscaleSettingResource.Etag +1. AutoscaleSettingResource.Kind +1. LogProfileResource.Etag +1. LogProfileResource.Kind +1. LogSearchRule.AutoMitigate +1. LogSearchRule.CreatedWithAPIVersion +1. LogSearchRule.DisplayName +1. LogSearchRule.IsLegacyLogAnalyticsRule +1. LogSearchRuleResource.Etag +1. LogSearchRuleResource.Kind +1. Metric.DisplayDescription +1. Metric.ErrorCode +1. Metric.ErrorMessage +1. MetricAlertProperties.IsMigrated +1. MetricAlertResource.Etag +1. MetricAlertResource.Kind +1. MetricAlertResourcePatch.*MetricAlertPropertiesPatch +1. MetricDefinition.Category +1. MetricDefinition.DisplayDescription +1. MetricDefinition.MetricClass +1. MetricNamespace.Classification +1. MetricTrigger.DividePerInstance +1. MetricTrigger.MetricResourceLocation +1. Resource.Etag +1. Resource.Kind +1. RuleDataSource.LegacyResourceID +1. RuleDataSource.MetricNamespace +1. RuleDataSource.ResourceLocation +1. RuleManagementEventDataSource.LegacyResourceID +1. RuleManagementEventDataSource.MetricNamespace +1. RuleManagementEventDataSource.ResourceLocation +1. RuleMetricDataSource.LegacyResourceID +1. RuleMetricDataSource.MetricNamespace +1. RuleMetricDataSource.ResourceLocation diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/_meta.json b/services/preview/monitor/mgmt/2018-11-01-preview/insights/_meta.json index d95196250894..04f21c45edc8 100644 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/_meta.json +++ b/services/preview/monitor/mgmt/2018-11-01-preview/insights/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "83f6c7b9ac240d3862e909245f0a61d70ae33908", "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", "tag": "package-2018-11-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/actiongroups.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/actiongroups.go index 20bdb629e8c1..d2fccb5ce09e 100644 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/actiongroups.go +++ b/services/preview/monitor/mgmt/2018-11-01-preview/insights/actiongroups.go @@ -33,7 +33,7 @@ func NewActionGroupsClientWithBaseURI(baseURI string, subscriptionID string) Act // CreateOrUpdate create a new action group or update an existing one. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. // actionGroup - the action group to create or use for the update. func (client ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (result ActionGroupResource, err error) { @@ -48,12 +48,17 @@ func (client ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGro }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: actionGroup, Constraints: []validation.Constraint{{Target: "actionGroup.ActionGroup", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.MaxLength, Rule: 12, Chain: nil}}}, {Target: "actionGroup.ActionGroup.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ActionGroupsClient", "CreateOrUpdate", err.Error()) } @@ -122,7 +127,7 @@ func (client ActionGroupsClient) CreateOrUpdateResponder(resp *http.Response) (r // Delete delete an action group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. func (client ActionGroupsClient) Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -135,6 +140,15 @@ func (client ActionGroupsClient) Delete(ctx context.Context, resourceGroupName s tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, actionGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", nil, "Failure preparing request") @@ -198,7 +212,7 @@ func (client ActionGroupsClient) DeleteResponder(resp *http.Response) (result au // EnableReceiver 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. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. // enableRequest - the receiver to re-enable. func (client ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (result autorest.Response, err error) { @@ -213,8 +227,13 @@ func (client ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGro }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: enableRequest, - Constraints: []validation.Constraint{{Target: "enableRequest.ReceiverName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "enableRequest.ReceiverName", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ActionGroupsClient", "EnableReceiver", err.Error()) } @@ -282,7 +301,7 @@ func (client ActionGroupsClient) EnableReceiverResponder(resp *http.Response) (r // Get get an action group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. func (client ActionGroupsClient) Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result ActionGroupResource, err error) { if tracing.IsEnabled() { @@ -295,6 +314,15 @@ func (client ActionGroupsClient) Get(ctx context.Context, resourceGroupName stri tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, actionGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Get", nil, "Failure preparing request") @@ -358,7 +386,7 @@ func (client ActionGroupsClient) GetResponder(resp *http.Response) (result Actio // ListByResourceGroup get a list of all action groups in a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client ActionGroupsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActionGroupList, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.ListByResourceGroup") @@ -370,6 +398,15 @@ func (client ActionGroupsClient) ListByResourceGroup(ctx context.Context, resour tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -442,6 +479,12 @@ func (client ActionGroupsClient) ListBySubscriptionID(ctx context.Context) (resu tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "ListBySubscriptionID", err.Error()) + } + req, err := client.ListBySubscriptionIDPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", nil, "Failure preparing request") @@ -503,7 +546,7 @@ func (client ActionGroupsClient) ListBySubscriptionIDResponder(resp *http.Respon // Update updates an existing action group's tags. To update other fields use the CreateOrUpdate method. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. // actionGroupPatch - parameters supplied to the operation. func (client ActionGroupsClient) Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (result ActionGroupResource, err error) { @@ -517,6 +560,15 @@ func (client ActionGroupsClient) Update(ctx context.Context, resourceGroupName s tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, actionGroupName, actionGroupPatch) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Update", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/activitylogalerts.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/activitylogalerts.go index 44aaf3ef1e4a..f897b08a6f0c 100644 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/activitylogalerts.go +++ b/services/preview/monitor/mgmt/2018-11-01-preview/insights/activitylogalerts.go @@ -34,7 +34,7 @@ func NewActivityLogAlertsClientWithBaseURI(baseURI string, subscriptionID string // CreateOrUpdate create a new activity log alert or update an existing one. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // activityLogAlertName - the name of the activity log alert. // activityLogAlert - the activity log alert to create or use for the update. func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (result ActivityLogAlertResource, err error) { @@ -49,6 +49,11 @@ func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resour }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: activityLogAlert, Constraints: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Scopes", Name: validation.Null, Rule: true, Chain: nil}, @@ -124,7 +129,7 @@ func (client ActivityLogAlertsClient) CreateOrUpdateResponder(resp *http.Respons // Delete delete an activity log alert. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // activityLogAlertName - the name of the activity log alert. func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -137,6 +142,15 @@ func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupN tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, activityLogAlertName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", nil, "Failure preparing request") @@ -199,7 +213,7 @@ func (client ActivityLogAlertsClient) DeleteResponder(resp *http.Response) (resu // Get get an activity log alert. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // activityLogAlertName - the name of the activity log alert. func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result ActivityLogAlertResource, err error) { if tracing.IsEnabled() { @@ -212,6 +226,15 @@ func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, activityLogAlertName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Get", nil, "Failure preparing request") @@ -275,7 +298,7 @@ func (client ActivityLogAlertsClient) GetResponder(resp *http.Response) (result // ListByResourceGroup get a list of all activity log alerts in a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActivityLogAlertList, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.ListByResourceGroup") @@ -287,6 +310,15 @@ func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, r tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -359,6 +391,12 @@ func (client ActivityLogAlertsClient) ListBySubscriptionID(ctx context.Context) tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "ListBySubscriptionID", err.Error()) + } + req, err := client.ListBySubscriptionIDPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", nil, "Failure preparing request") @@ -420,7 +458,7 @@ func (client ActivityLogAlertsClient) ListBySubscriptionIDResponder(resp *http.R // Update updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // activityLogAlertName - the name of the activity log alert. // activityLogAlertPatch - parameters supplied to the operation. func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (result ActivityLogAlertResource, err error) { @@ -434,6 +472,15 @@ func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupN tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, activityLogAlertName, activityLogAlertPatch) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Update", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/activitylogs.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/activitylogs.go index 16dd215e6ad9..fc6927fa0e16 100644 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/activitylogs.go +++ b/services/preview/monitor/mgmt/2018-11-01-preview/insights/activitylogs.go @@ -10,6 +10,7 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" "net/http" ) @@ -60,6 +61,12 @@ func (client ActivityLogsClient) List(ctx context.Context, filter string, select tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogsClient", "List", err.Error()) + } + result.fn = client.listNextResults req, err := client.ListPreparer(ctx, filter, selectParameter) if err != nil { @@ -105,7 +112,7 @@ func (client ActivityLogsClient) ListPreparer(ctx context.Context, filter string preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/eventtypes/management/values", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/eventtypes/management/values", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/alertruleincidents.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/alertruleincidents.go index c3bf26828d8e..a7dcd9cba31e 100644 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/alertruleincidents.go +++ b/services/preview/monitor/mgmt/2018-11-01-preview/insights/alertruleincidents.go @@ -10,6 +10,7 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" "net/http" ) @@ -33,7 +34,7 @@ func NewAlertRuleIncidentsClientWithBaseURI(baseURI string, subscriptionID strin // Get gets an incident associated to an alert rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // incidentName - the name of the incident to retrieve. func (client AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result Incident, err error) { @@ -47,6 +48,15 @@ func (client AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupNam tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRuleIncidentsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName, incidentName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "Get", nil, "Failure preparing request") @@ -111,7 +121,7 @@ func (client AlertRuleIncidentsClient) GetResponder(resp *http.Response) (result // ListByAlertRule gets a list of incidents associated to an alert rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client AlertRuleIncidentsClient) ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result IncidentListResult, err error) { if tracing.IsEnabled() { @@ -124,6 +134,15 @@ func (client AlertRuleIncidentsClient) ListByAlertRule(ctx context.Context, reso tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRuleIncidentsClient", "ListByAlertRule", err.Error()) + } + req, err := client.ListByAlertRulePreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/alertrules.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/alertrules.go index f5a2ab682384..888ed122e267 100644 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/alertrules.go +++ b/services/preview/monitor/mgmt/2018-11-01-preview/insights/alertrules.go @@ -33,7 +33,7 @@ func NewAlertRulesClientWithBaseURI(baseURI string, subscriptionID string) Alert // CreateOrUpdate creates or updates a classic metric alert rule. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to create or update. func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (result AlertRuleResource, err error) { @@ -48,11 +48,16 @@ func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroup }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.AlertRule", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.AlertRule.Name", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.AlertRule.IsEnabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AlertRulesClient", "CreateOrUpdate", err.Error()) } @@ -95,7 +100,7 @@ func (client AlertRulesClient) CreateOrUpdatePreparer(ctx context.Context, resou autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -121,7 +126,7 @@ func (client AlertRulesClient) CreateOrUpdateResponder(resp *http.Response) (res // Delete deletes a classic metric alert rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -134,6 +139,15 @@ func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName str tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", nil, "Failure preparing request") @@ -172,7 +186,7 @@ func (client AlertRulesClient) DeletePreparer(ctx context.Context, resourceGroup preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -196,7 +210,7 @@ func (client AlertRulesClient) DeleteResponder(resp *http.Response) (result auto // Get gets a classic metric alert rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result AlertRuleResource, err error) { if tracing.IsEnabled() { @@ -209,6 +223,15 @@ func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Get", nil, "Failure preparing request") @@ -247,7 +270,7 @@ func (client AlertRulesClient) GetPreparer(ctx context.Context, resourceGroupNam preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -272,7 +295,7 @@ func (client AlertRulesClient) GetResponder(resp *http.Response) (result AlertRu // ListByResourceGroup list the classic metric alert rules within a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client AlertRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AlertRuleResourceCollection, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.ListByResourceGroup") @@ -284,6 +307,15 @@ func (client AlertRulesClient) ListByResourceGroup(ctx context.Context, resource tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -321,7 +353,7 @@ func (client AlertRulesClient) ListByResourceGroupPreparer(ctx context.Context, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -356,6 +388,12 @@ func (client AlertRulesClient) ListBySubscription(ctx context.Context) (result A tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "ListBySubscription", err.Error()) + } + req, err := client.ListBySubscriptionPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", nil, "Failure preparing request") @@ -392,7 +430,7 @@ func (client AlertRulesClient) ListBySubscriptionPreparer(ctx context.Context) ( preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/alertrules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -417,7 +455,7 @@ func (client AlertRulesClient) ListBySubscriptionResponder(resp *http.Response) // Update updates an existing classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // alertRulesResource - parameters supplied to the operation. func (client AlertRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (result AlertRuleResource, err error) { @@ -431,6 +469,15 @@ func (client AlertRulesClient) Update(ctx context.Context, resourceGroupName str tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, alertRulesResource) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Update", nil, "Failure preparing request") @@ -470,7 +517,7 @@ func (client AlertRulesClient) UpdatePreparer(ctx context.Context, resourceGroup autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithJSON(alertRulesResource), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/autoscalesettings.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/autoscalesettings.go index 86f253d0fb89..d9118bd2d049 100644 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/autoscalesettings.go +++ b/services/preview/monitor/mgmt/2018-11-01-preview/insights/autoscalesettings.go @@ -34,7 +34,7 @@ func NewAutoscaleSettingsClientWithBaseURI(baseURI string, subscriptionID string // CreateOrUpdate creates or updates an autoscale setting. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // autoscaleSettingName - the autoscale setting name. // parameters - parameters supplied to the operation. func (client AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (result AutoscaleSettingResource, err error) { @@ -49,11 +49,16 @@ func (client AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resour }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.AutoscaleSetting", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.MaxItems, Rule: 20, Chain: nil}}}, - }}}}}); err != nil { + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AutoscaleSettingsClient", "CreateOrUpdate", err.Error()) } @@ -96,7 +101,7 @@ func (client AutoscaleSettingsClient) CreateOrUpdatePreparer(ctx context.Context autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -122,7 +127,7 @@ func (client AutoscaleSettingsClient) CreateOrUpdateResponder(resp *http.Respons // Delete deletes and autoscale setting // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // autoscaleSettingName - the autoscale setting name. func (client AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -135,6 +140,15 @@ func (client AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupN tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, autoscaleSettingName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", nil, "Failure preparing request") @@ -173,7 +187,7 @@ func (client AutoscaleSettingsClient) DeletePreparer(ctx context.Context, resour preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -197,7 +211,7 @@ func (client AutoscaleSettingsClient) DeleteResponder(resp *http.Response) (resu // Get gets an autoscale setting // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // autoscaleSettingName - the autoscale setting name. func (client AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result AutoscaleSettingResource, err error) { if tracing.IsEnabled() { @@ -210,6 +224,15 @@ func (client AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, autoscaleSettingName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Get", nil, "Failure preparing request") @@ -248,7 +271,7 @@ func (client AutoscaleSettingsClient) GetPreparer(ctx context.Context, resourceG preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -273,7 +296,7 @@ func (client AutoscaleSettingsClient) GetResponder(resp *http.Response) (result // ListByResourceGroup lists the autoscale settings for a resource group // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client AutoscaleSettingsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.ListByResourceGroup") @@ -285,6 +308,15 @@ func (client AutoscaleSettingsClient) ListByResourceGroup(ctx context.Context, r tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "ListByResourceGroup", err.Error()) + } + result.fn = client.listByResourceGroupNextResults req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { @@ -327,7 +359,7 @@ func (client AutoscaleSettingsClient) ListByResourceGroupPreparer(ctx context.Co preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -399,6 +431,12 @@ func (client AutoscaleSettingsClient) ListBySubscription(ctx context.Context) (r tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "ListBySubscription", err.Error()) + } + result.fn = client.listBySubscriptionNextResults req, err := client.ListBySubscriptionPreparer(ctx) if err != nil { @@ -440,7 +478,7 @@ func (client AutoscaleSettingsClient) ListBySubscriptionPreparer(ctx context.Con preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/autoscalesettings", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -502,7 +540,7 @@ func (client AutoscaleSettingsClient) ListBySubscriptionComplete(ctx context.Con // Update updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // autoscaleSettingName - the autoscale setting name. // autoscaleSettingResource - parameters supplied to the operation. func (client AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (result AutoscaleSettingResource, err error) { @@ -516,6 +554,15 @@ func (client AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupN tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, autoscaleSettingName, autoscaleSettingResource) if err != nil { err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Update", nil, "Failure preparing request") @@ -555,7 +602,7 @@ func (client AutoscaleSettingsClient) UpdatePreparer(ctx context.Context, resour autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithJSON(autoscaleSettingResource), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/diagnosticsettings.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/diagnosticsettings.go index 9708c52c2499..db8aa282d0f3 100644 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/diagnosticsettings.go +++ b/services/preview/monitor/mgmt/2018-11-01-preview/insights/diagnosticsettings.go @@ -85,7 +85,7 @@ func (client DiagnosticSettingsClient) CreateOrUpdatePreparer(ctx context.Contex autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -161,7 +161,7 @@ func (client DiagnosticSettingsClient) DeletePreparer(ctx context.Context, resou preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -235,7 +235,7 @@ func (client DiagnosticSettingsClient) GetPreparer(ctx context.Context, resource preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -308,7 +308,7 @@ func (client DiagnosticSettingsClient) ListPreparer(ctx context.Context, resourc preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/diagnosticsettingscategory.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/diagnosticsettingscategory.go index 48365ed67e65..07b7295848ef 100644 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/diagnosticsettingscategory.go +++ b/services/preview/monitor/mgmt/2018-11-01-preview/insights/diagnosticsettingscategory.go @@ -83,7 +83,7 @@ func (client DiagnosticSettingsCategoryClient) GetPreparer(ctx context.Context, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -156,7 +156,7 @@ func (client DiagnosticSettingsCategoryClient) ListPreparer(ctx context.Context, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/enums.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/enums.go index d86190121bb5..455a23c096f5 100644 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/enums.go +++ b/services/preview/monitor/mgmt/2018-11-01-preview/insights/enums.go @@ -29,6 +29,27 @@ func PossibleAggregationTypeValues() []AggregationType { return []AggregationType{Average, Count, Maximum, Minimum, None, Total} } +// AggregationTypeEnum enumerates the values for aggregation type enum. +type AggregationTypeEnum string + +const ( + // AggregationTypeEnumAverage ... + AggregationTypeEnumAverage AggregationTypeEnum = "Average" + // AggregationTypeEnumCount ... + AggregationTypeEnumCount AggregationTypeEnum = "Count" + // AggregationTypeEnumMaximum ... + AggregationTypeEnumMaximum AggregationTypeEnum = "Maximum" + // AggregationTypeEnumMinimum ... + AggregationTypeEnumMinimum AggregationTypeEnum = "Minimum" + // AggregationTypeEnumTotal ... + AggregationTypeEnumTotal AggregationTypeEnum = "Total" +) + +// PossibleAggregationTypeEnumValues returns an array of possible values for the AggregationTypeEnum const type. +func PossibleAggregationTypeEnumValues() []AggregationTypeEnum { + return []AggregationTypeEnum{AggregationTypeEnumAverage, AggregationTypeEnumCount, AggregationTypeEnumMaximum, AggregationTypeEnumMinimum, AggregationTypeEnumTotal} +} + // AlertSeverity enumerates the values for alert severity. type AlertSeverity string @@ -96,13 +117,17 @@ const ( ConditionalOperatorEqual ConditionalOperator = "Equal" // ConditionalOperatorGreaterThan ... ConditionalOperatorGreaterThan ConditionalOperator = "GreaterThan" + // ConditionalOperatorGreaterThanOrEqual ... + ConditionalOperatorGreaterThanOrEqual ConditionalOperator = "GreaterThanOrEqual" // ConditionalOperatorLessThan ... ConditionalOperatorLessThan ConditionalOperator = "LessThan" + // ConditionalOperatorLessThanOrEqual ... + ConditionalOperatorLessThanOrEqual ConditionalOperator = "LessThanOrEqual" ) // PossibleConditionalOperatorValues returns an array of possible values for the ConditionalOperator const type. func PossibleConditionalOperatorValues() []ConditionalOperator { - return []ConditionalOperator{ConditionalOperatorEqual, ConditionalOperatorGreaterThan, ConditionalOperatorLessThan} + return []ConditionalOperator{ConditionalOperatorEqual, ConditionalOperatorGreaterThan, ConditionalOperatorGreaterThanOrEqual, ConditionalOperatorLessThan, ConditionalOperatorLessThanOrEqual} } // ConditionOperator enumerates the values for condition operator. @@ -226,12 +251,35 @@ func PossibleEventLevelValues() []EventLevel { return []EventLevel{EventLevelCritical, EventLevelError, EventLevelInformational, EventLevelVerbose, EventLevelWarning} } +// MetricClass enumerates the values for metric class. +type MetricClass string + +const ( + // Availability ... + Availability MetricClass = "Availability" + // Errors ... + Errors MetricClass = "Errors" + // Latency ... + Latency MetricClass = "Latency" + // Saturation ... + Saturation MetricClass = "Saturation" + // Transactions ... + Transactions MetricClass = "Transactions" +) + +// PossibleMetricClassValues returns an array of possible values for the MetricClass const type. +func PossibleMetricClassValues() []MetricClass { + return []MetricClass{Availability, Errors, Latency, Saturation, Transactions} +} + // MetricStatisticType enumerates the values for metric statistic type. type MetricStatisticType string const ( // MetricStatisticTypeAverage ... MetricStatisticTypeAverage MetricStatisticType = "Average" + // MetricStatisticTypeCount ... + MetricStatisticTypeCount MetricStatisticType = "Count" // MetricStatisticTypeMax ... MetricStatisticTypeMax MetricStatisticType = "Max" // MetricStatisticTypeMin ... @@ -242,7 +290,7 @@ const ( // PossibleMetricStatisticTypeValues returns an array of possible values for the MetricStatisticType const type. func PossibleMetricStatisticTypeValues() []MetricStatisticType { - return []MetricStatisticType{MetricStatisticTypeAverage, MetricStatisticTypeMax, MetricStatisticTypeMin, MetricStatisticTypeSum} + return []MetricStatisticType{MetricStatisticTypeAverage, MetricStatisticTypeCount, MetricStatisticTypeMax, MetricStatisticTypeMin, MetricStatisticTypeSum} } // MetricTriggerType enumerates the values for metric trigger type. @@ -260,6 +308,60 @@ func PossibleMetricTriggerTypeValues() []MetricTriggerType { return []MetricTriggerType{MetricTriggerTypeConsecutive, MetricTriggerTypeTotal} } +// MetricUnit enumerates the values for metric unit. +type MetricUnit string + +const ( + // MetricUnitBitsPerSecond ... + MetricUnitBitsPerSecond MetricUnit = "BitsPerSecond" + // MetricUnitBytes ... + MetricUnitBytes MetricUnit = "Bytes" + // MetricUnitByteSeconds ... + MetricUnitByteSeconds MetricUnit = "ByteSeconds" + // MetricUnitBytesPerSecond ... + MetricUnitBytesPerSecond MetricUnit = "BytesPerSecond" + // MetricUnitCores ... + MetricUnitCores MetricUnit = "Cores" + // MetricUnitCount ... + MetricUnitCount MetricUnit = "Count" + // MetricUnitCountPerSecond ... + MetricUnitCountPerSecond MetricUnit = "CountPerSecond" + // MetricUnitMilliCores ... + MetricUnitMilliCores MetricUnit = "MilliCores" + // MetricUnitMilliSeconds ... + MetricUnitMilliSeconds MetricUnit = "MilliSeconds" + // MetricUnitNanoCores ... + MetricUnitNanoCores MetricUnit = "NanoCores" + // MetricUnitPercent ... + MetricUnitPercent MetricUnit = "Percent" + // MetricUnitSeconds ... + MetricUnitSeconds MetricUnit = "Seconds" + // MetricUnitUnspecified ... + MetricUnitUnspecified MetricUnit = "Unspecified" +) + +// PossibleMetricUnitValues returns an array of possible values for the MetricUnit const type. +func PossibleMetricUnitValues() []MetricUnit { + return []MetricUnit{MetricUnitBitsPerSecond, MetricUnitBytes, MetricUnitByteSeconds, MetricUnitBytesPerSecond, MetricUnitCores, MetricUnitCount, MetricUnitCountPerSecond, MetricUnitMilliCores, MetricUnitMilliSeconds, MetricUnitNanoCores, MetricUnitPercent, MetricUnitSeconds, MetricUnitUnspecified} +} + +// NamespaceClassification enumerates the values for namespace classification. +type NamespaceClassification string + +const ( + // Custom ... + Custom NamespaceClassification = "Custom" + // Platform ... + Platform NamespaceClassification = "Platform" + // Qos ... + Qos NamespaceClassification = "Qos" +) + +// PossibleNamespaceClassificationValues returns an array of possible values for the NamespaceClassification const type. +func PossibleNamespaceClassificationValues() []NamespaceClassification { + return []NamespaceClassification{Custom, Platform, Qos} +} + // OdataType enumerates the values for odata type. type OdataType string @@ -380,13 +482,11 @@ const ( OperatorLessThan Operator = "LessThan" // OperatorLessThanOrEqual ... OperatorLessThanOrEqual Operator = "LessThanOrEqual" - // OperatorNotEquals ... - OperatorNotEquals Operator = "NotEquals" ) // PossibleOperatorValues returns an array of possible values for the Operator const type. func PossibleOperatorValues() []Operator { - return []Operator{OperatorEquals, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorLessThan, OperatorLessThanOrEqual, OperatorNotEquals} + return []Operator{OperatorEquals, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorLessThan, OperatorLessThanOrEqual} } // ProvisioningState enumerates the values for provisioning state. @@ -522,28 +622,13 @@ const ( ExactCount ScaleType = "ExactCount" // PercentChangeCount ... PercentChangeCount ScaleType = "PercentChangeCount" + // ServiceAllowedNextValue ... + ServiceAllowedNextValue ScaleType = "ServiceAllowedNextValue" ) // PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. func PossibleScaleTypeValues() []ScaleType { - return []ScaleType{ChangeCount, ExactCount, PercentChangeCount} -} - -// Sensitivity enumerates the values for sensitivity. -type Sensitivity string - -const ( - // SensitivityHigh ... - SensitivityHigh Sensitivity = "High" - // SensitivityLow ... - SensitivityLow Sensitivity = "Low" - // SensitivityMedium ... - SensitivityMedium Sensitivity = "Medium" -) - -// PossibleSensitivityValues returns an array of possible values for the Sensitivity const type. -func PossibleSensitivityValues() []Sensitivity { - return []Sensitivity{SensitivityHigh, SensitivityLow, SensitivityMedium} + return []ScaleType{ChangeCount, ExactCount, PercentChangeCount, ServiceAllowedNextValue} } // TimeAggregationOperator enumerates the values for time aggregation operator. @@ -589,40 +674,3 @@ const ( func PossibleTimeAggregationTypeValues() []TimeAggregationType { return []TimeAggregationType{TimeAggregationTypeAverage, TimeAggregationTypeCount, TimeAggregationTypeLast, TimeAggregationTypeMaximum, TimeAggregationTypeMinimum, TimeAggregationTypeTotal} } - -// Unit enumerates the values for unit. -type Unit string - -const ( - // UnitBitsPerSecond ... - UnitBitsPerSecond Unit = "BitsPerSecond" - // UnitBytes ... - UnitBytes Unit = "Bytes" - // UnitByteSeconds ... - UnitByteSeconds Unit = "ByteSeconds" - // UnitBytesPerSecond ... - UnitBytesPerSecond Unit = "BytesPerSecond" - // UnitCores ... - UnitCores Unit = "Cores" - // UnitCount ... - UnitCount Unit = "Count" - // UnitCountPerSecond ... - UnitCountPerSecond Unit = "CountPerSecond" - // UnitMilliCores ... - UnitMilliCores Unit = "MilliCores" - // UnitMilliSeconds ... - UnitMilliSeconds Unit = "MilliSeconds" - // UnitNanoCores ... - UnitNanoCores Unit = "NanoCores" - // UnitPercent ... - UnitPercent Unit = "Percent" - // UnitSeconds ... - UnitSeconds Unit = "Seconds" - // UnitUnspecified ... - UnitUnspecified Unit = "Unspecified" -) - -// PossibleUnitValues returns an array of possible values for the Unit const type. -func PossibleUnitValues() []Unit { - return []Unit{UnitBitsPerSecond, UnitBytes, UnitByteSeconds, UnitBytesPerSecond, UnitCores, UnitCount, UnitCountPerSecond, UnitMilliCores, UnitMilliSeconds, UnitNanoCores, UnitPercent, UnitSeconds, UnitUnspecified} -} diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/eventcategories.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/eventcategories.go index 86e59b424363..f43c5468ac51 100644 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/eventcategories.go +++ b/services/preview/monitor/mgmt/2018-11-01-preview/insights/eventcategories.go @@ -75,7 +75,7 @@ func (client EventCategoriesClient) ListPreparer(ctx context.Context) (*http.Req preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventcategories"), + autorest.WithPath("/providers/Microsoft.Insights/eventcategories"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/insightsapi/interfaces.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/insightsapi/interfaces.go index 03eab73052ba..1485c0a26e18 100644 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/insightsapi/interfaces.go +++ b/services/preview/monitor/mgmt/2018-11-01-preview/insights/insightsapi/interfaces.go @@ -144,14 +144,6 @@ type MetricsClientAPI interface { var _ MetricsClientAPI = (*insights.MetricsClient)(nil) -// MetricBaselineClientAPI contains the set of methods on the MetricBaselineClient type. -type MetricBaselineClientAPI interface { - CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation insights.TimeSeriesInformation) (result insights.CalculateBaselineResponse, err error) - Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType insights.ResultType) (result insights.BaselineResponse, err error) -} - -var _ MetricBaselineClientAPI = (*insights.MetricBaselineClient)(nil) - // MetricAlertsClientAPI contains the set of methods on the MetricAlertsClient type. type MetricAlertsClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.MetricAlertResource) (result insights.MetricAlertResource, err error) diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/logprofiles.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/logprofiles.go index ad1500b87bc9..cfa5e8be2997 100644 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/logprofiles.go +++ b/services/preview/monitor/mgmt/2018-11-01-preview/insights/logprofiles.go @@ -56,7 +56,9 @@ func (client LogProfilesClient) CreateOrUpdate(ctx context.Context, logProfileNa {Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, }}, - }}}}}); err != nil { + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.LogProfilesClient", "CreateOrUpdate", err.Error()) } @@ -98,7 +100,7 @@ func (client LogProfilesClient) CreateOrUpdatePreparer(ctx context.Context, logP autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -136,6 +138,12 @@ func (client LogProfilesClient) Delete(ctx context.Context, logProfileName strin tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, logProfileName) if err != nil { err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", nil, "Failure preparing request") @@ -173,7 +181,7 @@ func (client LogProfilesClient) DeletePreparer(ctx context.Context, logProfileNa preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -209,6 +217,12 @@ func (client LogProfilesClient) Get(ctx context.Context, logProfileName string) tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, logProfileName) if err != nil { err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Get", nil, "Failure preparing request") @@ -246,7 +260,7 @@ func (client LogProfilesClient) GetPreparer(ctx context.Context, logProfileName preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -281,6 +295,12 @@ func (client LogProfilesClient) List(ctx context.Context) (result LogProfileColl tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "List", err.Error()) + } + req, err := client.ListPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "List", nil, "Failure preparing request") @@ -317,7 +337,7 @@ func (client LogProfilesClient) ListPreparer(ctx context.Context) (*http.Request preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -355,6 +375,12 @@ func (client LogProfilesClient) Update(ctx context.Context, logProfileName strin tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, logProfileName, logProfilesResource) if err != nil { err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Update", nil, "Failure preparing request") @@ -393,7 +419,7 @@ func (client LogProfilesClient) UpdatePreparer(ctx context.Context, logProfileNa autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithJSON(logProfilesResource), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/metricalerts.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/metricalerts.go index 94231b6fa34e..f9706664d9be 100644 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/metricalerts.go +++ b/services/preview/monitor/mgmt/2018-11-01-preview/insights/metricalerts.go @@ -33,7 +33,7 @@ func NewMetricAlertsClientWithBaseURI(baseURI string, subscriptionID string) Met // CreateOrUpdate create or update an metric alert definition. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to create or update. func (client MetricAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource) (result MetricAlertResource, err error) { @@ -48,11 +48,16 @@ func (client MetricAlertsClient) CreateOrUpdate(ctx context.Context, resourceGro }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.MetricAlertProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.MetricAlertProperties.Description", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.Severity", Name: validation.Null, Rule: true, Chain: nil}, + Chain: []validation.Constraint{{Target: "parameters.MetricAlertProperties.Severity", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.MetricAlertProperties.Enabled", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.MetricAlertProperties.Scopes", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.MetricAlertProperties.EvaluationFrequency", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.MetricAlertProperties.WindowSize", Name: validation.Null, Rule: true, Chain: nil}, }}}}}); err != nil { @@ -124,7 +129,7 @@ func (client MetricAlertsClient) CreateOrUpdateResponder(resp *http.Response) (r // Delete delete an alert rule definition. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client MetricAlertsClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -137,6 +142,15 @@ func (client MetricAlertsClient) Delete(ctx context.Context, resourceGroupName s tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", nil, "Failure preparing request") @@ -199,7 +213,7 @@ func (client MetricAlertsClient) DeleteResponder(resp *http.Response) (result au // Get retrieve an alert rule definition. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client MetricAlertsClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertResource, err error) { if tracing.IsEnabled() { @@ -212,6 +226,15 @@ func (client MetricAlertsClient) Get(ctx context.Context, resourceGroupName stri tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Get", nil, "Failure preparing request") @@ -275,7 +298,7 @@ func (client MetricAlertsClient) GetResponder(resp *http.Response) (result Metri // ListByResourceGroup retrieve alert rule definitions in a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client MetricAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result MetricAlertResourceCollection, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.ListByResourceGroup") @@ -287,6 +310,15 @@ func (client MetricAlertsClient) ListByResourceGroup(ctx context.Context, resour tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -359,6 +391,12 @@ func (client MetricAlertsClient) ListBySubscription(ctx context.Context) (result tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "ListBySubscription", err.Error()) + } + req, err := client.ListBySubscriptionPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", nil, "Failure preparing request") @@ -420,7 +458,7 @@ func (client MetricAlertsClient) ListBySubscriptionResponder(resp *http.Response // Update update an metric alert definition. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to update. func (client MetricAlertsClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch) (result MetricAlertResource, err error) { @@ -434,6 +472,15 @@ func (client MetricAlertsClient) Update(ctx context.Context, resourceGroupName s tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Update", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/metricalertsstatus.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/metricalertsstatus.go index 43cfaed42765..4709142160be 100644 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/metricalertsstatus.go +++ b/services/preview/monitor/mgmt/2018-11-01-preview/insights/metricalertsstatus.go @@ -10,6 +10,7 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" "net/http" ) @@ -33,7 +34,7 @@ func NewMetricAlertsStatusClientWithBaseURI(baseURI string, subscriptionID strin // List retrieve an alert rule status. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client MetricAlertsStatusClient) List(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertStatusCollection, err error) { if tracing.IsEnabled() { @@ -46,6 +47,15 @@ func (client MetricAlertsStatusClient) List(ctx context.Context, resourceGroupNa tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsStatusClient", "List", err.Error()) + } + req, err := client.ListPreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "List", nil, "Failure preparing request") @@ -109,7 +119,7 @@ func (client MetricAlertsStatusClient) ListResponder(resp *http.Response) (resul // ListByName retrieve an alert rule status. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // statusName - the name of the status. func (client MetricAlertsStatusClient) ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (result MetricAlertStatusCollection, err error) { @@ -123,6 +133,15 @@ func (client MetricAlertsStatusClient) ListByName(ctx context.Context, resourceG tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsStatusClient", "ListByName", err.Error()) + } + req, err := client.ListByNamePreparer(ctx, resourceGroupName, ruleName, statusName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/metricbaseline.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/metricbaseline.go deleted file mode 100644 index d395fc67bc59..000000000000 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/metricbaseline.go +++ /dev/null @@ -1,217 +0,0 @@ -package insights - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// MetricBaselineClient is the monitor Management Client -type MetricBaselineClient struct { - BaseClient -} - -// NewMetricBaselineClient creates an instance of the MetricBaselineClient client. -func NewMetricBaselineClient(subscriptionID string) MetricBaselineClient { - return NewMetricBaselineClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricBaselineClientWithBaseURI creates an instance of the MetricBaselineClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewMetricBaselineClientWithBaseURI(baseURI string, subscriptionID string) MetricBaselineClient { - return MetricBaselineClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CalculateBaseline **Lists the baseline values for a resource**. -// Parameters: -// resourceURI - 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 -// timeSeriesInformation - information that need to be specified to calculate a baseline on a time series. -func (client MetricBaselineClient) CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (result CalculateBaselineResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricBaselineClient.CalculateBaseline") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: timeSeriesInformation, - Constraints: []validation.Constraint{{Target: "timeSeriesInformation.Sensitivities", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "timeSeriesInformation.Values", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.MetricBaselineClient", "CalculateBaseline", err.Error()) - } - - req, err := client.CalculateBaselinePreparer(ctx, resourceURI, timeSeriesInformation) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", nil, "Failure preparing request") - return - } - - resp, err := client.CalculateBaselineSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure sending request") - return - } - - result, err = client.CalculateBaselineResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure responding to request") - return - } - - return -} - -// CalculateBaselinePreparer prepares the CalculateBaseline request. -func (client MetricBaselineClient) CalculateBaselinePreparer(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/calculatebaseline", pathParameters), - autorest.WithJSON(timeSeriesInformation), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CalculateBaselineSender sends the CalculateBaseline request. The method will close the -// http.Response Body if it receives an error. -func (client MetricBaselineClient) CalculateBaselineSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CalculateBaselineResponder handles the response to the CalculateBaseline request. The method always -// closes the http.Response Body. -func (client MetricBaselineClient) CalculateBaselineResponder(resp *http.Response) (result CalculateBaselineResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get **Gets the baseline values for a specific metric**. -// Parameters: -// resourceURI - 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 -// metricName - the name of the metric to retrieve the baseline for. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// aggregation - the aggregation type of the metric to retrieve the baseline for. -// sensitivities - the list of sensitivities (comma separated) to retrieve. -// resultType - allows retrieving only metadata of the baseline. On data request all information is retrieved. -func (client MetricBaselineClient) Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (result BaselineResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricBaselineClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceURI, metricName, timespan, interval, aggregation, sensitivities, resultType) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client MetricBaselineClient) GetPreparer(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "metricName": autorest.Encode("path", metricName), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if len(sensitivities) > 0 { - queryParameters["sensitivities"] = autorest.Encode("query", sensitivities) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/baseline/{metricName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client MetricBaselineClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client MetricBaselineClient) GetResponder(resp *http.Response) (result BaselineResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/metricdefinitions.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/metricdefinitions.go index 69fc2e0b465a..c316b154fe7e 100644 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/metricdefinitions.go +++ b/services/preview/monitor/mgmt/2018-11-01-preview/insights/metricdefinitions.go @@ -85,7 +85,7 @@ func (client MetricDefinitionsClient) ListPreparer(ctx context.Context, resource preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricDefinitions", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metricDefinitions", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/metrics.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/metrics.go index 97687a09b498..f2329253c944 100644 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/metrics.go +++ b/services/preview/monitor/mgmt/2018-11-01-preview/insights/metrics.go @@ -36,7 +36,8 @@ func NewMetricsClientWithBaseURI(baseURI string, subscriptionID string) MetricsC // timespan - the timespan of the query. It is a string with the following format // 'startDateTime_ISO/endDateTime_ISO'. // interval - the interval (i.e. timegrain) of the query. -// metricnames - the names of the metrics (comma separated) to retrieve. +// metricnames - the names of the metrics (comma separated) to retrieve. Special case: If a metricname itself +// has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be **'Metric%2Name1'** // aggregation - the list of aggregation types (comma separated) to retrieve. // top - the maximum number of records to retrieve. // Valid only if $filter is specified. @@ -44,13 +45,16 @@ func NewMetricsClientWithBaseURI(baseURI string, subscriptionID string) MetricsC // orderby - the aggregation to use for sorting results and the direction of the sort. // Only one order can be specified. // Examples: sum asc. -// 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 -// ‘*’**. +// 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 '*'**. Special case: When +// dimension name or dimension value uses round brackets. Eg: When dimension name is **dim (test) 1** Instead +// of using $filter= "dim (test) 1 eq '*' " use **$filter= "dim %2528test%2529 1 eq '*' "** When dimension name +// is **dim (test) 3** and dimension value is **dim3 (test) val** Instead of using $filter= "dim (test) 3 eq +// 'dim3 (test) val' " use **$filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "** // resultType - reduces the set of data collected. The syntax allowed depends on the operation. See the // operation's description for details. // metricnamespace - metric namespace to query metric definitions for. @@ -128,7 +132,7 @@ func (client MetricsClient) ListPreparer(ctx context.Context, resourceURI string preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metrics", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metrics", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/models.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/models.go index 22dd267978f9..9ee819dd8fe4 100644 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/models.go +++ b/services/preview/monitor/mgmt/2018-11-01-preview/insights/models.go @@ -214,6 +214,10 @@ type ActionGroupResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for ActionGroupResource. @@ -294,6 +298,24 @@ func (agr *ActionGroupResource) UnmarshalJSON(body []byte) error { } agr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + agr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agr.Etag = &etag + } } } @@ -439,6 +461,10 @@ type ActivityLogAlertResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for ActivityLogAlertResource. @@ -519,6 +545,24 @@ func (alar *ActivityLogAlertResource) UnmarshalJSON(body []byte) error { } alar.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + alar.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + alar.Etag = &etag + } } } @@ -587,10 +631,14 @@ type AlertRule struct { Name *string `json:"name,omitempty"` // Description - the description of the alert rule that will be included in the alert email. Description *string `json:"description,omitempty"` + // ProvisioningState - the provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` // IsEnabled - the flag that indicates whether the alert rule is enabled. IsEnabled *bool `json:"isEnabled,omitempty"` // Condition - the condition that results in the alert rule being activated. Condition BasicRuleCondition `json:"condition,omitempty"` + // Action - action that is performed when the alert rule becomes active, and when an alert condition is resolved. + Action BasicRuleAction `json:"action,omitempty"` // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. Actions *[]BasicRuleAction `json:"actions,omitempty"` // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. @@ -606,10 +654,14 @@ func (ar AlertRule) MarshalJSON() ([]byte, error) { if ar.Description != nil { objectMap["description"] = ar.Description } + if ar.ProvisioningState != nil { + objectMap["provisioningState"] = ar.ProvisioningState + } if ar.IsEnabled != nil { objectMap["isEnabled"] = ar.IsEnabled } objectMap["condition"] = ar.Condition + objectMap["action"] = ar.Action if ar.Actions != nil { objectMap["actions"] = ar.Actions } @@ -643,6 +695,15 @@ func (ar *AlertRule) UnmarshalJSON(body []byte) error { } ar.Description = &description } + case "provisioningState": + if v != nil { + var provisioningState string + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + ar.ProvisioningState = &provisioningState + } case "isEnabled": if v != nil { var isEnabled bool @@ -660,6 +721,14 @@ func (ar *AlertRule) UnmarshalJSON(body []byte) error { } ar.Condition = condition } + case "action": + if v != nil { + action, err := unmarshalBasicRuleAction(*v) + if err != nil { + return err + } + ar.Action = action + } case "actions": if v != nil { actions, err := unmarshalBasicRuleActionArray(*v) @@ -698,6 +767,10 @@ type AlertRuleResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for AlertRuleResource. @@ -778,6 +851,24 @@ func (arr *AlertRuleResource) UnmarshalJSON(body []byte) error { } arr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + arr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + arr.Etag = &etag + } } } @@ -905,6 +996,8 @@ type AutoscaleSetting struct { Name *string `json:"name,omitempty"` // TargetResourceURI - the resource identifier of the resource that the autoscale setting should be added to. TargetResourceURI *string `json:"targetResourceUri,omitempty"` + // TargetResourceLocation - the location of the resource that the autoscale setting should be added to. + TargetResourceLocation *string `json:"targetResourceLocation,omitempty"` } // AutoscaleSettingResource the autoscale setting resource. @@ -922,6 +1015,10 @@ type AutoscaleSettingResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for AutoscaleSettingResource. @@ -1002,6 +1099,24 @@ func (asr *AutoscaleSettingResource) UnmarshalJSON(body []byte) error { } asr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + asr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + asr.Etag = &etag + } } } @@ -1251,124 +1366,6 @@ type AzureFunctionReceiver struct { HTTPTriggerURL *string `json:"httpTriggerUrl,omitempty"` } -// Baseline the baseline values for a single sensitivity value. -type Baseline struct { - // Sensitivity - the sensitivity of the baseline. Possible values include: 'SensitivityLow', 'SensitivityMedium', 'SensitivityHigh' - Sensitivity Sensitivity `json:"sensitivity,omitempty"` - // LowThresholds - The low thresholds of the baseline. - LowThresholds *[]float64 `json:"lowThresholds,omitempty"` - // HighThresholds - The high thresholds of the baseline. - HighThresholds *[]float64 `json:"highThresholds,omitempty"` -} - -// BaselineMetadataValue represents a baseline metadata value. -type BaselineMetadataValue struct { - // Name - the name of the metadata. - Name *LocalizableString `json:"name,omitempty"` - // Value - the value of the metadata. - Value *string `json:"value,omitempty"` -} - -// BaselineProperties the baseline properties class. -type BaselineProperties struct { - // 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. - Timespan *string `json:"timespan,omitempty"` - // 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. - Interval *string `json:"interval,omitempty"` - // Aggregation - The aggregation type of the metric. - Aggregation *string `json:"aggregation,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Baseline - the baseline values for each sensitivity. - Baseline *[]Baseline `json:"baseline,omitempty"` - // Metadata - the baseline metadata values. - Metadata *[]BaselineMetadataValue `json:"metadata,omitempty"` -} - -// BaselineResponse the response to a baseline query. -type BaselineResponse struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; the metric baseline Id. - ID *string `json:"id,omitempty"` - // Type - READ-ONLY; the resource type of the baseline resource. - Type *string `json:"type,omitempty"` - // Name - READ-ONLY; the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString `json:"name,omitempty"` - // BaselineProperties - the properties of the baseline. - *BaselineProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for BaselineResponse. -func (br BaselineResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if br.BaselineProperties != nil { - objectMap["properties"] = br.BaselineProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BaselineResponse struct. -func (br *BaselineResponse) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - br.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - br.Type = &typeVar - } - case "name": - if v != nil { - var name LocalizableString - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - br.Name = &name - } - case "properties": - if v != nil { - var baselineProperties BaselineProperties - err = json.Unmarshal(*v, &baselineProperties) - if err != nil { - return err - } - br.BaselineProperties = &baselineProperties - } - } - } - - return nil -} - -// CalculateBaselineResponse the response to a calculate baseline call. -type CalculateBaselineResponse struct { - autorest.Response `json:"-"` - // Type - the resource type of the baseline resource. - Type *string `json:"type,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Baseline - the baseline values for each sensitivity. - Baseline *[]Baseline `json:"baseline,omitempty"` -} - // Criteria specifies the criteria for converting log to metric. type Criteria struct { // MetricName - Name of the metric @@ -1598,8 +1595,8 @@ type DynamicMetricCriteria struct { MetricName *string `json:"metricName,omitempty"` // MetricNamespace - Namespace of the metric. MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` + // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' + TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` // Dimensions - List of dimension conditions. Dimensions *[]MetricDimension `json:"dimensions,omitempty"` // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. @@ -1633,7 +1630,7 @@ func (dmc DynamicMetricCriteria) MarshalJSON() ([]byte, error) { if dmc.MetricNamespace != nil { objectMap["metricNamespace"] = dmc.MetricNamespace } - if dmc.TimeAggregation != nil { + if dmc.TimeAggregation != "" { objectMap["timeAggregation"] = dmc.TimeAggregation } if dmc.Dimensions != nil { @@ -1757,7 +1754,7 @@ func (dmc *DynamicMetricCriteria) UnmarshalJSON(body []byte) error { } case "timeAggregation": if v != nil { - var timeAggregation interface{} + var timeAggregation AggregationTypeEnum err = json.Unmarshal(*v, &timeAggregation) if err != nil { return err @@ -1852,6 +1849,12 @@ type Error struct { Message *string `json:"message,omitempty"` } +// ErrorContract describes the format of Error response. +type ErrorContract struct { + // Error - The error details. + Error *ErrorResponse `json:"error,omitempty"` +} + // ErrorResponse describes the format of Error response. type ErrorResponse struct { // Code - Error code @@ -2263,7 +2266,7 @@ type LogicAppReceiver struct { // LogMetricTrigger a log metrics trigger descriptor. type LogMetricTrigger struct { - // ThresholdOperator - Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' + // ThresholdOperator - Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'ConditionalOperatorGreaterThanOrEqual', 'ConditionalOperatorLessThanOrEqual', 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` // Threshold - The threshold of the metric trigger. Threshold *float64 `json:"threshold,omitempty"` @@ -2309,6 +2312,10 @@ type LogProfileResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for LogProfileResource. @@ -2389,6 +2396,24 @@ func (lpr *LogProfileResource) UnmarshalJSON(body []byte) error { } lpr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + lpr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + lpr.Etag = &etag + } } } @@ -2450,8 +2475,16 @@ func (lprp *LogProfileResourcePatch) UnmarshalJSON(body []byte) error { // LogSearchRule log Search Rule Definition type LogSearchRule struct { + // CreatedWithAPIVersion - READ-ONLY; The api-version used when creating this alert rule + CreatedWithAPIVersion *string `json:"createdWithApiVersion,omitempty"` + // IsLegacyLogAnalyticsRule - READ-ONLY; True if alert rule is legacy Log Analytic rule + IsLegacyLogAnalyticsRule *bool `json:"isLegacyLogAnalyticsRule,omitempty"` // Description - The description of the Log Search rule. Description *string `json:"description,omitempty"` + // DisplayName - The display name of the alert rule + DisplayName *string `json:"displayName,omitempty"` + // AutoMitigate - The flag that indicates whether the alert should be automatically resolved or not. The default is false. + AutoMitigate *bool `json:"autoMitigate,omitempty"` // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'True', 'False' Enabled Enabled `json:"enabled,omitempty"` // LastUpdatedTime - READ-ONLY; Last time the rule was updated in IS08601 format. @@ -2472,6 +2505,12 @@ func (lsr LogSearchRule) MarshalJSON() ([]byte, error) { if lsr.Description != nil { objectMap["description"] = lsr.Description } + if lsr.DisplayName != nil { + objectMap["displayName"] = lsr.DisplayName + } + if lsr.AutoMitigate != nil { + objectMap["autoMitigate"] = lsr.AutoMitigate + } if lsr.Enabled != "" { objectMap["enabled"] = lsr.Enabled } @@ -2494,6 +2533,24 @@ func (lsr *LogSearchRule) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { + case "createdWithApiVersion": + if v != nil { + var createdWithAPIVersion string + err = json.Unmarshal(*v, &createdWithAPIVersion) + if err != nil { + return err + } + lsr.CreatedWithAPIVersion = &createdWithAPIVersion + } + case "isLegacyLogAnalyticsRule": + if v != nil { + var isLegacyLogAnalyticsRule bool + err = json.Unmarshal(*v, &isLegacyLogAnalyticsRule) + if err != nil { + return err + } + lsr.IsLegacyLogAnalyticsRule = &isLegacyLogAnalyticsRule + } case "description": if v != nil { var description string @@ -2503,6 +2560,24 @@ func (lsr *LogSearchRule) UnmarshalJSON(body []byte) error { } lsr.Description = &description } + case "displayName": + if v != nil { + var displayName string + err = json.Unmarshal(*v, &displayName) + if err != nil { + return err + } + lsr.DisplayName = &displayName + } + case "autoMitigate": + if v != nil { + var autoMitigate bool + err = json.Unmarshal(*v, &autoMitigate) + if err != nil { + return err + } + lsr.AutoMitigate = &autoMitigate + } case "enabled": if v != nil { var enabled Enabled @@ -2583,6 +2658,10 @@ type LogSearchRuleResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for LogSearchRuleResource. @@ -2663,6 +2742,24 @@ func (lsrr *LogSearchRuleResource) UnmarshalJSON(body []byte) error { } lsrr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + lsrr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + lsrr.Etag = &etag + } } } @@ -2896,8 +2993,14 @@ type Metric struct { Type *string `json:"type,omitempty"` // Name - the name and the display name of the metric, i.e. it is localizable string. Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' - Unit Unit `json:"unit,omitempty"` + // DisplayDescription - Detailed description of this metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + // ErrorCode - 'Success' or the error details on query failures for this metric. + ErrorCode *string `json:"errorCode,omitempty"` + // ErrorMessage - Error message encountered querying this specific metric. + ErrorMessage *string `json:"errorMessage,omitempty"` + // Unit - The unit of the metric. Possible values include: 'MetricUnitCount', 'MetricUnitBytes', 'MetricUnitSeconds', 'MetricUnitCountPerSecond', 'MetricUnitBytesPerSecond', 'MetricUnitPercent', 'MetricUnitMilliSeconds', 'MetricUnitByteSeconds', 'MetricUnitUnspecified', 'MetricUnitCores', 'MetricUnitMilliCores', 'MetricUnitNanoCores', 'MetricUnitBitsPerSecond' + Unit MetricUnit `json:"unit,omitempty"` // Timeseries - the time series returned when a data query is performed. Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"` } @@ -2906,7 +3009,7 @@ type Metric struct { type MetricAlertAction struct { // ActionGroupID - the id of the action group to use. ActionGroupID *string `json:"actionGroupId,omitempty"` - // WebHookProperties - The properties of a webhook object. + // WebHookProperties - This field allows specifying custom properties, which would be appended to the alert payload sent as input to the webhook. WebHookProperties map[string]*string `json:"webHookProperties"` } @@ -3167,9 +3270,9 @@ type MetricAlertProperties struct { EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. WindowSize *string `json:"windowSize,omitempty"` - // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource. TargetResourceType *string `json:"targetResourceType,omitempty"` - // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource. TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` // Criteria - defines the specific alert criteria information. Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` @@ -3179,6 +3282,8 @@ type MetricAlertProperties struct { Actions *[]MetricAlertAction `json:"actions,omitempty"` // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` + // IsMigrated - READ-ONLY; the value indicating whether this alert rule is migrated. + IsMigrated *bool `json:"isMigrated,omitempty"` } // MarshalJSON is the custom marshaler for MetricAlertProperties. @@ -3334,6 +3439,213 @@ func (mapVar *MetricAlertProperties) UnmarshalJSON(body []byte) error { } mapVar.LastUpdatedTime = &lastUpdatedTime } + case "isMigrated": + if v != nil { + var isMigrated bool + err = json.Unmarshal(*v, &isMigrated) + if err != nil { + return err + } + mapVar.IsMigrated = &isMigrated + } + } + } + + return nil +} + +// MetricAlertPropertiesPatch an alert rule properties for patch. +type MetricAlertPropertiesPatch struct { + // Description - the description of the metric alert that will be included in the alert email. + Description *string `json:"description,omitempty"` + // Severity - Alert severity {0, 1, 2, 3, 4} + Severity *int32 `json:"severity,omitempty"` + // Enabled - the flag that indicates whether the metric alert is enabled. + Enabled *bool `json:"enabled,omitempty"` + // Scopes - the list of resource id's that this metric alert is scoped to. + Scopes *[]string `json:"scopes,omitempty"` + // EvaluationFrequency - how often the metric alert is evaluated represented in ISO 8601 duration format. + EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` + // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. + WindowSize *string `json:"windowSize,omitempty"` + // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + TargetResourceType *string `json:"targetResourceType,omitempty"` + // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` + // Criteria - defines the specific alert criteria information. + Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` + // AutoMitigate - the flag that indicates whether the alert should be auto resolved or not. The default is true. + AutoMitigate *bool `json:"autoMitigate,omitempty"` + // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + Actions *[]MetricAlertAction `json:"actions,omitempty"` + // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. + LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` + // IsMigrated - READ-ONLY; the value indicating whether this alert rule is migrated. + IsMigrated *bool `json:"isMigrated,omitempty"` +} + +// MarshalJSON is the custom marshaler for MetricAlertPropertiesPatch. +func (mapp MetricAlertPropertiesPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mapp.Description != nil { + objectMap["description"] = mapp.Description + } + if mapp.Severity != nil { + objectMap["severity"] = mapp.Severity + } + if mapp.Enabled != nil { + objectMap["enabled"] = mapp.Enabled + } + if mapp.Scopes != nil { + objectMap["scopes"] = mapp.Scopes + } + if mapp.EvaluationFrequency != nil { + objectMap["evaluationFrequency"] = mapp.EvaluationFrequency + } + if mapp.WindowSize != nil { + objectMap["windowSize"] = mapp.WindowSize + } + if mapp.TargetResourceType != nil { + objectMap["targetResourceType"] = mapp.TargetResourceType + } + if mapp.TargetResourceRegion != nil { + objectMap["targetResourceRegion"] = mapp.TargetResourceRegion + } + objectMap["criteria"] = mapp.Criteria + if mapp.AutoMitigate != nil { + objectMap["autoMitigate"] = mapp.AutoMitigate + } + if mapp.Actions != nil { + objectMap["actions"] = mapp.Actions + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MetricAlertPropertiesPatch struct. +func (mapp *MetricAlertPropertiesPatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + mapp.Description = &description + } + case "severity": + if v != nil { + var severity int32 + err = json.Unmarshal(*v, &severity) + if err != nil { + return err + } + mapp.Severity = &severity + } + case "enabled": + if v != nil { + var enabled bool + err = json.Unmarshal(*v, &enabled) + if err != nil { + return err + } + mapp.Enabled = &enabled + } + case "scopes": + if v != nil { + var scopes []string + err = json.Unmarshal(*v, &scopes) + if err != nil { + return err + } + mapp.Scopes = &scopes + } + case "evaluationFrequency": + if v != nil { + var evaluationFrequency string + err = json.Unmarshal(*v, &evaluationFrequency) + if err != nil { + return err + } + mapp.EvaluationFrequency = &evaluationFrequency + } + case "windowSize": + if v != nil { + var windowSize string + err = json.Unmarshal(*v, &windowSize) + if err != nil { + return err + } + mapp.WindowSize = &windowSize + } + case "targetResourceType": + if v != nil { + var targetResourceType string + err = json.Unmarshal(*v, &targetResourceType) + if err != nil { + return err + } + mapp.TargetResourceType = &targetResourceType + } + case "targetResourceRegion": + if v != nil { + var targetResourceRegion string + err = json.Unmarshal(*v, &targetResourceRegion) + if err != nil { + return err + } + mapp.TargetResourceRegion = &targetResourceRegion + } + case "criteria": + if v != nil { + criteria, err := unmarshalBasicMetricAlertCriteria(*v) + if err != nil { + return err + } + mapp.Criteria = criteria + } + case "autoMitigate": + if v != nil { + var autoMitigate bool + err = json.Unmarshal(*v, &autoMitigate) + if err != nil { + return err + } + mapp.AutoMitigate = &autoMitigate + } + case "actions": + if v != nil { + var actions []MetricAlertAction + err = json.Unmarshal(*v, &actions) + if err != nil { + return err + } + mapp.Actions = &actions + } + case "lastUpdatedTime": + if v != nil { + var lastUpdatedTime date.Time + err = json.Unmarshal(*v, &lastUpdatedTime) + if err != nil { + return err + } + mapp.LastUpdatedTime = &lastUpdatedTime + } + case "isMigrated": + if v != nil { + var isMigrated bool + err = json.Unmarshal(*v, &isMigrated) + if err != nil { + return err + } + mapp.IsMigrated = &isMigrated + } } } @@ -3355,6 +3667,10 @@ type MetricAlertResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for MetricAlertResource. @@ -3435,6 +3751,24 @@ func (mar *MetricAlertResource) UnmarshalJSON(body []byte) error { } mar.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + mar.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + mar.Etag = &etag + } } } @@ -3452,8 +3786,8 @@ type MetricAlertResourceCollection struct { type MetricAlertResourcePatch struct { // Tags - Resource tags Tags map[string]*string `json:"tags"` - // MetricAlertProperties - The alert rule properties of the resource. - *MetricAlertProperties `json:"properties,omitempty"` + // MetricAlertPropertiesPatch - The alert rule properties of the resource. + *MetricAlertPropertiesPatch `json:"properties,omitempty"` } // MarshalJSON is the custom marshaler for MetricAlertResourcePatch. @@ -3462,8 +3796,8 @@ func (marp MetricAlertResourcePatch) MarshalJSON() ([]byte, error) { if marp.Tags != nil { objectMap["tags"] = marp.Tags } - if marp.MetricAlertProperties != nil { - objectMap["properties"] = marp.MetricAlertProperties + if marp.MetricAlertPropertiesPatch != nil { + objectMap["properties"] = marp.MetricAlertPropertiesPatch } return json.Marshal(objectMap) } @@ -3488,12 +3822,12 @@ func (marp *MetricAlertResourcePatch) UnmarshalJSON(body []byte) error { } case "properties": if v != nil { - var metricAlertProperties MetricAlertProperties - err = json.Unmarshal(*v, &metricAlertProperties) + var metricAlertPropertiesPatch MetricAlertPropertiesPatch + err = json.Unmarshal(*v, &metricAlertPropertiesPatch) if err != nil { return err } - marp.MetricAlertProperties = &metricAlertProperties + marp.MetricAlertPropertiesPatch = &metricAlertPropertiesPatch } } } @@ -3653,7 +3987,7 @@ type MetricAvailability struct { // MetricCriteria criterion to filter metrics. type MetricCriteria struct { - // Operator - the criteria operator. Possible values include: 'OperatorEquals', 'OperatorNotEquals', 'OperatorGreaterThan', 'OperatorGreaterThanOrEqual', 'OperatorLessThan', 'OperatorLessThanOrEqual' + // Operator - the criteria operator. Possible values include: 'OperatorEquals', 'OperatorGreaterThan', 'OperatorGreaterThanOrEqual', 'OperatorLessThan', 'OperatorLessThanOrEqual' Operator Operator `json:"operator,omitempty"` // Threshold - the criteria threshold value that activates the alert. Threshold *float64 `json:"threshold,omitempty"` @@ -3665,8 +3999,8 @@ type MetricCriteria struct { MetricName *string `json:"metricName,omitempty"` // MetricNamespace - Namespace of the metric. MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` + // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' + TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` // Dimensions - List of dimension conditions. Dimensions *[]MetricDimension `json:"dimensions,omitempty"` // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. @@ -3694,7 +4028,7 @@ func (mc MetricCriteria) MarshalJSON() ([]byte, error) { if mc.MetricNamespace != nil { objectMap["metricNamespace"] = mc.MetricNamespace } - if mc.TimeAggregation != nil { + if mc.TimeAggregation != "" { objectMap["timeAggregation"] = mc.TimeAggregation } if mc.Dimensions != nil { @@ -3800,7 +4134,7 @@ func (mc *MetricCriteria) UnmarshalJSON(body []byte) error { } case "timeAggregation": if v != nil { - var timeAggregation interface{} + var timeAggregation AggregationTypeEnum err = json.Unmarshal(*v, &timeAggregation) if err != nil { return err @@ -3850,8 +4184,14 @@ type MetricDefinition struct { Namespace *string `json:"namespace,omitempty"` // Name - the name and the display name of the metric, i.e. it is a localizable string. Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' - Unit Unit `json:"unit,omitempty"` + // DisplayDescription - Detailed description of this metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + // Category - Custom category name for this metric. + Category *string `json:"category,omitempty"` + // MetricClass - The class of the metric. Possible values include: 'Availability', 'Transactions', 'Errors', 'Latency', 'Saturation' + MetricClass MetricClass `json:"metricClass,omitempty"` + // Unit - The unit of the metric. Possible values include: 'MetricUnitCount', 'MetricUnitBytes', 'MetricUnitSeconds', 'MetricUnitCountPerSecond', 'MetricUnitBytesPerSecond', 'MetricUnitPercent', 'MetricUnitMilliSeconds', 'MetricUnitByteSeconds', 'MetricUnitUnspecified', 'MetricUnitCores', 'MetricUnitMilliCores', 'MetricUnitNanoCores', 'MetricUnitBitsPerSecond' + Unit MetricUnit `json:"unit,omitempty"` // PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' PrimaryAggregationType AggregationType `json:"primaryAggregationType,omitempty"` // SupportedAggregationTypes - the collection of what aggregation types are supported. @@ -3883,12 +4223,14 @@ type MetricDimension struct { // MetricNamespace metric namespace class specifies the metadata for a metric namespace. type MetricNamespace struct { - // ID - The ID of the metricNamespace. + // ID - The ID of the metric namespace. ID *string `json:"id,omitempty"` // Type - The type of the namespace. Type *string `json:"type,omitempty"` - // Name - The name of the namespace. + // Name - The escaped name of the namespace. Name *string `json:"name,omitempty"` + // Classification - Kind of namespace. Possible values include: 'Platform', 'Custom', 'Qos' + Classification NamespaceClassification `json:"classification,omitempty"` // Properties - Properties which include the fully qualified namespace name. Properties *MetricNamespaceName `json:"properties,omitempty"` } @@ -3926,9 +4268,11 @@ type MetricTrigger struct { MetricNamespace *string `json:"metricNamespace,omitempty"` // MetricResourceURI - the resource identifier of the resource the rule monitors. MetricResourceURI *string `json:"metricResourceUri,omitempty"` + // MetricResourceLocation - the location of the resource the rule monitors. + MetricResourceLocation *string `json:"metricResourceLocation,omitempty"` // TimeGrain - 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. TimeGrain *string `json:"timeGrain,omitempty"` - // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum' + // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum', 'MetricStatisticTypeCount' Statistic MetricStatisticType `json:"statistic,omitempty"` // TimeWindow - 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. TimeWindow *string `json:"timeWindow,omitempty"` @@ -3940,6 +4284,8 @@ type MetricTrigger struct { Threshold *float64 `json:"threshold,omitempty"` // Dimensions - List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. Dimensions *[]ScaleRuleMetricDimension `json:"dimensions,omitempty"` + // DividePerInstance - a value indicating whether metric should divide per instance. + DividePerInstance *bool `json:"dividePerInstance,omitempty"` } // MetricValue represents a metric value. @@ -3975,8 +4321,8 @@ type MultiMetricCriteria struct { MetricName *string `json:"metricName,omitempty"` // MetricNamespace - Namespace of the metric. MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` + // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' + TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` // Dimensions - List of dimension conditions. Dimensions *[]MetricDimension `json:"dimensions,omitempty"` // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. @@ -4039,7 +4385,7 @@ func (mmc MultiMetricCriteria) MarshalJSON() ([]byte, error) { if mmc.MetricNamespace != nil { objectMap["metricNamespace"] = mmc.MetricNamespace } - if mmc.TimeAggregation != nil { + if mmc.TimeAggregation != "" { objectMap["timeAggregation"] = mmc.TimeAggregation } if mmc.Dimensions != nil { @@ -4127,7 +4473,7 @@ func (mmc *MultiMetricCriteria) UnmarshalJSON(body []byte) error { } case "timeAggregation": if v != nil { - var timeAggregation interface{} + var timeAggregation AggregationTypeEnum err = json.Unmarshal(*v, &timeAggregation) if err != nil { return err @@ -4260,6 +4606,10 @@ type Resource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for Resource. @@ -4277,15 +4627,15 @@ func (r Resource) MarshalJSON() ([]byte, error) { // Response the response to a metrics query. type Response struct { autorest.Response `json:"-"` - // Cost - The integer value representing the cost of the query, for data case. + // Cost - The integer value representing the relative cost of the query. Cost *float64 `json:"cost,omitempty"` // 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. Timespan *string `json:"timespan,omitempty"` // 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. Interval *string `json:"interval,omitempty"` - // Namespace - The namespace of the metrics been queried + // Namespace - The namespace of the metrics being queried Namespace *string `json:"namespace,omitempty"` - // Resourceregion - The region of the resource been queried for metrics. + // Resourceregion - The region of the resource being queried for metrics. Resourceregion *string `json:"resourceregion,omitempty"` // Value - the value of the collection. Value *[]Metric `json:"value,omitempty"` @@ -4531,6 +4881,12 @@ type BasicRuleDataSource interface { type RuleDataSource struct { // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' OdataType OdataType `json:"odata.type,omitempty"` } @@ -4583,6 +4939,15 @@ func (rds RuleDataSource) MarshalJSON() ([]byte, error) { if rds.ResourceURI != nil { objectMap["resourceUri"] = rds.ResourceURI } + if rds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rds.LegacyResourceID + } + if rds.ResourceLocation != nil { + objectMap["resourceLocation"] = rds.ResourceLocation + } + if rds.MetricNamespace != nil { + objectMap["metricNamespace"] = rds.MetricNamespace + } if rds.OdataType != "" { objectMap["odata.type"] = rds.OdataType } @@ -4685,6 +5050,12 @@ type RuleManagementEventDataSource struct { Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' OdataType OdataType `json:"odata.type,omitempty"` } @@ -4723,6 +5094,15 @@ func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { if rmeds.ResourceURI != nil { objectMap["resourceUri"] = rmeds.ResourceURI } + if rmeds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rmeds.LegacyResourceID + } + if rmeds.ResourceLocation != nil { + objectMap["resourceLocation"] = rmeds.ResourceLocation + } + if rmeds.MetricNamespace != nil { + objectMap["metricNamespace"] = rmeds.MetricNamespace + } if rmeds.OdataType != "" { objectMap["odata.type"] = rmeds.OdataType } @@ -4756,6 +5136,12 @@ type RuleMetricDataSource struct { MetricName *string `json:"metricName,omitempty"` // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' OdataType OdataType `json:"odata.type,omitempty"` } @@ -4770,6 +5156,15 @@ func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) { if rmds.ResourceURI != nil { objectMap["resourceUri"] = rmds.ResourceURI } + if rmds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rmds.LegacyResourceID + } + if rmds.ResourceLocation != nil { + objectMap["resourceLocation"] = rmds.ResourceLocation + } + if rmds.MetricNamespace != nil { + objectMap["metricNamespace"] = rmds.MetricNamespace + } if rmds.OdataType != "" { objectMap["odata.type"] = rmds.OdataType } @@ -4847,7 +5242,7 @@ func (rwa RuleWebhookAction) AsBasicRuleAction() (BasicRuleAction, bool) { type ScaleAction struct { // Direction - the scale direction. Whether the scaling action increases or decreases the number of instances. Possible values include: 'ScaleDirectionNone', 'ScaleDirectionIncrease', 'ScaleDirectionDecrease' Direction ScaleDirection `json:"direction,omitempty"` - // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount' + // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount', 'ServiceAllowedNextValue' Type ScaleType `json:"type,omitempty"` // Value - the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1. Value *string `json:"value,omitempty"` @@ -5082,16 +5477,6 @@ type TimeSeriesElement struct { Data *[]MetricValue `json:"data,omitempty"` } -// TimeSeriesInformation the time series info needed for calculating the baseline. -type TimeSeriesInformation struct { - // Sensitivities - the list of sensitivities for calculating the baseline. - Sensitivities *[]string `json:"sensitivities,omitempty"` - // Values - The metric values to calculate the baseline. - Values *[]float64 `json:"values,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` -} - // TimeWindow a specific date-time for the profile. type TimeWindow struct { // TimeZone - 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 @@ -5104,7 +5489,7 @@ type TimeWindow struct { // TriggerCondition the condition that results in the Log Search rule. type TriggerCondition struct { - // ThresholdOperator - Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' + // ThresholdOperator - Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'ConditionalOperatorGreaterThanOrEqual', 'ConditionalOperatorLessThanOrEqual', 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` // Threshold - Result or count threshold based on which rule should be triggered. Threshold *float64 `json:"threshold,omitempty"` diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/operations.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/operations.go index 3f82351c7f23..afb74dc9248f 100644 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/operations.go +++ b/services/preview/monitor/mgmt/2018-11-01-preview/insights/operations.go @@ -74,7 +74,7 @@ func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/operations"), + autorest.WithPath("/providers/Microsoft.Insights/operations"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/scheduledqueryrules.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/scheduledqueryrules.go index c9d43964ecb0..22b09a5f8997 100644 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/scheduledqueryrules.go +++ b/services/preview/monitor/mgmt/2018-11-01-preview/insights/scheduledqueryrules.go @@ -34,7 +34,7 @@ func NewScheduledQueryRulesClientWithBaseURI(baseURI string, subscriptionID stri // CreateOrUpdate creates or updates an log search rule. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to create or update. func (client ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResource) (result LogSearchRuleResource, err error) { @@ -49,6 +49,11 @@ func (client ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, reso }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.LogSearchRule", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source", Name: validation.Null, Rule: true, @@ -100,7 +105,7 @@ func (client ScheduledQueryRulesClient) CreateOrUpdatePreparer(ctx context.Conte autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -126,7 +131,7 @@ func (client ScheduledQueryRulesClient) CreateOrUpdateResponder(resp *http.Respo // Delete deletes a Log Search rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client ScheduledQueryRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -139,6 +144,15 @@ func (client ScheduledQueryRulesClient) Delete(ctx context.Context, resourceGrou tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", nil, "Failure preparing request") @@ -177,7 +191,7 @@ func (client ScheduledQueryRulesClient) DeletePreparer(ctx context.Context, reso preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -201,7 +215,7 @@ func (client ScheduledQueryRulesClient) DeleteResponder(resp *http.Response) (re // Get gets an Log Search rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client ScheduledQueryRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result LogSearchRuleResource, err error) { if tracing.IsEnabled() { @@ -214,6 +228,15 @@ func (client ScheduledQueryRulesClient) Get(ctx context.Context, resourceGroupNa tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Get", nil, "Failure preparing request") @@ -252,7 +275,7 @@ func (client ScheduledQueryRulesClient) GetPreparer(ctx context.Context, resourc preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -277,7 +300,7 @@ func (client ScheduledQueryRulesClient) GetResponder(resp *http.Response) (resul // ListByResourceGroup list the Log Search rules within a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // filter - the filter to apply on the operation. For more information please see // https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx func (client ScheduledQueryRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result LogSearchRuleResourceCollection, err error) { @@ -291,6 +314,15 @@ func (client ScheduledQueryRulesClient) ListByResourceGroup(ctx context.Context, tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -331,7 +363,7 @@ func (client ScheduledQueryRulesClient) ListByResourceGroupPreparer(ctx context. preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -369,6 +401,12 @@ func (client ScheduledQueryRulesClient) ListBySubscription(ctx context.Context, tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "ListBySubscription", err.Error()) + } + req, err := client.ListBySubscriptionPreparer(ctx, filter) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", nil, "Failure preparing request") @@ -408,7 +446,7 @@ func (client ScheduledQueryRulesClient) ListBySubscriptionPreparer(ctx context.C preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/scheduledQueryRules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -433,7 +471,7 @@ func (client ScheduledQueryRulesClient) ListBySubscriptionResponder(resp *http.R // Update update log search Rule. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to update. func (client ScheduledQueryRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResourcePatch) (result LogSearchRuleResource, err error) { @@ -447,6 +485,15 @@ func (client ScheduledQueryRulesClient) Update(ctx context.Context, resourceGrou tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Update", nil, "Failure preparing request") @@ -486,7 +533,7 @@ func (client ScheduledQueryRulesClient) UpdatePreparer(ctx context.Context, reso autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/tenantactivitylogs.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/tenantactivitylogs.go index 7501f047bb38..7c6ee7981381 100644 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/tenantactivitylogs.go +++ b/services/preview/monitor/mgmt/2018-11-01-preview/insights/tenantactivitylogs.go @@ -107,7 +107,7 @@ func (client TenantActivityLogsClient) ListPreparer(ctx context.Context, filter preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventtypes/management/values"), + autorest.WithPath("/providers/Microsoft.Insights/eventtypes/management/values"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/CHANGELOG.md b/services/preview/monitor/mgmt/2019-03-01/insights/CHANGELOG.md index 52911e4cc5e4..dfb951ae4033 100644 --- a/services/preview/monitor/mgmt/2019-03-01/insights/CHANGELOG.md +++ b/services/preview/monitor/mgmt/2019-03-01/insights/CHANGELOG.md @@ -1,2 +1,167 @@ -# Change History +# Unreleased +## Breaking Changes + +### Removed Constants + +1. Operator.OperatorNotEquals +1. Sensitivity.SensitivityHigh +1. Sensitivity.SensitivityLow +1. Sensitivity.SensitivityMedium +1. Unit.UnitBitsPerSecond +1. Unit.UnitByteSeconds +1. Unit.UnitBytes +1. Unit.UnitBytesPerSecond +1. Unit.UnitCores +1. Unit.UnitCount +1. Unit.UnitCountPerSecond +1. Unit.UnitMilliCores +1. Unit.UnitMilliSeconds +1. Unit.UnitNanoCores +1. Unit.UnitPercent +1. Unit.UnitSeconds +1. Unit.UnitUnspecified + +### Removed Funcs + +1. *BaselineResponse.UnmarshalJSON([]byte) error +1. BaselineResponse.MarshalJSON() ([]byte, error) +1. MetricBaselineClient.CalculateBaseline(context.Context, string, TimeSeriesInformation) (CalculateBaselineResponse, error) +1. MetricBaselineClient.CalculateBaselinePreparer(context.Context, string, TimeSeriesInformation) (*http.Request, error) +1. MetricBaselineClient.CalculateBaselineResponder(*http.Response) (CalculateBaselineResponse, error) +1. MetricBaselineClient.CalculateBaselineSender(*http.Request) (*http.Response, error) +1. MetricBaselineClient.Get(context.Context, string, string, string, *string, string, string, ResultType) (BaselineResponse, error) +1. MetricBaselineClient.GetPreparer(context.Context, string, string, string, *string, string, string, ResultType) (*http.Request, error) +1. MetricBaselineClient.GetResponder(*http.Response) (BaselineResponse, error) +1. MetricBaselineClient.GetSender(*http.Request) (*http.Response, error) +1. NewMetricBaselineClient(string) MetricBaselineClient +1. NewMetricBaselineClientWithBaseURI(string, string) MetricBaselineClient +1. PossibleSensitivityValues() []Sensitivity +1. PossibleUnitValues() []Unit + +### Struct Changes + +#### Removed Structs + +1. Baseline +1. BaselineMetadataValue +1. BaselineProperties +1. BaselineResponse +1. CalculateBaselineResponse +1. MetricBaselineClient +1. TimeSeriesInformation + +#### Removed Struct Fields + +1. MetricAlertResourcePatch.*MetricAlertProperties +1. TimeSeriesBaseline.Metadata + +### Signature Changes + +#### Struct Fields + +1. DynamicMetricCriteria.TimeAggregation changed type from interface{} to AggregationTypeEnum +1. Metric.Unit changed type from Unit to MetricUnit +1. MetricCriteria.TimeAggregation changed type from interface{} to AggregationTypeEnum +1. MetricDefinition.Unit changed type from Unit to MetricUnit +1. MultiMetricCriteria.TimeAggregation changed type from interface{} to AggregationTypeEnum + +## Additive Changes + +### New Constants + +1. AggregationTypeEnum.AggregationTypeEnumAverage +1. AggregationTypeEnum.AggregationTypeEnumCount +1. AggregationTypeEnum.AggregationTypeEnumMaximum +1. AggregationTypeEnum.AggregationTypeEnumMinimum +1. AggregationTypeEnum.AggregationTypeEnumTotal +1. ConditionalOperator.ConditionalOperatorGreaterThanOrEqual +1. ConditionalOperator.ConditionalOperatorLessThanOrEqual +1. MetricClass.Availability +1. MetricClass.Errors +1. MetricClass.Latency +1. MetricClass.Saturation +1. MetricClass.Transactions +1. MetricStatisticType.MetricStatisticTypeCount +1. MetricUnit.MetricUnitBitsPerSecond +1. MetricUnit.MetricUnitByteSeconds +1. MetricUnit.MetricUnitBytes +1. MetricUnit.MetricUnitBytesPerSecond +1. MetricUnit.MetricUnitCores +1. MetricUnit.MetricUnitCount +1. MetricUnit.MetricUnitCountPerSecond +1. MetricUnit.MetricUnitMilliCores +1. MetricUnit.MetricUnitMilliSeconds +1. MetricUnit.MetricUnitNanoCores +1. MetricUnit.MetricUnitPercent +1. MetricUnit.MetricUnitSeconds +1. MetricUnit.MetricUnitUnspecified +1. NamespaceClassification.Custom +1. NamespaceClassification.Platform +1. NamespaceClassification.Qos +1. ScaleType.ServiceAllowedNextValue + +### New Funcs + +1. *MetricAlertPropertiesPatch.UnmarshalJSON([]byte) error +1. AzureResource.MarshalJSON() ([]byte, error) +1. MetricAlertPropertiesPatch.MarshalJSON() ([]byte, error) +1. PossibleAggregationTypeEnumValues() []AggregationTypeEnum +1. PossibleMetricClassValues() []MetricClass +1. PossibleMetricUnitValues() []MetricUnit +1. PossibleNamespaceClassificationValues() []NamespaceClassification + +### Struct Changes + +#### New Structs + +1. AzureResource +1. ErrorContract +1. MetricAlertPropertiesPatch + +#### New Struct Fields + +1. ActionGroupResource.Identity +1. ActionGroupResource.Kind +1. ActivityLogAlertResource.Etag +1. ActivityLogAlertResource.Kind +1. AlertRule.Action +1. AlertRule.ProvisioningState +1. AlertRuleResource.Etag +1. AlertRuleResource.Kind +1. AutoscaleSetting.TargetResourceLocation +1. AutoscaleSettingResource.Etag +1. AutoscaleSettingResource.Kind +1. LogProfileResource.Etag +1. LogProfileResource.Kind +1. LogSearchRule.AutoMitigate +1. LogSearchRule.CreatedWithAPIVersion +1. LogSearchRule.DisplayName +1. LogSearchRule.IsLegacyLogAnalyticsRule +1. LogSearchRuleResource.Etag +1. LogSearchRuleResource.Kind +1. Metric.DisplayDescription +1. Metric.ErrorCode +1. Metric.ErrorMessage +1. MetricAlertProperties.IsMigrated +1. MetricAlertResource.Etag +1. MetricAlertResource.Kind +1. MetricAlertResourcePatch.*MetricAlertPropertiesPatch +1. MetricDefinition.Category +1. MetricDefinition.DisplayDescription +1. MetricDefinition.MetricClass +1. MetricNamespace.Classification +1. MetricTrigger.DividePerInstance +1. MetricTrigger.MetricResourceLocation +1. Resource.Etag +1. Resource.Kind +1. RuleDataSource.LegacyResourceID +1. RuleDataSource.MetricNamespace +1. RuleDataSource.ResourceLocation +1. RuleManagementEventDataSource.LegacyResourceID +1. RuleManagementEventDataSource.MetricNamespace +1. RuleManagementEventDataSource.ResourceLocation +1. RuleMetricDataSource.LegacyResourceID +1. RuleMetricDataSource.MetricNamespace +1. RuleMetricDataSource.ResourceLocation +1. TimeSeriesBaseline.MetadataValues diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/_meta.json b/services/preview/monitor/mgmt/2019-03-01/insights/_meta.json index 332ce7a9eee8..a6ab7912f30f 100644 --- a/services/preview/monitor/mgmt/2019-03-01/insights/_meta.json +++ b/services/preview/monitor/mgmt/2019-03-01/insights/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "83f6c7b9ac240d3862e909245f0a61d70ae33908", "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", "tag": "package-2019-03", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/actiongroups.go b/services/preview/monitor/mgmt/2019-03-01/insights/actiongroups.go index 02b8400fdcc0..76d5197c7cec 100644 --- a/services/preview/monitor/mgmt/2019-03-01/insights/actiongroups.go +++ b/services/preview/monitor/mgmt/2019-03-01/insights/actiongroups.go @@ -33,7 +33,7 @@ func NewActionGroupsClientWithBaseURI(baseURI string, subscriptionID string) Act // CreateOrUpdate create a new action group or update an existing one. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. // actionGroup - the action group to create or use for the update. func (client ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (result ActionGroupResource, err error) { @@ -48,12 +48,17 @@ func (client ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGro }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: actionGroup, Constraints: []validation.Constraint{{Target: "actionGroup.ActionGroup", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.MaxLength, Rule: 12, Chain: nil}}}, {Target: "actionGroup.ActionGroup.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ActionGroupsClient", "CreateOrUpdate", err.Error()) } @@ -122,7 +127,7 @@ func (client ActionGroupsClient) CreateOrUpdateResponder(resp *http.Response) (r // Delete delete an action group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. func (client ActionGroupsClient) Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -135,6 +140,15 @@ func (client ActionGroupsClient) Delete(ctx context.Context, resourceGroupName s tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, actionGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", nil, "Failure preparing request") @@ -198,7 +212,7 @@ func (client ActionGroupsClient) DeleteResponder(resp *http.Response) (result au // EnableReceiver 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. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. // enableRequest - the receiver to re-enable. func (client ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (result autorest.Response, err error) { @@ -213,8 +227,13 @@ func (client ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGro }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: enableRequest, - Constraints: []validation.Constraint{{Target: "enableRequest.ReceiverName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "enableRequest.ReceiverName", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ActionGroupsClient", "EnableReceiver", err.Error()) } @@ -282,7 +301,7 @@ func (client ActionGroupsClient) EnableReceiverResponder(resp *http.Response) (r // Get get an action group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. func (client ActionGroupsClient) Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result ActionGroupResource, err error) { if tracing.IsEnabled() { @@ -295,6 +314,15 @@ func (client ActionGroupsClient) Get(ctx context.Context, resourceGroupName stri tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, actionGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Get", nil, "Failure preparing request") @@ -358,7 +386,7 @@ func (client ActionGroupsClient) GetResponder(resp *http.Response) (result Actio // ListByResourceGroup get a list of all action groups in a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client ActionGroupsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActionGroupList, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.ListByResourceGroup") @@ -370,6 +398,15 @@ func (client ActionGroupsClient) ListByResourceGroup(ctx context.Context, resour tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -442,6 +479,12 @@ func (client ActionGroupsClient) ListBySubscriptionID(ctx context.Context) (resu tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "ListBySubscriptionID", err.Error()) + } + req, err := client.ListBySubscriptionIDPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", nil, "Failure preparing request") @@ -503,7 +546,7 @@ func (client ActionGroupsClient) ListBySubscriptionIDResponder(resp *http.Respon // Update updates an existing action group's tags. To update other fields use the CreateOrUpdate method. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. // actionGroupPatch - parameters supplied to the operation. func (client ActionGroupsClient) Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (result ActionGroupResource, err error) { @@ -517,6 +560,15 @@ func (client ActionGroupsClient) Update(ctx context.Context, resourceGroupName s tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, actionGroupName, actionGroupPatch) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Update", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/activitylogalerts.go b/services/preview/monitor/mgmt/2019-03-01/insights/activitylogalerts.go index 44aaf3ef1e4a..f897b08a6f0c 100644 --- a/services/preview/monitor/mgmt/2019-03-01/insights/activitylogalerts.go +++ b/services/preview/monitor/mgmt/2019-03-01/insights/activitylogalerts.go @@ -34,7 +34,7 @@ func NewActivityLogAlertsClientWithBaseURI(baseURI string, subscriptionID string // CreateOrUpdate create a new activity log alert or update an existing one. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // activityLogAlertName - the name of the activity log alert. // activityLogAlert - the activity log alert to create or use for the update. func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (result ActivityLogAlertResource, err error) { @@ -49,6 +49,11 @@ func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resour }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: activityLogAlert, Constraints: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Scopes", Name: validation.Null, Rule: true, Chain: nil}, @@ -124,7 +129,7 @@ func (client ActivityLogAlertsClient) CreateOrUpdateResponder(resp *http.Respons // Delete delete an activity log alert. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // activityLogAlertName - the name of the activity log alert. func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -137,6 +142,15 @@ func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupN tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, activityLogAlertName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", nil, "Failure preparing request") @@ -199,7 +213,7 @@ func (client ActivityLogAlertsClient) DeleteResponder(resp *http.Response) (resu // Get get an activity log alert. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // activityLogAlertName - the name of the activity log alert. func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result ActivityLogAlertResource, err error) { if tracing.IsEnabled() { @@ -212,6 +226,15 @@ func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, activityLogAlertName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Get", nil, "Failure preparing request") @@ -275,7 +298,7 @@ func (client ActivityLogAlertsClient) GetResponder(resp *http.Response) (result // ListByResourceGroup get a list of all activity log alerts in a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActivityLogAlertList, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.ListByResourceGroup") @@ -287,6 +310,15 @@ func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, r tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -359,6 +391,12 @@ func (client ActivityLogAlertsClient) ListBySubscriptionID(ctx context.Context) tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "ListBySubscriptionID", err.Error()) + } + req, err := client.ListBySubscriptionIDPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", nil, "Failure preparing request") @@ -420,7 +458,7 @@ func (client ActivityLogAlertsClient) ListBySubscriptionIDResponder(resp *http.R // Update updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // activityLogAlertName - the name of the activity log alert. // activityLogAlertPatch - parameters supplied to the operation. func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (result ActivityLogAlertResource, err error) { @@ -434,6 +472,15 @@ func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupN tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, activityLogAlertName, activityLogAlertPatch) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Update", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/activitylogs.go b/services/preview/monitor/mgmt/2019-03-01/insights/activitylogs.go index 16dd215e6ad9..fc6927fa0e16 100644 --- a/services/preview/monitor/mgmt/2019-03-01/insights/activitylogs.go +++ b/services/preview/monitor/mgmt/2019-03-01/insights/activitylogs.go @@ -10,6 +10,7 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" "net/http" ) @@ -60,6 +61,12 @@ func (client ActivityLogsClient) List(ctx context.Context, filter string, select tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogsClient", "List", err.Error()) + } + result.fn = client.listNextResults req, err := client.ListPreparer(ctx, filter, selectParameter) if err != nil { @@ -105,7 +112,7 @@ func (client ActivityLogsClient) ListPreparer(ctx context.Context, filter string preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/eventtypes/management/values", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/eventtypes/management/values", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/alertruleincidents.go b/services/preview/monitor/mgmt/2019-03-01/insights/alertruleincidents.go index c3bf26828d8e..a7dcd9cba31e 100644 --- a/services/preview/monitor/mgmt/2019-03-01/insights/alertruleincidents.go +++ b/services/preview/monitor/mgmt/2019-03-01/insights/alertruleincidents.go @@ -10,6 +10,7 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" "net/http" ) @@ -33,7 +34,7 @@ func NewAlertRuleIncidentsClientWithBaseURI(baseURI string, subscriptionID strin // Get gets an incident associated to an alert rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // incidentName - the name of the incident to retrieve. func (client AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result Incident, err error) { @@ -47,6 +48,15 @@ func (client AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupNam tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRuleIncidentsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName, incidentName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "Get", nil, "Failure preparing request") @@ -111,7 +121,7 @@ func (client AlertRuleIncidentsClient) GetResponder(resp *http.Response) (result // ListByAlertRule gets a list of incidents associated to an alert rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client AlertRuleIncidentsClient) ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result IncidentListResult, err error) { if tracing.IsEnabled() { @@ -124,6 +134,15 @@ func (client AlertRuleIncidentsClient) ListByAlertRule(ctx context.Context, reso tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRuleIncidentsClient", "ListByAlertRule", err.Error()) + } + req, err := client.ListByAlertRulePreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/alertrules.go b/services/preview/monitor/mgmt/2019-03-01/insights/alertrules.go index f5a2ab682384..888ed122e267 100644 --- a/services/preview/monitor/mgmt/2019-03-01/insights/alertrules.go +++ b/services/preview/monitor/mgmt/2019-03-01/insights/alertrules.go @@ -33,7 +33,7 @@ func NewAlertRulesClientWithBaseURI(baseURI string, subscriptionID string) Alert // CreateOrUpdate creates or updates a classic metric alert rule. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to create or update. func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (result AlertRuleResource, err error) { @@ -48,11 +48,16 @@ func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroup }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.AlertRule", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.AlertRule.Name", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.AlertRule.IsEnabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AlertRulesClient", "CreateOrUpdate", err.Error()) } @@ -95,7 +100,7 @@ func (client AlertRulesClient) CreateOrUpdatePreparer(ctx context.Context, resou autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -121,7 +126,7 @@ func (client AlertRulesClient) CreateOrUpdateResponder(resp *http.Response) (res // Delete deletes a classic metric alert rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -134,6 +139,15 @@ func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName str tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", nil, "Failure preparing request") @@ -172,7 +186,7 @@ func (client AlertRulesClient) DeletePreparer(ctx context.Context, resourceGroup preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -196,7 +210,7 @@ func (client AlertRulesClient) DeleteResponder(resp *http.Response) (result auto // Get gets a classic metric alert rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result AlertRuleResource, err error) { if tracing.IsEnabled() { @@ -209,6 +223,15 @@ func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Get", nil, "Failure preparing request") @@ -247,7 +270,7 @@ func (client AlertRulesClient) GetPreparer(ctx context.Context, resourceGroupNam preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -272,7 +295,7 @@ func (client AlertRulesClient) GetResponder(resp *http.Response) (result AlertRu // ListByResourceGroup list the classic metric alert rules within a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client AlertRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AlertRuleResourceCollection, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.ListByResourceGroup") @@ -284,6 +307,15 @@ func (client AlertRulesClient) ListByResourceGroup(ctx context.Context, resource tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -321,7 +353,7 @@ func (client AlertRulesClient) ListByResourceGroupPreparer(ctx context.Context, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -356,6 +388,12 @@ func (client AlertRulesClient) ListBySubscription(ctx context.Context) (result A tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "ListBySubscription", err.Error()) + } + req, err := client.ListBySubscriptionPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", nil, "Failure preparing request") @@ -392,7 +430,7 @@ func (client AlertRulesClient) ListBySubscriptionPreparer(ctx context.Context) ( preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/alertrules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -417,7 +455,7 @@ func (client AlertRulesClient) ListBySubscriptionResponder(resp *http.Response) // Update updates an existing classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // alertRulesResource - parameters supplied to the operation. func (client AlertRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (result AlertRuleResource, err error) { @@ -431,6 +469,15 @@ func (client AlertRulesClient) Update(ctx context.Context, resourceGroupName str tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, alertRulesResource) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Update", nil, "Failure preparing request") @@ -470,7 +517,7 @@ func (client AlertRulesClient) UpdatePreparer(ctx context.Context, resourceGroup autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithJSON(alertRulesResource), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/autoscalesettings.go b/services/preview/monitor/mgmt/2019-03-01/insights/autoscalesettings.go index 86f253d0fb89..d9118bd2d049 100644 --- a/services/preview/monitor/mgmt/2019-03-01/insights/autoscalesettings.go +++ b/services/preview/monitor/mgmt/2019-03-01/insights/autoscalesettings.go @@ -34,7 +34,7 @@ func NewAutoscaleSettingsClientWithBaseURI(baseURI string, subscriptionID string // CreateOrUpdate creates or updates an autoscale setting. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // autoscaleSettingName - the autoscale setting name. // parameters - parameters supplied to the operation. func (client AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (result AutoscaleSettingResource, err error) { @@ -49,11 +49,16 @@ func (client AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resour }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.AutoscaleSetting", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.MaxItems, Rule: 20, Chain: nil}}}, - }}}}}); err != nil { + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AutoscaleSettingsClient", "CreateOrUpdate", err.Error()) } @@ -96,7 +101,7 @@ func (client AutoscaleSettingsClient) CreateOrUpdatePreparer(ctx context.Context autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -122,7 +127,7 @@ func (client AutoscaleSettingsClient) CreateOrUpdateResponder(resp *http.Respons // Delete deletes and autoscale setting // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // autoscaleSettingName - the autoscale setting name. func (client AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -135,6 +140,15 @@ func (client AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupN tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, autoscaleSettingName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", nil, "Failure preparing request") @@ -173,7 +187,7 @@ func (client AutoscaleSettingsClient) DeletePreparer(ctx context.Context, resour preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -197,7 +211,7 @@ func (client AutoscaleSettingsClient) DeleteResponder(resp *http.Response) (resu // Get gets an autoscale setting // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // autoscaleSettingName - the autoscale setting name. func (client AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result AutoscaleSettingResource, err error) { if tracing.IsEnabled() { @@ -210,6 +224,15 @@ func (client AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, autoscaleSettingName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Get", nil, "Failure preparing request") @@ -248,7 +271,7 @@ func (client AutoscaleSettingsClient) GetPreparer(ctx context.Context, resourceG preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -273,7 +296,7 @@ func (client AutoscaleSettingsClient) GetResponder(resp *http.Response) (result // ListByResourceGroup lists the autoscale settings for a resource group // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client AutoscaleSettingsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.ListByResourceGroup") @@ -285,6 +308,15 @@ func (client AutoscaleSettingsClient) ListByResourceGroup(ctx context.Context, r tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "ListByResourceGroup", err.Error()) + } + result.fn = client.listByResourceGroupNextResults req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { @@ -327,7 +359,7 @@ func (client AutoscaleSettingsClient) ListByResourceGroupPreparer(ctx context.Co preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -399,6 +431,12 @@ func (client AutoscaleSettingsClient) ListBySubscription(ctx context.Context) (r tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "ListBySubscription", err.Error()) + } + result.fn = client.listBySubscriptionNextResults req, err := client.ListBySubscriptionPreparer(ctx) if err != nil { @@ -440,7 +478,7 @@ func (client AutoscaleSettingsClient) ListBySubscriptionPreparer(ctx context.Con preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/autoscalesettings", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -502,7 +540,7 @@ func (client AutoscaleSettingsClient) ListBySubscriptionComplete(ctx context.Con // Update updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // autoscaleSettingName - the autoscale setting name. // autoscaleSettingResource - parameters supplied to the operation. func (client AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (result AutoscaleSettingResource, err error) { @@ -516,6 +554,15 @@ func (client AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupN tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, autoscaleSettingName, autoscaleSettingResource) if err != nil { err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Update", nil, "Failure preparing request") @@ -555,7 +602,7 @@ func (client AutoscaleSettingsClient) UpdatePreparer(ctx context.Context, resour autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithJSON(autoscaleSettingResource), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/baselines.go b/services/preview/monitor/mgmt/2019-03-01/insights/baselines.go index fd77a7d29721..1ead7936040e 100644 --- a/services/preview/monitor/mgmt/2019-03-01/insights/baselines.go +++ b/services/preview/monitor/mgmt/2019-03-01/insights/baselines.go @@ -33,20 +33,24 @@ func NewBaselinesClientWithBaseURI(baseURI string, subscriptionID string) Baseli // List **Lists the metric baseline values for a resource**. // Parameters: // resourceURI - the identifier of the resource. -// metricnames - the names of the metrics (comma separated) to retrieve. +// metricnames - the names of the metrics (comma separated) to retrieve. Special case: If a metricname itself +// has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be **'Metric%2Name1'** // metricnamespace - metric namespace to query metric definitions for. // timespan - the timespan of the query. It is a string with the following format // 'startDateTime_ISO/endDateTime_ISO'. // interval - the interval (i.e. timegrain) of the query. // aggregation - the list of aggregation types (comma separated) to retrieve. // sensitivities - the list of sensitivities (comma separated) to retrieve. -// 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 -// ‘*’**. +// 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 '*'**. Special case: When +// dimension name or dimension value uses round brackets. Eg: When dimension name is **dim (test) 1** Instead +// of using $filter= "dim (test) 1 eq '*' " use **$filter= "dim %2528test%2529 1 eq '*' "** When dimension name +// is **dim (test) 3** and dimension value is **dim3 (test) val** Instead of using $filter= "dim (test) 3 eq +// 'dim3 (test) val' " use **$filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "** // resultType - allows retrieving only metadata of the baseline. On data request all information is retrieved. func (client BaselinesClient) List(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType ResultType) (result MetricBaselinesResponse, err error) { if tracing.IsEnabled() { @@ -119,7 +123,7 @@ func (client BaselinesClient) ListPreparer(ctx context.Context, resourceURI stri preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricBaselines", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metricBaselines", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/diagnosticsettings.go b/services/preview/monitor/mgmt/2019-03-01/insights/diagnosticsettings.go index 9708c52c2499..db8aa282d0f3 100644 --- a/services/preview/monitor/mgmt/2019-03-01/insights/diagnosticsettings.go +++ b/services/preview/monitor/mgmt/2019-03-01/insights/diagnosticsettings.go @@ -85,7 +85,7 @@ func (client DiagnosticSettingsClient) CreateOrUpdatePreparer(ctx context.Contex autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -161,7 +161,7 @@ func (client DiagnosticSettingsClient) DeletePreparer(ctx context.Context, resou preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -235,7 +235,7 @@ func (client DiagnosticSettingsClient) GetPreparer(ctx context.Context, resource preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -308,7 +308,7 @@ func (client DiagnosticSettingsClient) ListPreparer(ctx context.Context, resourc preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/diagnosticsettingscategory.go b/services/preview/monitor/mgmt/2019-03-01/insights/diagnosticsettingscategory.go index 48365ed67e65..07b7295848ef 100644 --- a/services/preview/monitor/mgmt/2019-03-01/insights/diagnosticsettingscategory.go +++ b/services/preview/monitor/mgmt/2019-03-01/insights/diagnosticsettingscategory.go @@ -83,7 +83,7 @@ func (client DiagnosticSettingsCategoryClient) GetPreparer(ctx context.Context, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -156,7 +156,7 @@ func (client DiagnosticSettingsCategoryClient) ListPreparer(ctx context.Context, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/enums.go b/services/preview/monitor/mgmt/2019-03-01/insights/enums.go index b0a6aee8f846..6483334fb07f 100644 --- a/services/preview/monitor/mgmt/2019-03-01/insights/enums.go +++ b/services/preview/monitor/mgmt/2019-03-01/insights/enums.go @@ -29,6 +29,27 @@ func PossibleAggregationTypeValues() []AggregationType { return []AggregationType{Average, Count, Maximum, Minimum, None, Total} } +// AggregationTypeEnum enumerates the values for aggregation type enum. +type AggregationTypeEnum string + +const ( + // AggregationTypeEnumAverage ... + AggregationTypeEnumAverage AggregationTypeEnum = "Average" + // AggregationTypeEnumCount ... + AggregationTypeEnumCount AggregationTypeEnum = "Count" + // AggregationTypeEnumMaximum ... + AggregationTypeEnumMaximum AggregationTypeEnum = "Maximum" + // AggregationTypeEnumMinimum ... + AggregationTypeEnumMinimum AggregationTypeEnum = "Minimum" + // AggregationTypeEnumTotal ... + AggregationTypeEnumTotal AggregationTypeEnum = "Total" +) + +// PossibleAggregationTypeEnumValues returns an array of possible values for the AggregationTypeEnum const type. +func PossibleAggregationTypeEnumValues() []AggregationTypeEnum { + return []AggregationTypeEnum{AggregationTypeEnumAverage, AggregationTypeEnumCount, AggregationTypeEnumMaximum, AggregationTypeEnumMinimum, AggregationTypeEnumTotal} +} + // AlertSeverity enumerates the values for alert severity. type AlertSeverity string @@ -113,13 +134,17 @@ const ( ConditionalOperatorEqual ConditionalOperator = "Equal" // ConditionalOperatorGreaterThan ... ConditionalOperatorGreaterThan ConditionalOperator = "GreaterThan" + // ConditionalOperatorGreaterThanOrEqual ... + ConditionalOperatorGreaterThanOrEqual ConditionalOperator = "GreaterThanOrEqual" // ConditionalOperatorLessThan ... ConditionalOperatorLessThan ConditionalOperator = "LessThan" + // ConditionalOperatorLessThanOrEqual ... + ConditionalOperatorLessThanOrEqual ConditionalOperator = "LessThanOrEqual" ) // PossibleConditionalOperatorValues returns an array of possible values for the ConditionalOperator const type. func PossibleConditionalOperatorValues() []ConditionalOperator { - return []ConditionalOperator{ConditionalOperatorEqual, ConditionalOperatorGreaterThan, ConditionalOperatorLessThan} + return []ConditionalOperator{ConditionalOperatorEqual, ConditionalOperatorGreaterThan, ConditionalOperatorGreaterThanOrEqual, ConditionalOperatorLessThan, ConditionalOperatorLessThanOrEqual} } // ConditionOperator enumerates the values for condition operator. @@ -243,12 +268,35 @@ func PossibleEventLevelValues() []EventLevel { return []EventLevel{EventLevelCritical, EventLevelError, EventLevelInformational, EventLevelVerbose, EventLevelWarning} } +// MetricClass enumerates the values for metric class. +type MetricClass string + +const ( + // Availability ... + Availability MetricClass = "Availability" + // Errors ... + Errors MetricClass = "Errors" + // Latency ... + Latency MetricClass = "Latency" + // Saturation ... + Saturation MetricClass = "Saturation" + // Transactions ... + Transactions MetricClass = "Transactions" +) + +// PossibleMetricClassValues returns an array of possible values for the MetricClass const type. +func PossibleMetricClassValues() []MetricClass { + return []MetricClass{Availability, Errors, Latency, Saturation, Transactions} +} + // MetricStatisticType enumerates the values for metric statistic type. type MetricStatisticType string const ( // MetricStatisticTypeAverage ... MetricStatisticTypeAverage MetricStatisticType = "Average" + // MetricStatisticTypeCount ... + MetricStatisticTypeCount MetricStatisticType = "Count" // MetricStatisticTypeMax ... MetricStatisticTypeMax MetricStatisticType = "Max" // MetricStatisticTypeMin ... @@ -259,7 +307,7 @@ const ( // PossibleMetricStatisticTypeValues returns an array of possible values for the MetricStatisticType const type. func PossibleMetricStatisticTypeValues() []MetricStatisticType { - return []MetricStatisticType{MetricStatisticTypeAverage, MetricStatisticTypeMax, MetricStatisticTypeMin, MetricStatisticTypeSum} + return []MetricStatisticType{MetricStatisticTypeAverage, MetricStatisticTypeCount, MetricStatisticTypeMax, MetricStatisticTypeMin, MetricStatisticTypeSum} } // MetricTriggerType enumerates the values for metric trigger type. @@ -277,6 +325,60 @@ func PossibleMetricTriggerTypeValues() []MetricTriggerType { return []MetricTriggerType{MetricTriggerTypeConsecutive, MetricTriggerTypeTotal} } +// MetricUnit enumerates the values for metric unit. +type MetricUnit string + +const ( + // MetricUnitBitsPerSecond ... + MetricUnitBitsPerSecond MetricUnit = "BitsPerSecond" + // MetricUnitBytes ... + MetricUnitBytes MetricUnit = "Bytes" + // MetricUnitByteSeconds ... + MetricUnitByteSeconds MetricUnit = "ByteSeconds" + // MetricUnitBytesPerSecond ... + MetricUnitBytesPerSecond MetricUnit = "BytesPerSecond" + // MetricUnitCores ... + MetricUnitCores MetricUnit = "Cores" + // MetricUnitCount ... + MetricUnitCount MetricUnit = "Count" + // MetricUnitCountPerSecond ... + MetricUnitCountPerSecond MetricUnit = "CountPerSecond" + // MetricUnitMilliCores ... + MetricUnitMilliCores MetricUnit = "MilliCores" + // MetricUnitMilliSeconds ... + MetricUnitMilliSeconds MetricUnit = "MilliSeconds" + // MetricUnitNanoCores ... + MetricUnitNanoCores MetricUnit = "NanoCores" + // MetricUnitPercent ... + MetricUnitPercent MetricUnit = "Percent" + // MetricUnitSeconds ... + MetricUnitSeconds MetricUnit = "Seconds" + // MetricUnitUnspecified ... + MetricUnitUnspecified MetricUnit = "Unspecified" +) + +// PossibleMetricUnitValues returns an array of possible values for the MetricUnit const type. +func PossibleMetricUnitValues() []MetricUnit { + return []MetricUnit{MetricUnitBitsPerSecond, MetricUnitBytes, MetricUnitByteSeconds, MetricUnitBytesPerSecond, MetricUnitCores, MetricUnitCount, MetricUnitCountPerSecond, MetricUnitMilliCores, MetricUnitMilliSeconds, MetricUnitNanoCores, MetricUnitPercent, MetricUnitSeconds, MetricUnitUnspecified} +} + +// NamespaceClassification enumerates the values for namespace classification. +type NamespaceClassification string + +const ( + // Custom ... + Custom NamespaceClassification = "Custom" + // Platform ... + Platform NamespaceClassification = "Platform" + // Qos ... + Qos NamespaceClassification = "Qos" +) + +// PossibleNamespaceClassificationValues returns an array of possible values for the NamespaceClassification const type. +func PossibleNamespaceClassificationValues() []NamespaceClassification { + return []NamespaceClassification{Custom, Platform, Qos} +} + // OdataType enumerates the values for odata type. type OdataType string @@ -397,13 +499,11 @@ const ( OperatorLessThan Operator = "LessThan" // OperatorLessThanOrEqual ... OperatorLessThanOrEqual Operator = "LessThanOrEqual" - // OperatorNotEquals ... - OperatorNotEquals Operator = "NotEquals" ) // PossibleOperatorValues returns an array of possible values for the Operator const type. func PossibleOperatorValues() []Operator { - return []Operator{OperatorEquals, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorLessThan, OperatorLessThanOrEqual, OperatorNotEquals} + return []Operator{OperatorEquals, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorLessThan, OperatorLessThanOrEqual} } // ProvisioningState enumerates the values for provisioning state. @@ -539,28 +639,13 @@ const ( ExactCount ScaleType = "ExactCount" // PercentChangeCount ... PercentChangeCount ScaleType = "PercentChangeCount" + // ServiceAllowedNextValue ... + ServiceAllowedNextValue ScaleType = "ServiceAllowedNextValue" ) // PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. func PossibleScaleTypeValues() []ScaleType { - return []ScaleType{ChangeCount, ExactCount, PercentChangeCount} -} - -// Sensitivity enumerates the values for sensitivity. -type Sensitivity string - -const ( - // SensitivityHigh ... - SensitivityHigh Sensitivity = "High" - // SensitivityLow ... - SensitivityLow Sensitivity = "Low" - // SensitivityMedium ... - SensitivityMedium Sensitivity = "Medium" -) - -// PossibleSensitivityValues returns an array of possible values for the Sensitivity const type. -func PossibleSensitivityValues() []Sensitivity { - return []Sensitivity{SensitivityHigh, SensitivityLow, SensitivityMedium} + return []ScaleType{ChangeCount, ExactCount, PercentChangeCount, ServiceAllowedNextValue} } // TimeAggregationOperator enumerates the values for time aggregation operator. @@ -606,40 +691,3 @@ const ( func PossibleTimeAggregationTypeValues() []TimeAggregationType { return []TimeAggregationType{TimeAggregationTypeAverage, TimeAggregationTypeCount, TimeAggregationTypeLast, TimeAggregationTypeMaximum, TimeAggregationTypeMinimum, TimeAggregationTypeTotal} } - -// Unit enumerates the values for unit. -type Unit string - -const ( - // UnitBitsPerSecond ... - UnitBitsPerSecond Unit = "BitsPerSecond" - // UnitBytes ... - UnitBytes Unit = "Bytes" - // UnitByteSeconds ... - UnitByteSeconds Unit = "ByteSeconds" - // UnitBytesPerSecond ... - UnitBytesPerSecond Unit = "BytesPerSecond" - // UnitCores ... - UnitCores Unit = "Cores" - // UnitCount ... - UnitCount Unit = "Count" - // UnitCountPerSecond ... - UnitCountPerSecond Unit = "CountPerSecond" - // UnitMilliCores ... - UnitMilliCores Unit = "MilliCores" - // UnitMilliSeconds ... - UnitMilliSeconds Unit = "MilliSeconds" - // UnitNanoCores ... - UnitNanoCores Unit = "NanoCores" - // UnitPercent ... - UnitPercent Unit = "Percent" - // UnitSeconds ... - UnitSeconds Unit = "Seconds" - // UnitUnspecified ... - UnitUnspecified Unit = "Unspecified" -) - -// PossibleUnitValues returns an array of possible values for the Unit const type. -func PossibleUnitValues() []Unit { - return []Unit{UnitBitsPerSecond, UnitBytes, UnitByteSeconds, UnitBytesPerSecond, UnitCores, UnitCount, UnitCountPerSecond, UnitMilliCores, UnitMilliSeconds, UnitNanoCores, UnitPercent, UnitSeconds, UnitUnspecified} -} diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/eventcategories.go b/services/preview/monitor/mgmt/2019-03-01/insights/eventcategories.go index 86e59b424363..f43c5468ac51 100644 --- a/services/preview/monitor/mgmt/2019-03-01/insights/eventcategories.go +++ b/services/preview/monitor/mgmt/2019-03-01/insights/eventcategories.go @@ -75,7 +75,7 @@ func (client EventCategoriesClient) ListPreparer(ctx context.Context) (*http.Req preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventcategories"), + autorest.WithPath("/providers/Microsoft.Insights/eventcategories"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/insightsapi/interfaces.go b/services/preview/monitor/mgmt/2019-03-01/insights/insightsapi/interfaces.go index ff0f950e76d9..671c220cd0eb 100644 --- a/services/preview/monitor/mgmt/2019-03-01/insights/insightsapi/interfaces.go +++ b/services/preview/monitor/mgmt/2019-03-01/insights/insightsapi/interfaces.go @@ -144,14 +144,6 @@ type MetricsClientAPI interface { var _ MetricsClientAPI = (*insights.MetricsClient)(nil) -// MetricBaselineClientAPI contains the set of methods on the MetricBaselineClient type. -type MetricBaselineClientAPI interface { - CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation insights.TimeSeriesInformation) (result insights.CalculateBaselineResponse, err error) - Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType insights.ResultType) (result insights.BaselineResponse, err error) -} - -var _ MetricBaselineClientAPI = (*insights.MetricBaselineClient)(nil) - // BaselinesClientAPI contains the set of methods on the BaselinesClient type. type BaselinesClientAPI interface { List(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType insights.ResultType) (result insights.MetricBaselinesResponse, err error) diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/logprofiles.go b/services/preview/monitor/mgmt/2019-03-01/insights/logprofiles.go index ad1500b87bc9..cfa5e8be2997 100644 --- a/services/preview/monitor/mgmt/2019-03-01/insights/logprofiles.go +++ b/services/preview/monitor/mgmt/2019-03-01/insights/logprofiles.go @@ -56,7 +56,9 @@ func (client LogProfilesClient) CreateOrUpdate(ctx context.Context, logProfileNa {Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, }}, - }}}}}); err != nil { + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.LogProfilesClient", "CreateOrUpdate", err.Error()) } @@ -98,7 +100,7 @@ func (client LogProfilesClient) CreateOrUpdatePreparer(ctx context.Context, logP autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -136,6 +138,12 @@ func (client LogProfilesClient) Delete(ctx context.Context, logProfileName strin tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, logProfileName) if err != nil { err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", nil, "Failure preparing request") @@ -173,7 +181,7 @@ func (client LogProfilesClient) DeletePreparer(ctx context.Context, logProfileNa preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -209,6 +217,12 @@ func (client LogProfilesClient) Get(ctx context.Context, logProfileName string) tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, logProfileName) if err != nil { err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Get", nil, "Failure preparing request") @@ -246,7 +260,7 @@ func (client LogProfilesClient) GetPreparer(ctx context.Context, logProfileName preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -281,6 +295,12 @@ func (client LogProfilesClient) List(ctx context.Context) (result LogProfileColl tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "List", err.Error()) + } + req, err := client.ListPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "List", nil, "Failure preparing request") @@ -317,7 +337,7 @@ func (client LogProfilesClient) ListPreparer(ctx context.Context) (*http.Request preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -355,6 +375,12 @@ func (client LogProfilesClient) Update(ctx context.Context, logProfileName strin tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, logProfileName, logProfilesResource) if err != nil { err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Update", nil, "Failure preparing request") @@ -393,7 +419,7 @@ func (client LogProfilesClient) UpdatePreparer(ctx context.Context, logProfileNa autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithJSON(logProfilesResource), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/metricalerts.go b/services/preview/monitor/mgmt/2019-03-01/insights/metricalerts.go index 94231b6fa34e..f9706664d9be 100644 --- a/services/preview/monitor/mgmt/2019-03-01/insights/metricalerts.go +++ b/services/preview/monitor/mgmt/2019-03-01/insights/metricalerts.go @@ -33,7 +33,7 @@ func NewMetricAlertsClientWithBaseURI(baseURI string, subscriptionID string) Met // CreateOrUpdate create or update an metric alert definition. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to create or update. func (client MetricAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource) (result MetricAlertResource, err error) { @@ -48,11 +48,16 @@ func (client MetricAlertsClient) CreateOrUpdate(ctx context.Context, resourceGro }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.MetricAlertProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.MetricAlertProperties.Description", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.Severity", Name: validation.Null, Rule: true, Chain: nil}, + Chain: []validation.Constraint{{Target: "parameters.MetricAlertProperties.Severity", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.MetricAlertProperties.Enabled", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.MetricAlertProperties.Scopes", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.MetricAlertProperties.EvaluationFrequency", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.MetricAlertProperties.WindowSize", Name: validation.Null, Rule: true, Chain: nil}, }}}}}); err != nil { @@ -124,7 +129,7 @@ func (client MetricAlertsClient) CreateOrUpdateResponder(resp *http.Response) (r // Delete delete an alert rule definition. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client MetricAlertsClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -137,6 +142,15 @@ func (client MetricAlertsClient) Delete(ctx context.Context, resourceGroupName s tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", nil, "Failure preparing request") @@ -199,7 +213,7 @@ func (client MetricAlertsClient) DeleteResponder(resp *http.Response) (result au // Get retrieve an alert rule definition. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client MetricAlertsClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertResource, err error) { if tracing.IsEnabled() { @@ -212,6 +226,15 @@ func (client MetricAlertsClient) Get(ctx context.Context, resourceGroupName stri tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Get", nil, "Failure preparing request") @@ -275,7 +298,7 @@ func (client MetricAlertsClient) GetResponder(resp *http.Response) (result Metri // ListByResourceGroup retrieve alert rule definitions in a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client MetricAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result MetricAlertResourceCollection, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.ListByResourceGroup") @@ -287,6 +310,15 @@ func (client MetricAlertsClient) ListByResourceGroup(ctx context.Context, resour tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -359,6 +391,12 @@ func (client MetricAlertsClient) ListBySubscription(ctx context.Context) (result tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "ListBySubscription", err.Error()) + } + req, err := client.ListBySubscriptionPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", nil, "Failure preparing request") @@ -420,7 +458,7 @@ func (client MetricAlertsClient) ListBySubscriptionResponder(resp *http.Response // Update update an metric alert definition. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to update. func (client MetricAlertsClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch) (result MetricAlertResource, err error) { @@ -434,6 +472,15 @@ func (client MetricAlertsClient) Update(ctx context.Context, resourceGroupName s tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Update", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/metricalertsstatus.go b/services/preview/monitor/mgmt/2019-03-01/insights/metricalertsstatus.go index 43cfaed42765..4709142160be 100644 --- a/services/preview/monitor/mgmt/2019-03-01/insights/metricalertsstatus.go +++ b/services/preview/monitor/mgmt/2019-03-01/insights/metricalertsstatus.go @@ -10,6 +10,7 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" "net/http" ) @@ -33,7 +34,7 @@ func NewMetricAlertsStatusClientWithBaseURI(baseURI string, subscriptionID strin // List retrieve an alert rule status. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client MetricAlertsStatusClient) List(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertStatusCollection, err error) { if tracing.IsEnabled() { @@ -46,6 +47,15 @@ func (client MetricAlertsStatusClient) List(ctx context.Context, resourceGroupNa tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsStatusClient", "List", err.Error()) + } + req, err := client.ListPreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "List", nil, "Failure preparing request") @@ -109,7 +119,7 @@ func (client MetricAlertsStatusClient) ListResponder(resp *http.Response) (resul // ListByName retrieve an alert rule status. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // statusName - the name of the status. func (client MetricAlertsStatusClient) ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (result MetricAlertStatusCollection, err error) { @@ -123,6 +133,15 @@ func (client MetricAlertsStatusClient) ListByName(ctx context.Context, resourceG tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsStatusClient", "ListByName", err.Error()) + } + req, err := client.ListByNamePreparer(ctx, resourceGroupName, ruleName, statusName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/metricbaseline.go b/services/preview/monitor/mgmt/2019-03-01/insights/metricbaseline.go deleted file mode 100644 index d395fc67bc59..000000000000 --- a/services/preview/monitor/mgmt/2019-03-01/insights/metricbaseline.go +++ /dev/null @@ -1,217 +0,0 @@ -package insights - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// MetricBaselineClient is the monitor Management Client -type MetricBaselineClient struct { - BaseClient -} - -// NewMetricBaselineClient creates an instance of the MetricBaselineClient client. -func NewMetricBaselineClient(subscriptionID string) MetricBaselineClient { - return NewMetricBaselineClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricBaselineClientWithBaseURI creates an instance of the MetricBaselineClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewMetricBaselineClientWithBaseURI(baseURI string, subscriptionID string) MetricBaselineClient { - return MetricBaselineClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CalculateBaseline **Lists the baseline values for a resource**. -// Parameters: -// resourceURI - 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 -// timeSeriesInformation - information that need to be specified to calculate a baseline on a time series. -func (client MetricBaselineClient) CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (result CalculateBaselineResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricBaselineClient.CalculateBaseline") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: timeSeriesInformation, - Constraints: []validation.Constraint{{Target: "timeSeriesInformation.Sensitivities", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "timeSeriesInformation.Values", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.MetricBaselineClient", "CalculateBaseline", err.Error()) - } - - req, err := client.CalculateBaselinePreparer(ctx, resourceURI, timeSeriesInformation) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", nil, "Failure preparing request") - return - } - - resp, err := client.CalculateBaselineSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure sending request") - return - } - - result, err = client.CalculateBaselineResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure responding to request") - return - } - - return -} - -// CalculateBaselinePreparer prepares the CalculateBaseline request. -func (client MetricBaselineClient) CalculateBaselinePreparer(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/calculatebaseline", pathParameters), - autorest.WithJSON(timeSeriesInformation), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CalculateBaselineSender sends the CalculateBaseline request. The method will close the -// http.Response Body if it receives an error. -func (client MetricBaselineClient) CalculateBaselineSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CalculateBaselineResponder handles the response to the CalculateBaseline request. The method always -// closes the http.Response Body. -func (client MetricBaselineClient) CalculateBaselineResponder(resp *http.Response) (result CalculateBaselineResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get **Gets the baseline values for a specific metric**. -// Parameters: -// resourceURI - 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 -// metricName - the name of the metric to retrieve the baseline for. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// aggregation - the aggregation type of the metric to retrieve the baseline for. -// sensitivities - the list of sensitivities (comma separated) to retrieve. -// resultType - allows retrieving only metadata of the baseline. On data request all information is retrieved. -func (client MetricBaselineClient) Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (result BaselineResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricBaselineClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceURI, metricName, timespan, interval, aggregation, sensitivities, resultType) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client MetricBaselineClient) GetPreparer(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "metricName": autorest.Encode("path", metricName), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if len(sensitivities) > 0 { - queryParameters["sensitivities"] = autorest.Encode("query", sensitivities) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/baseline/{metricName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client MetricBaselineClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client MetricBaselineClient) GetResponder(resp *http.Response) (result BaselineResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/metricdefinitions.go b/services/preview/monitor/mgmt/2019-03-01/insights/metricdefinitions.go index 69fc2e0b465a..c316b154fe7e 100644 --- a/services/preview/monitor/mgmt/2019-03-01/insights/metricdefinitions.go +++ b/services/preview/monitor/mgmt/2019-03-01/insights/metricdefinitions.go @@ -85,7 +85,7 @@ func (client MetricDefinitionsClient) ListPreparer(ctx context.Context, resource preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricDefinitions", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metricDefinitions", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/metrics.go b/services/preview/monitor/mgmt/2019-03-01/insights/metrics.go index 97687a09b498..f2329253c944 100644 --- a/services/preview/monitor/mgmt/2019-03-01/insights/metrics.go +++ b/services/preview/monitor/mgmt/2019-03-01/insights/metrics.go @@ -36,7 +36,8 @@ func NewMetricsClientWithBaseURI(baseURI string, subscriptionID string) MetricsC // timespan - the timespan of the query. It is a string with the following format // 'startDateTime_ISO/endDateTime_ISO'. // interval - the interval (i.e. timegrain) of the query. -// metricnames - the names of the metrics (comma separated) to retrieve. +// metricnames - the names of the metrics (comma separated) to retrieve. Special case: If a metricname itself +// has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be **'Metric%2Name1'** // aggregation - the list of aggregation types (comma separated) to retrieve. // top - the maximum number of records to retrieve. // Valid only if $filter is specified. @@ -44,13 +45,16 @@ func NewMetricsClientWithBaseURI(baseURI string, subscriptionID string) MetricsC // orderby - the aggregation to use for sorting results and the direction of the sort. // Only one order can be specified. // Examples: sum asc. -// 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 -// ‘*’**. +// 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 '*'**. Special case: When +// dimension name or dimension value uses round brackets. Eg: When dimension name is **dim (test) 1** Instead +// of using $filter= "dim (test) 1 eq '*' " use **$filter= "dim %2528test%2529 1 eq '*' "** When dimension name +// is **dim (test) 3** and dimension value is **dim3 (test) val** Instead of using $filter= "dim (test) 3 eq +// 'dim3 (test) val' " use **$filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "** // resultType - reduces the set of data collected. The syntax allowed depends on the operation. See the // operation's description for details. // metricnamespace - metric namespace to query metric definitions for. @@ -128,7 +132,7 @@ func (client MetricsClient) ListPreparer(ctx context.Context, resourceURI string preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metrics", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metrics", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/models.go b/services/preview/monitor/mgmt/2019-03-01/insights/models.go index 57c922b5a0fd..247f2f027f19 100644 --- a/services/preview/monitor/mgmt/2019-03-01/insights/models.go +++ b/services/preview/monitor/mgmt/2019-03-01/insights/models.go @@ -210,6 +210,10 @@ type ActionGroupResource struct { Name *string `json:"name,omitempty"` // Type - READ-ONLY; Azure resource type Type *string `json:"type,omitempty"` + // Kind - READ-ONLY; Azure resource kind + Kind *string `json:"kind,omitempty"` + // Identity - READ-ONLY; Azure resource identity + Identity *string `json:"identity,omitempty"` // Location - Resource location Location *string `json:"location,omitempty"` // Tags - Resource tags @@ -276,6 +280,24 @@ func (agr *ActionGroupResource) UnmarshalJSON(body []byte) error { } agr.Type = &typeVar } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + agr.Kind = &kind + } + case "identity": + if v != nil { + var identity string + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + agr.Identity = &identity + } case "location": if v != nil { var location string @@ -439,6 +461,10 @@ type ActivityLogAlertResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for ActivityLogAlertResource. @@ -519,6 +545,24 @@ func (alar *ActivityLogAlertResource) UnmarshalJSON(body []byte) error { } alar.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + alar.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + alar.Etag = &etag + } } } @@ -587,10 +631,14 @@ type AlertRule struct { Name *string `json:"name,omitempty"` // Description - the description of the alert rule that will be included in the alert email. Description *string `json:"description,omitempty"` + // ProvisioningState - the provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` // IsEnabled - the flag that indicates whether the alert rule is enabled. IsEnabled *bool `json:"isEnabled,omitempty"` // Condition - the condition that results in the alert rule being activated. Condition BasicRuleCondition `json:"condition,omitempty"` + // Action - action that is performed when the alert rule becomes active, and when an alert condition is resolved. + Action BasicRuleAction `json:"action,omitempty"` // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. Actions *[]BasicRuleAction `json:"actions,omitempty"` // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. @@ -606,10 +654,14 @@ func (ar AlertRule) MarshalJSON() ([]byte, error) { if ar.Description != nil { objectMap["description"] = ar.Description } + if ar.ProvisioningState != nil { + objectMap["provisioningState"] = ar.ProvisioningState + } if ar.IsEnabled != nil { objectMap["isEnabled"] = ar.IsEnabled } objectMap["condition"] = ar.Condition + objectMap["action"] = ar.Action if ar.Actions != nil { objectMap["actions"] = ar.Actions } @@ -643,6 +695,15 @@ func (ar *AlertRule) UnmarshalJSON(body []byte) error { } ar.Description = &description } + case "provisioningState": + if v != nil { + var provisioningState string + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + ar.ProvisioningState = &provisioningState + } case "isEnabled": if v != nil { var isEnabled bool @@ -660,6 +721,14 @@ func (ar *AlertRule) UnmarshalJSON(body []byte) error { } ar.Condition = condition } + case "action": + if v != nil { + action, err := unmarshalBasicRuleAction(*v) + if err != nil { + return err + } + ar.Action = action + } case "actions": if v != nil { actions, err := unmarshalBasicRuleActionArray(*v) @@ -698,6 +767,10 @@ type AlertRuleResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for AlertRuleResource. @@ -778,6 +851,24 @@ func (arr *AlertRuleResource) UnmarshalJSON(body []byte) error { } arr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + arr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + arr.Etag = &etag + } } } @@ -909,6 +1000,8 @@ type AutoscaleSetting struct { Name *string `json:"name,omitempty"` // TargetResourceURI - the resource identifier of the resource that the autoscale setting should be added to. TargetResourceURI *string `json:"targetResourceUri,omitempty"` + // TargetResourceLocation - the location of the resource that the autoscale setting should be added to. + TargetResourceLocation *string `json:"targetResourceLocation,omitempty"` } // AutoscaleSettingResource the autoscale setting resource. @@ -926,6 +1019,10 @@ type AutoscaleSettingResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for AutoscaleSettingResource. @@ -1006,6 +1103,24 @@ func (asr *AutoscaleSettingResource) UnmarshalJSON(body []byte) error { } asr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + asr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + asr.Etag = &etag + } } } @@ -1257,130 +1372,42 @@ type AzureFunctionReceiver struct { UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` } -// Baseline the baseline values for a single sensitivity value. -type Baseline struct { - // Sensitivity - the sensitivity of the baseline. Possible values include: 'SensitivityLow', 'SensitivityMedium', 'SensitivityHigh' - Sensitivity Sensitivity `json:"sensitivity,omitempty"` - // LowThresholds - The low thresholds of the baseline. - LowThresholds *[]float64 `json:"lowThresholds,omitempty"` - // HighThresholds - The high thresholds of the baseline. - HighThresholds *[]float64 `json:"highThresholds,omitempty"` -} - -// BaselineMetadata represents a baseline metadata value. -type BaselineMetadata struct { - // Name - Name of the baseline metadata. - Name *string `json:"name,omitempty"` - // Value - Value of the baseline metadata. - Value *string `json:"value,omitempty"` -} - -// BaselineMetadataValue represents a baseline metadata value. -type BaselineMetadataValue struct { - // Name - the name of the metadata. - Name *LocalizableString `json:"name,omitempty"` - // Value - the value of the metadata. - Value *string `json:"value,omitempty"` -} - -// BaselineProperties the baseline properties class. -type BaselineProperties struct { - // 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. - Timespan *string `json:"timespan,omitempty"` - // 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. - Interval *string `json:"interval,omitempty"` - // Aggregation - The aggregation type of the metric. - Aggregation *string `json:"aggregation,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Baseline - the baseline values for each sensitivity. - Baseline *[]Baseline `json:"baseline,omitempty"` - // Metadata - the baseline metadata values. - Metadata *[]BaselineMetadataValue `json:"metadata,omitempty"` -} - -// BaselineResponse the response to a baseline query. -type BaselineResponse struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; the metric baseline Id. +// AzureResource an azure resource object +type AzureResource struct { + // ID - READ-ONLY; Azure resource Id ID *string `json:"id,omitempty"` - // Type - READ-ONLY; the resource type of the baseline resource. + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type Type *string `json:"type,omitempty"` - // Name - READ-ONLY; the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString `json:"name,omitempty"` - // BaselineProperties - the properties of the baseline. - *BaselineProperties `json:"properties,omitempty"` + // Kind - READ-ONLY; Azure resource kind + Kind *string `json:"kind,omitempty"` + // Identity - READ-ONLY; Azure resource identity + Identity *string `json:"identity,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` } -// MarshalJSON is the custom marshaler for BaselineResponse. -func (br BaselineResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for AzureResource. +func (ar AzureResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if br.BaselineProperties != nil { - objectMap["properties"] = br.BaselineProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BaselineResponse struct. -func (br *BaselineResponse) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err + if ar.Location != nil { + objectMap["location"] = ar.Location } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - br.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - br.Type = &typeVar - } - case "name": - if v != nil { - var name LocalizableString - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - br.Name = &name - } - case "properties": - if v != nil { - var baselineProperties BaselineProperties - err = json.Unmarshal(*v, &baselineProperties) - if err != nil { - return err - } - br.BaselineProperties = &baselineProperties - } - } + if ar.Tags != nil { + objectMap["tags"] = ar.Tags } - - return nil + return json.Marshal(objectMap) } -// CalculateBaselineResponse the response to a calculate baseline call. -type CalculateBaselineResponse struct { - autorest.Response `json:"-"` - // Type - the resource type of the baseline resource. - Type *string `json:"type,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Baseline - the baseline values for each sensitivity. - Baseline *[]Baseline `json:"baseline,omitempty"` +// BaselineMetadata represents a baseline metadata value. +type BaselineMetadata struct { + // Name - Name of the baseline metadata. + Name *string `json:"name,omitempty"` + // Value - Value of the baseline metadata. + Value *string `json:"value,omitempty"` } // Criteria specifies the criteria for converting log to metric. @@ -1612,8 +1639,8 @@ type DynamicMetricCriteria struct { MetricName *string `json:"metricName,omitempty"` // MetricNamespace - Namespace of the metric. MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` + // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' + TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` // Dimensions - List of dimension conditions. Dimensions *[]MetricDimension `json:"dimensions,omitempty"` // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. @@ -1647,7 +1674,7 @@ func (dmc DynamicMetricCriteria) MarshalJSON() ([]byte, error) { if dmc.MetricNamespace != nil { objectMap["metricNamespace"] = dmc.MetricNamespace } - if dmc.TimeAggregation != nil { + if dmc.TimeAggregation != "" { objectMap["timeAggregation"] = dmc.TimeAggregation } if dmc.Dimensions != nil { @@ -1771,7 +1798,7 @@ func (dmc *DynamicMetricCriteria) UnmarshalJSON(body []byte) error { } case "timeAggregation": if v != nil { - var timeAggregation interface{} + var timeAggregation AggregationTypeEnum err = json.Unmarshal(*v, &timeAggregation) if err != nil { return err @@ -1871,6 +1898,12 @@ type Error struct { Message *string `json:"message,omitempty"` } +// ErrorContract describes the format of Error response. +type ErrorContract struct { + // Error - The error details. + Error *ErrorResponse `json:"error,omitempty"` +} + // ErrorResponse describes the format of Error response. type ErrorResponse struct { // Code - Error code @@ -2284,7 +2317,7 @@ type LogicAppReceiver struct { // LogMetricTrigger a log metrics trigger descriptor. type LogMetricTrigger struct { - // ThresholdOperator - Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' + // ThresholdOperator - Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'ConditionalOperatorGreaterThanOrEqual', 'ConditionalOperatorLessThanOrEqual', 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` // Threshold - The threshold of the metric trigger. Threshold *float64 `json:"threshold,omitempty"` @@ -2330,6 +2363,10 @@ type LogProfileResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for LogProfileResource. @@ -2410,6 +2447,24 @@ func (lpr *LogProfileResource) UnmarshalJSON(body []byte) error { } lpr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + lpr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + lpr.Etag = &etag + } } } @@ -2471,8 +2526,16 @@ func (lprp *LogProfileResourcePatch) UnmarshalJSON(body []byte) error { // LogSearchRule log Search Rule Definition type LogSearchRule struct { + // CreatedWithAPIVersion - READ-ONLY; The api-version used when creating this alert rule + CreatedWithAPIVersion *string `json:"createdWithApiVersion,omitempty"` + // IsLegacyLogAnalyticsRule - READ-ONLY; True if alert rule is legacy Log Analytic rule + IsLegacyLogAnalyticsRule *bool `json:"isLegacyLogAnalyticsRule,omitempty"` // Description - The description of the Log Search rule. Description *string `json:"description,omitempty"` + // DisplayName - The display name of the alert rule + DisplayName *string `json:"displayName,omitempty"` + // AutoMitigate - The flag that indicates whether the alert should be automatically resolved or not. The default is false. + AutoMitigate *bool `json:"autoMitigate,omitempty"` // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'True', 'False' Enabled Enabled `json:"enabled,omitempty"` // LastUpdatedTime - READ-ONLY; Last time the rule was updated in IS08601 format. @@ -2493,6 +2556,12 @@ func (lsr LogSearchRule) MarshalJSON() ([]byte, error) { if lsr.Description != nil { objectMap["description"] = lsr.Description } + if lsr.DisplayName != nil { + objectMap["displayName"] = lsr.DisplayName + } + if lsr.AutoMitigate != nil { + objectMap["autoMitigate"] = lsr.AutoMitigate + } if lsr.Enabled != "" { objectMap["enabled"] = lsr.Enabled } @@ -2515,6 +2584,24 @@ func (lsr *LogSearchRule) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { + case "createdWithApiVersion": + if v != nil { + var createdWithAPIVersion string + err = json.Unmarshal(*v, &createdWithAPIVersion) + if err != nil { + return err + } + lsr.CreatedWithAPIVersion = &createdWithAPIVersion + } + case "isLegacyLogAnalyticsRule": + if v != nil { + var isLegacyLogAnalyticsRule bool + err = json.Unmarshal(*v, &isLegacyLogAnalyticsRule) + if err != nil { + return err + } + lsr.IsLegacyLogAnalyticsRule = &isLegacyLogAnalyticsRule + } case "description": if v != nil { var description string @@ -2524,6 +2611,24 @@ func (lsr *LogSearchRule) UnmarshalJSON(body []byte) error { } lsr.Description = &description } + case "displayName": + if v != nil { + var displayName string + err = json.Unmarshal(*v, &displayName) + if err != nil { + return err + } + lsr.DisplayName = &displayName + } + case "autoMitigate": + if v != nil { + var autoMitigate bool + err = json.Unmarshal(*v, &autoMitigate) + if err != nil { + return err + } + lsr.AutoMitigate = &autoMitigate + } case "enabled": if v != nil { var enabled Enabled @@ -2604,6 +2709,10 @@ type LogSearchRuleResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for LogSearchRuleResource. @@ -2684,6 +2793,24 @@ func (lsrr *LogSearchRuleResource) UnmarshalJSON(body []byte) error { } lsrr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + lsrr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + lsrr.Etag = &etag + } } } @@ -2917,8 +3044,14 @@ type Metric struct { Type *string `json:"type,omitempty"` // Name - the name and the display name of the metric, i.e. it is localizable string. Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' - Unit Unit `json:"unit,omitempty"` + // DisplayDescription - Detailed description of this metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + // ErrorCode - 'Success' or the error details on query failures for this metric. + ErrorCode *string `json:"errorCode,omitempty"` + // ErrorMessage - Error message encountered querying this specific metric. + ErrorMessage *string `json:"errorMessage,omitempty"` + // Unit - The unit of the metric. Possible values include: 'MetricUnitCount', 'MetricUnitBytes', 'MetricUnitSeconds', 'MetricUnitCountPerSecond', 'MetricUnitBytesPerSecond', 'MetricUnitPercent', 'MetricUnitMilliSeconds', 'MetricUnitByteSeconds', 'MetricUnitUnspecified', 'MetricUnitCores', 'MetricUnitMilliCores', 'MetricUnitNanoCores', 'MetricUnitBitsPerSecond' + Unit MetricUnit `json:"unit,omitempty"` // Timeseries - the time series returned when a data query is performed. Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"` } @@ -2927,7 +3060,7 @@ type Metric struct { type MetricAlertAction struct { // ActionGroupID - the id of the action group to use. ActionGroupID *string `json:"actionGroupId,omitempty"` - // WebHookProperties - The properties of a webhook object. + // WebHookProperties - This field allows specifying custom properties, which would be appended to the alert payload sent as input to the webhook. WebHookProperties map[string]*string `json:"webHookProperties"` } @@ -3188,9 +3321,9 @@ type MetricAlertProperties struct { EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. WindowSize *string `json:"windowSize,omitempty"` - // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource. TargetResourceType *string `json:"targetResourceType,omitempty"` - // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource. TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` // Criteria - defines the specific alert criteria information. Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` @@ -3200,6 +3333,8 @@ type MetricAlertProperties struct { Actions *[]MetricAlertAction `json:"actions,omitempty"` // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` + // IsMigrated - READ-ONLY; the value indicating whether this alert rule is migrated. + IsMigrated *bool `json:"isMigrated,omitempty"` } // MarshalJSON is the custom marshaler for MetricAlertProperties. @@ -3355,6 +3490,213 @@ func (mapVar *MetricAlertProperties) UnmarshalJSON(body []byte) error { } mapVar.LastUpdatedTime = &lastUpdatedTime } + case "isMigrated": + if v != nil { + var isMigrated bool + err = json.Unmarshal(*v, &isMigrated) + if err != nil { + return err + } + mapVar.IsMigrated = &isMigrated + } + } + } + + return nil +} + +// MetricAlertPropertiesPatch an alert rule properties for patch. +type MetricAlertPropertiesPatch struct { + // Description - the description of the metric alert that will be included in the alert email. + Description *string `json:"description,omitempty"` + // Severity - Alert severity {0, 1, 2, 3, 4} + Severity *int32 `json:"severity,omitempty"` + // Enabled - the flag that indicates whether the metric alert is enabled. + Enabled *bool `json:"enabled,omitempty"` + // Scopes - the list of resource id's that this metric alert is scoped to. + Scopes *[]string `json:"scopes,omitempty"` + // EvaluationFrequency - how often the metric alert is evaluated represented in ISO 8601 duration format. + EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` + // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. + WindowSize *string `json:"windowSize,omitempty"` + // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + TargetResourceType *string `json:"targetResourceType,omitempty"` + // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` + // Criteria - defines the specific alert criteria information. + Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` + // AutoMitigate - the flag that indicates whether the alert should be auto resolved or not. The default is true. + AutoMitigate *bool `json:"autoMitigate,omitempty"` + // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + Actions *[]MetricAlertAction `json:"actions,omitempty"` + // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. + LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` + // IsMigrated - READ-ONLY; the value indicating whether this alert rule is migrated. + IsMigrated *bool `json:"isMigrated,omitempty"` +} + +// MarshalJSON is the custom marshaler for MetricAlertPropertiesPatch. +func (mapp MetricAlertPropertiesPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mapp.Description != nil { + objectMap["description"] = mapp.Description + } + if mapp.Severity != nil { + objectMap["severity"] = mapp.Severity + } + if mapp.Enabled != nil { + objectMap["enabled"] = mapp.Enabled + } + if mapp.Scopes != nil { + objectMap["scopes"] = mapp.Scopes + } + if mapp.EvaluationFrequency != nil { + objectMap["evaluationFrequency"] = mapp.EvaluationFrequency + } + if mapp.WindowSize != nil { + objectMap["windowSize"] = mapp.WindowSize + } + if mapp.TargetResourceType != nil { + objectMap["targetResourceType"] = mapp.TargetResourceType + } + if mapp.TargetResourceRegion != nil { + objectMap["targetResourceRegion"] = mapp.TargetResourceRegion + } + objectMap["criteria"] = mapp.Criteria + if mapp.AutoMitigate != nil { + objectMap["autoMitigate"] = mapp.AutoMitigate + } + if mapp.Actions != nil { + objectMap["actions"] = mapp.Actions + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MetricAlertPropertiesPatch struct. +func (mapp *MetricAlertPropertiesPatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + mapp.Description = &description + } + case "severity": + if v != nil { + var severity int32 + err = json.Unmarshal(*v, &severity) + if err != nil { + return err + } + mapp.Severity = &severity + } + case "enabled": + if v != nil { + var enabled bool + err = json.Unmarshal(*v, &enabled) + if err != nil { + return err + } + mapp.Enabled = &enabled + } + case "scopes": + if v != nil { + var scopes []string + err = json.Unmarshal(*v, &scopes) + if err != nil { + return err + } + mapp.Scopes = &scopes + } + case "evaluationFrequency": + if v != nil { + var evaluationFrequency string + err = json.Unmarshal(*v, &evaluationFrequency) + if err != nil { + return err + } + mapp.EvaluationFrequency = &evaluationFrequency + } + case "windowSize": + if v != nil { + var windowSize string + err = json.Unmarshal(*v, &windowSize) + if err != nil { + return err + } + mapp.WindowSize = &windowSize + } + case "targetResourceType": + if v != nil { + var targetResourceType string + err = json.Unmarshal(*v, &targetResourceType) + if err != nil { + return err + } + mapp.TargetResourceType = &targetResourceType + } + case "targetResourceRegion": + if v != nil { + var targetResourceRegion string + err = json.Unmarshal(*v, &targetResourceRegion) + if err != nil { + return err + } + mapp.TargetResourceRegion = &targetResourceRegion + } + case "criteria": + if v != nil { + criteria, err := unmarshalBasicMetricAlertCriteria(*v) + if err != nil { + return err + } + mapp.Criteria = criteria + } + case "autoMitigate": + if v != nil { + var autoMitigate bool + err = json.Unmarshal(*v, &autoMitigate) + if err != nil { + return err + } + mapp.AutoMitigate = &autoMitigate + } + case "actions": + if v != nil { + var actions []MetricAlertAction + err = json.Unmarshal(*v, &actions) + if err != nil { + return err + } + mapp.Actions = &actions + } + case "lastUpdatedTime": + if v != nil { + var lastUpdatedTime date.Time + err = json.Unmarshal(*v, &lastUpdatedTime) + if err != nil { + return err + } + mapp.LastUpdatedTime = &lastUpdatedTime + } + case "isMigrated": + if v != nil { + var isMigrated bool + err = json.Unmarshal(*v, &isMigrated) + if err != nil { + return err + } + mapp.IsMigrated = &isMigrated + } } } @@ -3376,6 +3718,10 @@ type MetricAlertResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for MetricAlertResource. @@ -3456,6 +3802,24 @@ func (mar *MetricAlertResource) UnmarshalJSON(body []byte) error { } mar.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + mar.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + mar.Etag = &etag + } } } @@ -3473,8 +3837,8 @@ type MetricAlertResourceCollection struct { type MetricAlertResourcePatch struct { // Tags - Resource tags Tags map[string]*string `json:"tags"` - // MetricAlertProperties - The alert rule properties of the resource. - *MetricAlertProperties `json:"properties,omitempty"` + // MetricAlertPropertiesPatch - The alert rule properties of the resource. + *MetricAlertPropertiesPatch `json:"properties,omitempty"` } // MarshalJSON is the custom marshaler for MetricAlertResourcePatch. @@ -3483,8 +3847,8 @@ func (marp MetricAlertResourcePatch) MarshalJSON() ([]byte, error) { if marp.Tags != nil { objectMap["tags"] = marp.Tags } - if marp.MetricAlertProperties != nil { - objectMap["properties"] = marp.MetricAlertProperties + if marp.MetricAlertPropertiesPatch != nil { + objectMap["properties"] = marp.MetricAlertPropertiesPatch } return json.Marshal(objectMap) } @@ -3509,12 +3873,12 @@ func (marp *MetricAlertResourcePatch) UnmarshalJSON(body []byte) error { } case "properties": if v != nil { - var metricAlertProperties MetricAlertProperties - err = json.Unmarshal(*v, &metricAlertProperties) + var metricAlertPropertiesPatch MetricAlertPropertiesPatch + err = json.Unmarshal(*v, &metricAlertPropertiesPatch) if err != nil { return err } - marp.MetricAlertProperties = &metricAlertProperties + marp.MetricAlertPropertiesPatch = &metricAlertPropertiesPatch } } } @@ -3693,7 +4057,7 @@ type MetricBaselinesResponse struct { // MetricCriteria criterion to filter metrics. type MetricCriteria struct { - // Operator - the criteria operator. Possible values include: 'OperatorEquals', 'OperatorNotEquals', 'OperatorGreaterThan', 'OperatorGreaterThanOrEqual', 'OperatorLessThan', 'OperatorLessThanOrEqual' + // Operator - the criteria operator. Possible values include: 'OperatorEquals', 'OperatorGreaterThan', 'OperatorGreaterThanOrEqual', 'OperatorLessThan', 'OperatorLessThanOrEqual' Operator Operator `json:"operator,omitempty"` // Threshold - the criteria threshold value that activates the alert. Threshold *float64 `json:"threshold,omitempty"` @@ -3705,8 +4069,8 @@ type MetricCriteria struct { MetricName *string `json:"metricName,omitempty"` // MetricNamespace - Namespace of the metric. MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` + // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' + TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` // Dimensions - List of dimension conditions. Dimensions *[]MetricDimension `json:"dimensions,omitempty"` // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. @@ -3734,7 +4098,7 @@ func (mc MetricCriteria) MarshalJSON() ([]byte, error) { if mc.MetricNamespace != nil { objectMap["metricNamespace"] = mc.MetricNamespace } - if mc.TimeAggregation != nil { + if mc.TimeAggregation != "" { objectMap["timeAggregation"] = mc.TimeAggregation } if mc.Dimensions != nil { @@ -3840,7 +4204,7 @@ func (mc *MetricCriteria) UnmarshalJSON(body []byte) error { } case "timeAggregation": if v != nil { - var timeAggregation interface{} + var timeAggregation AggregationTypeEnum err = json.Unmarshal(*v, &timeAggregation) if err != nil { return err @@ -3890,8 +4254,14 @@ type MetricDefinition struct { Namespace *string `json:"namespace,omitempty"` // Name - the name and the display name of the metric, i.e. it is a localizable string. Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' - Unit Unit `json:"unit,omitempty"` + // DisplayDescription - Detailed description of this metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + // Category - Custom category name for this metric. + Category *string `json:"category,omitempty"` + // MetricClass - The class of the metric. Possible values include: 'Availability', 'Transactions', 'Errors', 'Latency', 'Saturation' + MetricClass MetricClass `json:"metricClass,omitempty"` + // Unit - The unit of the metric. Possible values include: 'MetricUnitCount', 'MetricUnitBytes', 'MetricUnitSeconds', 'MetricUnitCountPerSecond', 'MetricUnitBytesPerSecond', 'MetricUnitPercent', 'MetricUnitMilliSeconds', 'MetricUnitByteSeconds', 'MetricUnitUnspecified', 'MetricUnitCores', 'MetricUnitMilliCores', 'MetricUnitNanoCores', 'MetricUnitBitsPerSecond' + Unit MetricUnit `json:"unit,omitempty"` // PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' PrimaryAggregationType AggregationType `json:"primaryAggregationType,omitempty"` // SupportedAggregationTypes - the collection of what aggregation types are supported. @@ -3923,12 +4293,14 @@ type MetricDimension struct { // MetricNamespace metric namespace class specifies the metadata for a metric namespace. type MetricNamespace struct { - // ID - The ID of the metricNamespace. + // ID - The ID of the metric namespace. ID *string `json:"id,omitempty"` // Type - The type of the namespace. Type *string `json:"type,omitempty"` - // Name - The name of the namespace. + // Name - The escaped name of the namespace. Name *string `json:"name,omitempty"` + // Classification - Kind of namespace. Possible values include: 'Platform', 'Custom', 'Qos' + Classification NamespaceClassification `json:"classification,omitempty"` // Properties - Properties which include the fully qualified namespace name. Properties *MetricNamespaceName `json:"properties,omitempty"` } @@ -3974,9 +4346,11 @@ type MetricTrigger struct { MetricNamespace *string `json:"metricNamespace,omitempty"` // MetricResourceURI - the resource identifier of the resource the rule monitors. MetricResourceURI *string `json:"metricResourceUri,omitempty"` + // MetricResourceLocation - the location of the resource the rule monitors. + MetricResourceLocation *string `json:"metricResourceLocation,omitempty"` // TimeGrain - 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. TimeGrain *string `json:"timeGrain,omitempty"` - // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum' + // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum', 'MetricStatisticTypeCount' Statistic MetricStatisticType `json:"statistic,omitempty"` // TimeWindow - 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. TimeWindow *string `json:"timeWindow,omitempty"` @@ -3988,6 +4362,8 @@ type MetricTrigger struct { Threshold *float64 `json:"threshold,omitempty"` // Dimensions - List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. Dimensions *[]ScaleRuleMetricDimension `json:"dimensions,omitempty"` + // DividePerInstance - a value indicating whether metric should divide per instance. + DividePerInstance *bool `json:"dividePerInstance,omitempty"` } // MetricValue represents a metric value. @@ -4023,8 +4399,8 @@ type MultiMetricCriteria struct { MetricName *string `json:"metricName,omitempty"` // MetricNamespace - Namespace of the metric. MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` + // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' + TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` // Dimensions - List of dimension conditions. Dimensions *[]MetricDimension `json:"dimensions,omitempty"` // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. @@ -4087,7 +4463,7 @@ func (mmc MultiMetricCriteria) MarshalJSON() ([]byte, error) { if mmc.MetricNamespace != nil { objectMap["metricNamespace"] = mmc.MetricNamespace } - if mmc.TimeAggregation != nil { + if mmc.TimeAggregation != "" { objectMap["timeAggregation"] = mmc.TimeAggregation } if mmc.Dimensions != nil { @@ -4175,7 +4551,7 @@ func (mmc *MultiMetricCriteria) UnmarshalJSON(body []byte) error { } case "timeAggregation": if v != nil { - var timeAggregation interface{} + var timeAggregation AggregationTypeEnum err = json.Unmarshal(*v, &timeAggregation) if err != nil { return err @@ -4308,6 +4684,10 @@ type Resource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for Resource. @@ -4325,15 +4705,15 @@ func (r Resource) MarshalJSON() ([]byte, error) { // Response the response to a metrics query. type Response struct { autorest.Response `json:"-"` - // Cost - The integer value representing the cost of the query, for data case. + // Cost - The integer value representing the relative cost of the query. Cost *float64 `json:"cost,omitempty"` // 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. Timespan *string `json:"timespan,omitempty"` // 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. Interval *string `json:"interval,omitempty"` - // Namespace - The namespace of the metrics been queried + // Namespace - The namespace of the metrics being queried Namespace *string `json:"namespace,omitempty"` - // Resourceregion - The region of the resource been queried for metrics. + // Resourceregion - The region of the resource being queried for metrics. Resourceregion *string `json:"resourceregion,omitempty"` // Value - the value of the collection. Value *[]Metric `json:"value,omitempty"` @@ -4579,6 +4959,12 @@ type BasicRuleDataSource interface { type RuleDataSource struct { // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' OdataType OdataType `json:"odata.type,omitempty"` } @@ -4631,6 +5017,15 @@ func (rds RuleDataSource) MarshalJSON() ([]byte, error) { if rds.ResourceURI != nil { objectMap["resourceUri"] = rds.ResourceURI } + if rds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rds.LegacyResourceID + } + if rds.ResourceLocation != nil { + objectMap["resourceLocation"] = rds.ResourceLocation + } + if rds.MetricNamespace != nil { + objectMap["metricNamespace"] = rds.MetricNamespace + } if rds.OdataType != "" { objectMap["odata.type"] = rds.OdataType } @@ -4733,6 +5128,12 @@ type RuleManagementEventDataSource struct { Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' OdataType OdataType `json:"odata.type,omitempty"` } @@ -4771,6 +5172,15 @@ func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { if rmeds.ResourceURI != nil { objectMap["resourceUri"] = rmeds.ResourceURI } + if rmeds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rmeds.LegacyResourceID + } + if rmeds.ResourceLocation != nil { + objectMap["resourceLocation"] = rmeds.ResourceLocation + } + if rmeds.MetricNamespace != nil { + objectMap["metricNamespace"] = rmeds.MetricNamespace + } if rmeds.OdataType != "" { objectMap["odata.type"] = rmeds.OdataType } @@ -4804,6 +5214,12 @@ type RuleMetricDataSource struct { MetricName *string `json:"metricName,omitempty"` // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' OdataType OdataType `json:"odata.type,omitempty"` } @@ -4818,6 +5234,15 @@ func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) { if rmds.ResourceURI != nil { objectMap["resourceUri"] = rmds.ResourceURI } + if rmds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rmds.LegacyResourceID + } + if rmds.ResourceLocation != nil { + objectMap["resourceLocation"] = rmds.ResourceLocation + } + if rmds.MetricNamespace != nil { + objectMap["metricNamespace"] = rmds.MetricNamespace + } if rmds.OdataType != "" { objectMap["odata.type"] = rmds.OdataType } @@ -4895,7 +5320,7 @@ func (rwa RuleWebhookAction) AsBasicRuleAction() (BasicRuleAction, bool) { type ScaleAction struct { // Direction - the scale direction. Whether the scaling action increases or decreases the number of instances. Possible values include: 'ScaleDirectionNone', 'ScaleDirectionIncrease', 'ScaleDirectionDecrease' Direction ScaleDirection `json:"direction,omitempty"` - // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount' + // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount', 'ServiceAllowedNextValue' Type ScaleType `json:"type,omitempty"` // Value - the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1. Value *string `json:"value,omitempty"` @@ -5223,8 +5648,8 @@ type TimeSeriesBaseline struct { Timestamps *[]date.Time `json:"timestamps,omitempty"` // Data - The baseline values for each sensitivity. Data *[]SingleBaseline `json:"data,omitempty"` - // Metadata - The baseline metadata values. - Metadata *[]BaselineMetadata `json:"metadata,omitempty"` + // MetadataValues - The baseline metadata values. + MetadataValues *[]BaselineMetadata `json:"metadataValues,omitempty"` } // TimeSeriesElement a time series result type. The discriminator value is always TimeSeries in this case. @@ -5235,16 +5660,6 @@ type TimeSeriesElement struct { Data *[]MetricValue `json:"data,omitempty"` } -// TimeSeriesInformation the time series info needed for calculating the baseline. -type TimeSeriesInformation struct { - // Sensitivities - the list of sensitivities for calculating the baseline. - Sensitivities *[]string `json:"sensitivities,omitempty"` - // Values - The metric values to calculate the baseline. - Values *[]float64 `json:"values,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` -} - // TimeWindow a specific date-time for the profile. type TimeWindow struct { // TimeZone - 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 @@ -5257,7 +5672,7 @@ type TimeWindow struct { // TriggerCondition the condition that results in the Log Search rule. type TriggerCondition struct { - // ThresholdOperator - Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' + // ThresholdOperator - Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'ConditionalOperatorGreaterThanOrEqual', 'ConditionalOperatorLessThanOrEqual', 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` // Threshold - Result or count threshold based on which rule should be triggered. Threshold *float64 `json:"threshold,omitempty"` diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/operations.go b/services/preview/monitor/mgmt/2019-03-01/insights/operations.go index 3f82351c7f23..afb74dc9248f 100644 --- a/services/preview/monitor/mgmt/2019-03-01/insights/operations.go +++ b/services/preview/monitor/mgmt/2019-03-01/insights/operations.go @@ -74,7 +74,7 @@ func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/operations"), + autorest.WithPath("/providers/Microsoft.Insights/operations"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/scheduledqueryrules.go b/services/preview/monitor/mgmt/2019-03-01/insights/scheduledqueryrules.go index c9d43964ecb0..22b09a5f8997 100644 --- a/services/preview/monitor/mgmt/2019-03-01/insights/scheduledqueryrules.go +++ b/services/preview/monitor/mgmt/2019-03-01/insights/scheduledqueryrules.go @@ -34,7 +34,7 @@ func NewScheduledQueryRulesClientWithBaseURI(baseURI string, subscriptionID stri // CreateOrUpdate creates or updates an log search rule. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to create or update. func (client ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResource) (result LogSearchRuleResource, err error) { @@ -49,6 +49,11 @@ func (client ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, reso }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.LogSearchRule", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source", Name: validation.Null, Rule: true, @@ -100,7 +105,7 @@ func (client ScheduledQueryRulesClient) CreateOrUpdatePreparer(ctx context.Conte autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -126,7 +131,7 @@ func (client ScheduledQueryRulesClient) CreateOrUpdateResponder(resp *http.Respo // Delete deletes a Log Search rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client ScheduledQueryRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -139,6 +144,15 @@ func (client ScheduledQueryRulesClient) Delete(ctx context.Context, resourceGrou tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", nil, "Failure preparing request") @@ -177,7 +191,7 @@ func (client ScheduledQueryRulesClient) DeletePreparer(ctx context.Context, reso preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -201,7 +215,7 @@ func (client ScheduledQueryRulesClient) DeleteResponder(resp *http.Response) (re // Get gets an Log Search rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client ScheduledQueryRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result LogSearchRuleResource, err error) { if tracing.IsEnabled() { @@ -214,6 +228,15 @@ func (client ScheduledQueryRulesClient) Get(ctx context.Context, resourceGroupNa tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Get", nil, "Failure preparing request") @@ -252,7 +275,7 @@ func (client ScheduledQueryRulesClient) GetPreparer(ctx context.Context, resourc preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -277,7 +300,7 @@ func (client ScheduledQueryRulesClient) GetResponder(resp *http.Response) (resul // ListByResourceGroup list the Log Search rules within a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // filter - the filter to apply on the operation. For more information please see // https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx func (client ScheduledQueryRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result LogSearchRuleResourceCollection, err error) { @@ -291,6 +314,15 @@ func (client ScheduledQueryRulesClient) ListByResourceGroup(ctx context.Context, tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -331,7 +363,7 @@ func (client ScheduledQueryRulesClient) ListByResourceGroupPreparer(ctx context. preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -369,6 +401,12 @@ func (client ScheduledQueryRulesClient) ListBySubscription(ctx context.Context, tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "ListBySubscription", err.Error()) + } + req, err := client.ListBySubscriptionPreparer(ctx, filter) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", nil, "Failure preparing request") @@ -408,7 +446,7 @@ func (client ScheduledQueryRulesClient) ListBySubscriptionPreparer(ctx context.C preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/scheduledQueryRules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -433,7 +471,7 @@ func (client ScheduledQueryRulesClient) ListBySubscriptionResponder(resp *http.R // Update update log search Rule. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to update. func (client ScheduledQueryRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResourcePatch) (result LogSearchRuleResource, err error) { @@ -447,6 +485,15 @@ func (client ScheduledQueryRulesClient) Update(ctx context.Context, resourceGrou tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Update", nil, "Failure preparing request") @@ -486,7 +533,7 @@ func (client ScheduledQueryRulesClient) UpdatePreparer(ctx context.Context, reso autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/tenantactivitylogs.go b/services/preview/monitor/mgmt/2019-03-01/insights/tenantactivitylogs.go index 7501f047bb38..7c6ee7981381 100644 --- a/services/preview/monitor/mgmt/2019-03-01/insights/tenantactivitylogs.go +++ b/services/preview/monitor/mgmt/2019-03-01/insights/tenantactivitylogs.go @@ -107,7 +107,7 @@ func (client TenantActivityLogsClient) ListPreparer(ctx context.Context, filter preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventtypes/management/values"), + autorest.WithPath("/providers/Microsoft.Insights/eventtypes/management/values"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/CHANGELOG.md b/services/preview/monitor/mgmt/2019-06-01/insights/CHANGELOG.md index 52911e4cc5e4..dfb951ae4033 100644 --- a/services/preview/monitor/mgmt/2019-06-01/insights/CHANGELOG.md +++ b/services/preview/monitor/mgmt/2019-06-01/insights/CHANGELOG.md @@ -1,2 +1,167 @@ -# Change History +# Unreleased +## Breaking Changes + +### Removed Constants + +1. Operator.OperatorNotEquals +1. Sensitivity.SensitivityHigh +1. Sensitivity.SensitivityLow +1. Sensitivity.SensitivityMedium +1. Unit.UnitBitsPerSecond +1. Unit.UnitByteSeconds +1. Unit.UnitBytes +1. Unit.UnitBytesPerSecond +1. Unit.UnitCores +1. Unit.UnitCount +1. Unit.UnitCountPerSecond +1. Unit.UnitMilliCores +1. Unit.UnitMilliSeconds +1. Unit.UnitNanoCores +1. Unit.UnitPercent +1. Unit.UnitSeconds +1. Unit.UnitUnspecified + +### Removed Funcs + +1. *BaselineResponse.UnmarshalJSON([]byte) error +1. BaselineResponse.MarshalJSON() ([]byte, error) +1. MetricBaselineClient.CalculateBaseline(context.Context, string, TimeSeriesInformation) (CalculateBaselineResponse, error) +1. MetricBaselineClient.CalculateBaselinePreparer(context.Context, string, TimeSeriesInformation) (*http.Request, error) +1. MetricBaselineClient.CalculateBaselineResponder(*http.Response) (CalculateBaselineResponse, error) +1. MetricBaselineClient.CalculateBaselineSender(*http.Request) (*http.Response, error) +1. MetricBaselineClient.Get(context.Context, string, string, string, *string, string, string, ResultType) (BaselineResponse, error) +1. MetricBaselineClient.GetPreparer(context.Context, string, string, string, *string, string, string, ResultType) (*http.Request, error) +1. MetricBaselineClient.GetResponder(*http.Response) (BaselineResponse, error) +1. MetricBaselineClient.GetSender(*http.Request) (*http.Response, error) +1. NewMetricBaselineClient(string) MetricBaselineClient +1. NewMetricBaselineClientWithBaseURI(string, string) MetricBaselineClient +1. PossibleSensitivityValues() []Sensitivity +1. PossibleUnitValues() []Unit + +### Struct Changes + +#### Removed Structs + +1. Baseline +1. BaselineMetadataValue +1. BaselineProperties +1. BaselineResponse +1. CalculateBaselineResponse +1. MetricBaselineClient +1. TimeSeriesInformation + +#### Removed Struct Fields + +1. MetricAlertResourcePatch.*MetricAlertProperties +1. TimeSeriesBaseline.Metadata + +### Signature Changes + +#### Struct Fields + +1. DynamicMetricCriteria.TimeAggregation changed type from interface{} to AggregationTypeEnum +1. Metric.Unit changed type from Unit to MetricUnit +1. MetricCriteria.TimeAggregation changed type from interface{} to AggregationTypeEnum +1. MetricDefinition.Unit changed type from Unit to MetricUnit +1. MultiMetricCriteria.TimeAggregation changed type from interface{} to AggregationTypeEnum + +## Additive Changes + +### New Constants + +1. AggregationTypeEnum.AggregationTypeEnumAverage +1. AggregationTypeEnum.AggregationTypeEnumCount +1. AggregationTypeEnum.AggregationTypeEnumMaximum +1. AggregationTypeEnum.AggregationTypeEnumMinimum +1. AggregationTypeEnum.AggregationTypeEnumTotal +1. ConditionalOperator.ConditionalOperatorGreaterThanOrEqual +1. ConditionalOperator.ConditionalOperatorLessThanOrEqual +1. MetricClass.Availability +1. MetricClass.Errors +1. MetricClass.Latency +1. MetricClass.Saturation +1. MetricClass.Transactions +1. MetricStatisticType.MetricStatisticTypeCount +1. MetricUnit.MetricUnitBitsPerSecond +1. MetricUnit.MetricUnitByteSeconds +1. MetricUnit.MetricUnitBytes +1. MetricUnit.MetricUnitBytesPerSecond +1. MetricUnit.MetricUnitCores +1. MetricUnit.MetricUnitCount +1. MetricUnit.MetricUnitCountPerSecond +1. MetricUnit.MetricUnitMilliCores +1. MetricUnit.MetricUnitMilliSeconds +1. MetricUnit.MetricUnitNanoCores +1. MetricUnit.MetricUnitPercent +1. MetricUnit.MetricUnitSeconds +1. MetricUnit.MetricUnitUnspecified +1. NamespaceClassification.Custom +1. NamespaceClassification.Platform +1. NamespaceClassification.Qos +1. ScaleType.ServiceAllowedNextValue + +### New Funcs + +1. *MetricAlertPropertiesPatch.UnmarshalJSON([]byte) error +1. AzureResource.MarshalJSON() ([]byte, error) +1. MetricAlertPropertiesPatch.MarshalJSON() ([]byte, error) +1. PossibleAggregationTypeEnumValues() []AggregationTypeEnum +1. PossibleMetricClassValues() []MetricClass +1. PossibleMetricUnitValues() []MetricUnit +1. PossibleNamespaceClassificationValues() []NamespaceClassification + +### Struct Changes + +#### New Structs + +1. AzureResource +1. ErrorContract +1. MetricAlertPropertiesPatch + +#### New Struct Fields + +1. ActionGroupResource.Identity +1. ActionGroupResource.Kind +1. ActivityLogAlertResource.Etag +1. ActivityLogAlertResource.Kind +1. AlertRule.Action +1. AlertRule.ProvisioningState +1. AlertRuleResource.Etag +1. AlertRuleResource.Kind +1. AutoscaleSetting.TargetResourceLocation +1. AutoscaleSettingResource.Etag +1. AutoscaleSettingResource.Kind +1. LogProfileResource.Etag +1. LogProfileResource.Kind +1. LogSearchRule.AutoMitigate +1. LogSearchRule.CreatedWithAPIVersion +1. LogSearchRule.DisplayName +1. LogSearchRule.IsLegacyLogAnalyticsRule +1. LogSearchRuleResource.Etag +1. LogSearchRuleResource.Kind +1. Metric.DisplayDescription +1. Metric.ErrorCode +1. Metric.ErrorMessage +1. MetricAlertProperties.IsMigrated +1. MetricAlertResource.Etag +1. MetricAlertResource.Kind +1. MetricAlertResourcePatch.*MetricAlertPropertiesPatch +1. MetricDefinition.Category +1. MetricDefinition.DisplayDescription +1. MetricDefinition.MetricClass +1. MetricNamespace.Classification +1. MetricTrigger.DividePerInstance +1. MetricTrigger.MetricResourceLocation +1. Resource.Etag +1. Resource.Kind +1. RuleDataSource.LegacyResourceID +1. RuleDataSource.MetricNamespace +1. RuleDataSource.ResourceLocation +1. RuleManagementEventDataSource.LegacyResourceID +1. RuleManagementEventDataSource.MetricNamespace +1. RuleManagementEventDataSource.ResourceLocation +1. RuleMetricDataSource.LegacyResourceID +1. RuleMetricDataSource.MetricNamespace +1. RuleMetricDataSource.ResourceLocation +1. TimeSeriesBaseline.MetadataValues diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/_meta.json b/services/preview/monitor/mgmt/2019-06-01/insights/_meta.json index 59068c75e549..8839f948f892 100644 --- a/services/preview/monitor/mgmt/2019-06-01/insights/_meta.json +++ b/services/preview/monitor/mgmt/2019-06-01/insights/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "83f6c7b9ac240d3862e909245f0a61d70ae33908", "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", "tag": "package-2019-06", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/actiongroups.go b/services/preview/monitor/mgmt/2019-06-01/insights/actiongroups.go index dd2ee8b7f402..ce2e6509e2da 100644 --- a/services/preview/monitor/mgmt/2019-06-01/insights/actiongroups.go +++ b/services/preview/monitor/mgmt/2019-06-01/insights/actiongroups.go @@ -33,7 +33,7 @@ func NewActionGroupsClientWithBaseURI(baseURI string, subscriptionID string) Act // CreateOrUpdate create a new action group or update an existing one. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. // actionGroup - the action group to create or use for the update. func (client ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (result ActionGroupResource, err error) { @@ -48,12 +48,17 @@ func (client ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGro }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: actionGroup, Constraints: []validation.Constraint{{Target: "actionGroup.ActionGroup", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.MaxLength, Rule: 12, Chain: nil}}}, {Target: "actionGroup.ActionGroup.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ActionGroupsClient", "CreateOrUpdate", err.Error()) } @@ -122,7 +127,7 @@ func (client ActionGroupsClient) CreateOrUpdateResponder(resp *http.Response) (r // Delete delete an action group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. func (client ActionGroupsClient) Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -135,6 +140,15 @@ func (client ActionGroupsClient) Delete(ctx context.Context, resourceGroupName s tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, actionGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", nil, "Failure preparing request") @@ -198,7 +212,7 @@ func (client ActionGroupsClient) DeleteResponder(resp *http.Response) (result au // EnableReceiver 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. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. // enableRequest - the receiver to re-enable. func (client ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (result autorest.Response, err error) { @@ -213,8 +227,13 @@ func (client ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGro }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: enableRequest, - Constraints: []validation.Constraint{{Target: "enableRequest.ReceiverName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "enableRequest.ReceiverName", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ActionGroupsClient", "EnableReceiver", err.Error()) } @@ -282,7 +301,7 @@ func (client ActionGroupsClient) EnableReceiverResponder(resp *http.Response) (r // Get get an action group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. func (client ActionGroupsClient) Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result ActionGroupResource, err error) { if tracing.IsEnabled() { @@ -295,6 +314,15 @@ func (client ActionGroupsClient) Get(ctx context.Context, resourceGroupName stri tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, actionGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Get", nil, "Failure preparing request") @@ -358,7 +386,7 @@ func (client ActionGroupsClient) GetResponder(resp *http.Response) (result Actio // ListByResourceGroup get a list of all action groups in a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client ActionGroupsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActionGroupList, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.ListByResourceGroup") @@ -370,6 +398,15 @@ func (client ActionGroupsClient) ListByResourceGroup(ctx context.Context, resour tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -442,6 +479,12 @@ func (client ActionGroupsClient) ListBySubscriptionID(ctx context.Context) (resu tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "ListBySubscriptionID", err.Error()) + } + req, err := client.ListBySubscriptionIDPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", nil, "Failure preparing request") @@ -503,7 +546,7 @@ func (client ActionGroupsClient) ListBySubscriptionIDResponder(resp *http.Respon // Update updates an existing action group's tags. To update other fields use the CreateOrUpdate method. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. // actionGroupPatch - parameters supplied to the operation. func (client ActionGroupsClient) Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (result ActionGroupResource, err error) { @@ -517,6 +560,15 @@ func (client ActionGroupsClient) Update(ctx context.Context, resourceGroupName s tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, actionGroupName, actionGroupPatch) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Update", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/activitylogalerts.go b/services/preview/monitor/mgmt/2019-06-01/insights/activitylogalerts.go index 44aaf3ef1e4a..f897b08a6f0c 100644 --- a/services/preview/monitor/mgmt/2019-06-01/insights/activitylogalerts.go +++ b/services/preview/monitor/mgmt/2019-06-01/insights/activitylogalerts.go @@ -34,7 +34,7 @@ func NewActivityLogAlertsClientWithBaseURI(baseURI string, subscriptionID string // CreateOrUpdate create a new activity log alert or update an existing one. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // activityLogAlertName - the name of the activity log alert. // activityLogAlert - the activity log alert to create or use for the update. func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (result ActivityLogAlertResource, err error) { @@ -49,6 +49,11 @@ func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resour }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: activityLogAlert, Constraints: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Scopes", Name: validation.Null, Rule: true, Chain: nil}, @@ -124,7 +129,7 @@ func (client ActivityLogAlertsClient) CreateOrUpdateResponder(resp *http.Respons // Delete delete an activity log alert. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // activityLogAlertName - the name of the activity log alert. func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -137,6 +142,15 @@ func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupN tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, activityLogAlertName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", nil, "Failure preparing request") @@ -199,7 +213,7 @@ func (client ActivityLogAlertsClient) DeleteResponder(resp *http.Response) (resu // Get get an activity log alert. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // activityLogAlertName - the name of the activity log alert. func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result ActivityLogAlertResource, err error) { if tracing.IsEnabled() { @@ -212,6 +226,15 @@ func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, activityLogAlertName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Get", nil, "Failure preparing request") @@ -275,7 +298,7 @@ func (client ActivityLogAlertsClient) GetResponder(resp *http.Response) (result // ListByResourceGroup get a list of all activity log alerts in a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActivityLogAlertList, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.ListByResourceGroup") @@ -287,6 +310,15 @@ func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, r tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -359,6 +391,12 @@ func (client ActivityLogAlertsClient) ListBySubscriptionID(ctx context.Context) tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "ListBySubscriptionID", err.Error()) + } + req, err := client.ListBySubscriptionIDPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", nil, "Failure preparing request") @@ -420,7 +458,7 @@ func (client ActivityLogAlertsClient) ListBySubscriptionIDResponder(resp *http.R // Update updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // activityLogAlertName - the name of the activity log alert. // activityLogAlertPatch - parameters supplied to the operation. func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (result ActivityLogAlertResource, err error) { @@ -434,6 +472,15 @@ func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupN tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, activityLogAlertName, activityLogAlertPatch) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Update", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/activitylogs.go b/services/preview/monitor/mgmt/2019-06-01/insights/activitylogs.go index 16dd215e6ad9..fc6927fa0e16 100644 --- a/services/preview/monitor/mgmt/2019-06-01/insights/activitylogs.go +++ b/services/preview/monitor/mgmt/2019-06-01/insights/activitylogs.go @@ -10,6 +10,7 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" "net/http" ) @@ -60,6 +61,12 @@ func (client ActivityLogsClient) List(ctx context.Context, filter string, select tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogsClient", "List", err.Error()) + } + result.fn = client.listNextResults req, err := client.ListPreparer(ctx, filter, selectParameter) if err != nil { @@ -105,7 +112,7 @@ func (client ActivityLogsClient) ListPreparer(ctx context.Context, filter string preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/eventtypes/management/values", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/eventtypes/management/values", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/alertruleincidents.go b/services/preview/monitor/mgmt/2019-06-01/insights/alertruleincidents.go index c3bf26828d8e..a7dcd9cba31e 100644 --- a/services/preview/monitor/mgmt/2019-06-01/insights/alertruleincidents.go +++ b/services/preview/monitor/mgmt/2019-06-01/insights/alertruleincidents.go @@ -10,6 +10,7 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" "net/http" ) @@ -33,7 +34,7 @@ func NewAlertRuleIncidentsClientWithBaseURI(baseURI string, subscriptionID strin // Get gets an incident associated to an alert rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // incidentName - the name of the incident to retrieve. func (client AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result Incident, err error) { @@ -47,6 +48,15 @@ func (client AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupNam tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRuleIncidentsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName, incidentName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "Get", nil, "Failure preparing request") @@ -111,7 +121,7 @@ func (client AlertRuleIncidentsClient) GetResponder(resp *http.Response) (result // ListByAlertRule gets a list of incidents associated to an alert rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client AlertRuleIncidentsClient) ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result IncidentListResult, err error) { if tracing.IsEnabled() { @@ -124,6 +134,15 @@ func (client AlertRuleIncidentsClient) ListByAlertRule(ctx context.Context, reso tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRuleIncidentsClient", "ListByAlertRule", err.Error()) + } + req, err := client.ListByAlertRulePreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/alertrules.go b/services/preview/monitor/mgmt/2019-06-01/insights/alertrules.go index f5a2ab682384..888ed122e267 100644 --- a/services/preview/monitor/mgmt/2019-06-01/insights/alertrules.go +++ b/services/preview/monitor/mgmt/2019-06-01/insights/alertrules.go @@ -33,7 +33,7 @@ func NewAlertRulesClientWithBaseURI(baseURI string, subscriptionID string) Alert // CreateOrUpdate creates or updates a classic metric alert rule. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to create or update. func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (result AlertRuleResource, err error) { @@ -48,11 +48,16 @@ func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroup }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.AlertRule", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.AlertRule.Name", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.AlertRule.IsEnabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AlertRulesClient", "CreateOrUpdate", err.Error()) } @@ -95,7 +100,7 @@ func (client AlertRulesClient) CreateOrUpdatePreparer(ctx context.Context, resou autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -121,7 +126,7 @@ func (client AlertRulesClient) CreateOrUpdateResponder(resp *http.Response) (res // Delete deletes a classic metric alert rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -134,6 +139,15 @@ func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName str tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", nil, "Failure preparing request") @@ -172,7 +186,7 @@ func (client AlertRulesClient) DeletePreparer(ctx context.Context, resourceGroup preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -196,7 +210,7 @@ func (client AlertRulesClient) DeleteResponder(resp *http.Response) (result auto // Get gets a classic metric alert rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result AlertRuleResource, err error) { if tracing.IsEnabled() { @@ -209,6 +223,15 @@ func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Get", nil, "Failure preparing request") @@ -247,7 +270,7 @@ func (client AlertRulesClient) GetPreparer(ctx context.Context, resourceGroupNam preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -272,7 +295,7 @@ func (client AlertRulesClient) GetResponder(resp *http.Response) (result AlertRu // ListByResourceGroup list the classic metric alert rules within a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client AlertRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AlertRuleResourceCollection, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.ListByResourceGroup") @@ -284,6 +307,15 @@ func (client AlertRulesClient) ListByResourceGroup(ctx context.Context, resource tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -321,7 +353,7 @@ func (client AlertRulesClient) ListByResourceGroupPreparer(ctx context.Context, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -356,6 +388,12 @@ func (client AlertRulesClient) ListBySubscription(ctx context.Context) (result A tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "ListBySubscription", err.Error()) + } + req, err := client.ListBySubscriptionPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", nil, "Failure preparing request") @@ -392,7 +430,7 @@ func (client AlertRulesClient) ListBySubscriptionPreparer(ctx context.Context) ( preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/alertrules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -417,7 +455,7 @@ func (client AlertRulesClient) ListBySubscriptionResponder(resp *http.Response) // Update updates an existing classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // alertRulesResource - parameters supplied to the operation. func (client AlertRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (result AlertRuleResource, err error) { @@ -431,6 +469,15 @@ func (client AlertRulesClient) Update(ctx context.Context, resourceGroupName str tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, alertRulesResource) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Update", nil, "Failure preparing request") @@ -470,7 +517,7 @@ func (client AlertRulesClient) UpdatePreparer(ctx context.Context, resourceGroup autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithJSON(alertRulesResource), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/autoscalesettings.go b/services/preview/monitor/mgmt/2019-06-01/insights/autoscalesettings.go index 86f253d0fb89..d9118bd2d049 100644 --- a/services/preview/monitor/mgmt/2019-06-01/insights/autoscalesettings.go +++ b/services/preview/monitor/mgmt/2019-06-01/insights/autoscalesettings.go @@ -34,7 +34,7 @@ func NewAutoscaleSettingsClientWithBaseURI(baseURI string, subscriptionID string // CreateOrUpdate creates or updates an autoscale setting. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // autoscaleSettingName - the autoscale setting name. // parameters - parameters supplied to the operation. func (client AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (result AutoscaleSettingResource, err error) { @@ -49,11 +49,16 @@ func (client AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resour }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.AutoscaleSetting", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.MaxItems, Rule: 20, Chain: nil}}}, - }}}}}); err != nil { + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AutoscaleSettingsClient", "CreateOrUpdate", err.Error()) } @@ -96,7 +101,7 @@ func (client AutoscaleSettingsClient) CreateOrUpdatePreparer(ctx context.Context autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -122,7 +127,7 @@ func (client AutoscaleSettingsClient) CreateOrUpdateResponder(resp *http.Respons // Delete deletes and autoscale setting // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // autoscaleSettingName - the autoscale setting name. func (client AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -135,6 +140,15 @@ func (client AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupN tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, autoscaleSettingName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", nil, "Failure preparing request") @@ -173,7 +187,7 @@ func (client AutoscaleSettingsClient) DeletePreparer(ctx context.Context, resour preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -197,7 +211,7 @@ func (client AutoscaleSettingsClient) DeleteResponder(resp *http.Response) (resu // Get gets an autoscale setting // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // autoscaleSettingName - the autoscale setting name. func (client AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result AutoscaleSettingResource, err error) { if tracing.IsEnabled() { @@ -210,6 +224,15 @@ func (client AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, autoscaleSettingName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Get", nil, "Failure preparing request") @@ -248,7 +271,7 @@ func (client AutoscaleSettingsClient) GetPreparer(ctx context.Context, resourceG preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -273,7 +296,7 @@ func (client AutoscaleSettingsClient) GetResponder(resp *http.Response) (result // ListByResourceGroup lists the autoscale settings for a resource group // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client AutoscaleSettingsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.ListByResourceGroup") @@ -285,6 +308,15 @@ func (client AutoscaleSettingsClient) ListByResourceGroup(ctx context.Context, r tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "ListByResourceGroup", err.Error()) + } + result.fn = client.listByResourceGroupNextResults req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { @@ -327,7 +359,7 @@ func (client AutoscaleSettingsClient) ListByResourceGroupPreparer(ctx context.Co preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -399,6 +431,12 @@ func (client AutoscaleSettingsClient) ListBySubscription(ctx context.Context) (r tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "ListBySubscription", err.Error()) + } + result.fn = client.listBySubscriptionNextResults req, err := client.ListBySubscriptionPreparer(ctx) if err != nil { @@ -440,7 +478,7 @@ func (client AutoscaleSettingsClient) ListBySubscriptionPreparer(ctx context.Con preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/autoscalesettings", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -502,7 +540,7 @@ func (client AutoscaleSettingsClient) ListBySubscriptionComplete(ctx context.Con // Update updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // autoscaleSettingName - the autoscale setting name. // autoscaleSettingResource - parameters supplied to the operation. func (client AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (result AutoscaleSettingResource, err error) { @@ -516,6 +554,15 @@ func (client AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupN tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, autoscaleSettingName, autoscaleSettingResource) if err != nil { err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Update", nil, "Failure preparing request") @@ -555,7 +602,7 @@ func (client AutoscaleSettingsClient) UpdatePreparer(ctx context.Context, resour autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithJSON(autoscaleSettingResource), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/baselines.go b/services/preview/monitor/mgmt/2019-06-01/insights/baselines.go index fd77a7d29721..1ead7936040e 100644 --- a/services/preview/monitor/mgmt/2019-06-01/insights/baselines.go +++ b/services/preview/monitor/mgmt/2019-06-01/insights/baselines.go @@ -33,20 +33,24 @@ func NewBaselinesClientWithBaseURI(baseURI string, subscriptionID string) Baseli // List **Lists the metric baseline values for a resource**. // Parameters: // resourceURI - the identifier of the resource. -// metricnames - the names of the metrics (comma separated) to retrieve. +// metricnames - the names of the metrics (comma separated) to retrieve. Special case: If a metricname itself +// has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be **'Metric%2Name1'** // metricnamespace - metric namespace to query metric definitions for. // timespan - the timespan of the query. It is a string with the following format // 'startDateTime_ISO/endDateTime_ISO'. // interval - the interval (i.e. timegrain) of the query. // aggregation - the list of aggregation types (comma separated) to retrieve. // sensitivities - the list of sensitivities (comma separated) to retrieve. -// 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 -// ‘*’**. +// 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 '*'**. Special case: When +// dimension name or dimension value uses round brackets. Eg: When dimension name is **dim (test) 1** Instead +// of using $filter= "dim (test) 1 eq '*' " use **$filter= "dim %2528test%2529 1 eq '*' "** When dimension name +// is **dim (test) 3** and dimension value is **dim3 (test) val** Instead of using $filter= "dim (test) 3 eq +// 'dim3 (test) val' " use **$filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "** // resultType - allows retrieving only metadata of the baseline. On data request all information is retrieved. func (client BaselinesClient) List(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType ResultType) (result MetricBaselinesResponse, err error) { if tracing.IsEnabled() { @@ -119,7 +123,7 @@ func (client BaselinesClient) ListPreparer(ctx context.Context, resourceURI stri preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricBaselines", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metricBaselines", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/diagnosticsettings.go b/services/preview/monitor/mgmt/2019-06-01/insights/diagnosticsettings.go index 9708c52c2499..db8aa282d0f3 100644 --- a/services/preview/monitor/mgmt/2019-06-01/insights/diagnosticsettings.go +++ b/services/preview/monitor/mgmt/2019-06-01/insights/diagnosticsettings.go @@ -85,7 +85,7 @@ func (client DiagnosticSettingsClient) CreateOrUpdatePreparer(ctx context.Contex autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -161,7 +161,7 @@ func (client DiagnosticSettingsClient) DeletePreparer(ctx context.Context, resou preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -235,7 +235,7 @@ func (client DiagnosticSettingsClient) GetPreparer(ctx context.Context, resource preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -308,7 +308,7 @@ func (client DiagnosticSettingsClient) ListPreparer(ctx context.Context, resourc preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/diagnosticsettingscategory.go b/services/preview/monitor/mgmt/2019-06-01/insights/diagnosticsettingscategory.go index 48365ed67e65..07b7295848ef 100644 --- a/services/preview/monitor/mgmt/2019-06-01/insights/diagnosticsettingscategory.go +++ b/services/preview/monitor/mgmt/2019-06-01/insights/diagnosticsettingscategory.go @@ -83,7 +83,7 @@ func (client DiagnosticSettingsCategoryClient) GetPreparer(ctx context.Context, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -156,7 +156,7 @@ func (client DiagnosticSettingsCategoryClient) ListPreparer(ctx context.Context, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/enums.go b/services/preview/monitor/mgmt/2019-06-01/insights/enums.go index b0a6aee8f846..6483334fb07f 100644 --- a/services/preview/monitor/mgmt/2019-06-01/insights/enums.go +++ b/services/preview/monitor/mgmt/2019-06-01/insights/enums.go @@ -29,6 +29,27 @@ func PossibleAggregationTypeValues() []AggregationType { return []AggregationType{Average, Count, Maximum, Minimum, None, Total} } +// AggregationTypeEnum enumerates the values for aggregation type enum. +type AggregationTypeEnum string + +const ( + // AggregationTypeEnumAverage ... + AggregationTypeEnumAverage AggregationTypeEnum = "Average" + // AggregationTypeEnumCount ... + AggregationTypeEnumCount AggregationTypeEnum = "Count" + // AggregationTypeEnumMaximum ... + AggregationTypeEnumMaximum AggregationTypeEnum = "Maximum" + // AggregationTypeEnumMinimum ... + AggregationTypeEnumMinimum AggregationTypeEnum = "Minimum" + // AggregationTypeEnumTotal ... + AggregationTypeEnumTotal AggregationTypeEnum = "Total" +) + +// PossibleAggregationTypeEnumValues returns an array of possible values for the AggregationTypeEnum const type. +func PossibleAggregationTypeEnumValues() []AggregationTypeEnum { + return []AggregationTypeEnum{AggregationTypeEnumAverage, AggregationTypeEnumCount, AggregationTypeEnumMaximum, AggregationTypeEnumMinimum, AggregationTypeEnumTotal} +} + // AlertSeverity enumerates the values for alert severity. type AlertSeverity string @@ -113,13 +134,17 @@ const ( ConditionalOperatorEqual ConditionalOperator = "Equal" // ConditionalOperatorGreaterThan ... ConditionalOperatorGreaterThan ConditionalOperator = "GreaterThan" + // ConditionalOperatorGreaterThanOrEqual ... + ConditionalOperatorGreaterThanOrEqual ConditionalOperator = "GreaterThanOrEqual" // ConditionalOperatorLessThan ... ConditionalOperatorLessThan ConditionalOperator = "LessThan" + // ConditionalOperatorLessThanOrEqual ... + ConditionalOperatorLessThanOrEqual ConditionalOperator = "LessThanOrEqual" ) // PossibleConditionalOperatorValues returns an array of possible values for the ConditionalOperator const type. func PossibleConditionalOperatorValues() []ConditionalOperator { - return []ConditionalOperator{ConditionalOperatorEqual, ConditionalOperatorGreaterThan, ConditionalOperatorLessThan} + return []ConditionalOperator{ConditionalOperatorEqual, ConditionalOperatorGreaterThan, ConditionalOperatorGreaterThanOrEqual, ConditionalOperatorLessThan, ConditionalOperatorLessThanOrEqual} } // ConditionOperator enumerates the values for condition operator. @@ -243,12 +268,35 @@ func PossibleEventLevelValues() []EventLevel { return []EventLevel{EventLevelCritical, EventLevelError, EventLevelInformational, EventLevelVerbose, EventLevelWarning} } +// MetricClass enumerates the values for metric class. +type MetricClass string + +const ( + // Availability ... + Availability MetricClass = "Availability" + // Errors ... + Errors MetricClass = "Errors" + // Latency ... + Latency MetricClass = "Latency" + // Saturation ... + Saturation MetricClass = "Saturation" + // Transactions ... + Transactions MetricClass = "Transactions" +) + +// PossibleMetricClassValues returns an array of possible values for the MetricClass const type. +func PossibleMetricClassValues() []MetricClass { + return []MetricClass{Availability, Errors, Latency, Saturation, Transactions} +} + // MetricStatisticType enumerates the values for metric statistic type. type MetricStatisticType string const ( // MetricStatisticTypeAverage ... MetricStatisticTypeAverage MetricStatisticType = "Average" + // MetricStatisticTypeCount ... + MetricStatisticTypeCount MetricStatisticType = "Count" // MetricStatisticTypeMax ... MetricStatisticTypeMax MetricStatisticType = "Max" // MetricStatisticTypeMin ... @@ -259,7 +307,7 @@ const ( // PossibleMetricStatisticTypeValues returns an array of possible values for the MetricStatisticType const type. func PossibleMetricStatisticTypeValues() []MetricStatisticType { - return []MetricStatisticType{MetricStatisticTypeAverage, MetricStatisticTypeMax, MetricStatisticTypeMin, MetricStatisticTypeSum} + return []MetricStatisticType{MetricStatisticTypeAverage, MetricStatisticTypeCount, MetricStatisticTypeMax, MetricStatisticTypeMin, MetricStatisticTypeSum} } // MetricTriggerType enumerates the values for metric trigger type. @@ -277,6 +325,60 @@ func PossibleMetricTriggerTypeValues() []MetricTriggerType { return []MetricTriggerType{MetricTriggerTypeConsecutive, MetricTriggerTypeTotal} } +// MetricUnit enumerates the values for metric unit. +type MetricUnit string + +const ( + // MetricUnitBitsPerSecond ... + MetricUnitBitsPerSecond MetricUnit = "BitsPerSecond" + // MetricUnitBytes ... + MetricUnitBytes MetricUnit = "Bytes" + // MetricUnitByteSeconds ... + MetricUnitByteSeconds MetricUnit = "ByteSeconds" + // MetricUnitBytesPerSecond ... + MetricUnitBytesPerSecond MetricUnit = "BytesPerSecond" + // MetricUnitCores ... + MetricUnitCores MetricUnit = "Cores" + // MetricUnitCount ... + MetricUnitCount MetricUnit = "Count" + // MetricUnitCountPerSecond ... + MetricUnitCountPerSecond MetricUnit = "CountPerSecond" + // MetricUnitMilliCores ... + MetricUnitMilliCores MetricUnit = "MilliCores" + // MetricUnitMilliSeconds ... + MetricUnitMilliSeconds MetricUnit = "MilliSeconds" + // MetricUnitNanoCores ... + MetricUnitNanoCores MetricUnit = "NanoCores" + // MetricUnitPercent ... + MetricUnitPercent MetricUnit = "Percent" + // MetricUnitSeconds ... + MetricUnitSeconds MetricUnit = "Seconds" + // MetricUnitUnspecified ... + MetricUnitUnspecified MetricUnit = "Unspecified" +) + +// PossibleMetricUnitValues returns an array of possible values for the MetricUnit const type. +func PossibleMetricUnitValues() []MetricUnit { + return []MetricUnit{MetricUnitBitsPerSecond, MetricUnitBytes, MetricUnitByteSeconds, MetricUnitBytesPerSecond, MetricUnitCores, MetricUnitCount, MetricUnitCountPerSecond, MetricUnitMilliCores, MetricUnitMilliSeconds, MetricUnitNanoCores, MetricUnitPercent, MetricUnitSeconds, MetricUnitUnspecified} +} + +// NamespaceClassification enumerates the values for namespace classification. +type NamespaceClassification string + +const ( + // Custom ... + Custom NamespaceClassification = "Custom" + // Platform ... + Platform NamespaceClassification = "Platform" + // Qos ... + Qos NamespaceClassification = "Qos" +) + +// PossibleNamespaceClassificationValues returns an array of possible values for the NamespaceClassification const type. +func PossibleNamespaceClassificationValues() []NamespaceClassification { + return []NamespaceClassification{Custom, Platform, Qos} +} + // OdataType enumerates the values for odata type. type OdataType string @@ -397,13 +499,11 @@ const ( OperatorLessThan Operator = "LessThan" // OperatorLessThanOrEqual ... OperatorLessThanOrEqual Operator = "LessThanOrEqual" - // OperatorNotEquals ... - OperatorNotEquals Operator = "NotEquals" ) // PossibleOperatorValues returns an array of possible values for the Operator const type. func PossibleOperatorValues() []Operator { - return []Operator{OperatorEquals, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorLessThan, OperatorLessThanOrEqual, OperatorNotEquals} + return []Operator{OperatorEquals, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorLessThan, OperatorLessThanOrEqual} } // ProvisioningState enumerates the values for provisioning state. @@ -539,28 +639,13 @@ const ( ExactCount ScaleType = "ExactCount" // PercentChangeCount ... PercentChangeCount ScaleType = "PercentChangeCount" + // ServiceAllowedNextValue ... + ServiceAllowedNextValue ScaleType = "ServiceAllowedNextValue" ) // PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. func PossibleScaleTypeValues() []ScaleType { - return []ScaleType{ChangeCount, ExactCount, PercentChangeCount} -} - -// Sensitivity enumerates the values for sensitivity. -type Sensitivity string - -const ( - // SensitivityHigh ... - SensitivityHigh Sensitivity = "High" - // SensitivityLow ... - SensitivityLow Sensitivity = "Low" - // SensitivityMedium ... - SensitivityMedium Sensitivity = "Medium" -) - -// PossibleSensitivityValues returns an array of possible values for the Sensitivity const type. -func PossibleSensitivityValues() []Sensitivity { - return []Sensitivity{SensitivityHigh, SensitivityLow, SensitivityMedium} + return []ScaleType{ChangeCount, ExactCount, PercentChangeCount, ServiceAllowedNextValue} } // TimeAggregationOperator enumerates the values for time aggregation operator. @@ -606,40 +691,3 @@ const ( func PossibleTimeAggregationTypeValues() []TimeAggregationType { return []TimeAggregationType{TimeAggregationTypeAverage, TimeAggregationTypeCount, TimeAggregationTypeLast, TimeAggregationTypeMaximum, TimeAggregationTypeMinimum, TimeAggregationTypeTotal} } - -// Unit enumerates the values for unit. -type Unit string - -const ( - // UnitBitsPerSecond ... - UnitBitsPerSecond Unit = "BitsPerSecond" - // UnitBytes ... - UnitBytes Unit = "Bytes" - // UnitByteSeconds ... - UnitByteSeconds Unit = "ByteSeconds" - // UnitBytesPerSecond ... - UnitBytesPerSecond Unit = "BytesPerSecond" - // UnitCores ... - UnitCores Unit = "Cores" - // UnitCount ... - UnitCount Unit = "Count" - // UnitCountPerSecond ... - UnitCountPerSecond Unit = "CountPerSecond" - // UnitMilliCores ... - UnitMilliCores Unit = "MilliCores" - // UnitMilliSeconds ... - UnitMilliSeconds Unit = "MilliSeconds" - // UnitNanoCores ... - UnitNanoCores Unit = "NanoCores" - // UnitPercent ... - UnitPercent Unit = "Percent" - // UnitSeconds ... - UnitSeconds Unit = "Seconds" - // UnitUnspecified ... - UnitUnspecified Unit = "Unspecified" -) - -// PossibleUnitValues returns an array of possible values for the Unit const type. -func PossibleUnitValues() []Unit { - return []Unit{UnitBitsPerSecond, UnitBytes, UnitByteSeconds, UnitBytesPerSecond, UnitCores, UnitCount, UnitCountPerSecond, UnitMilliCores, UnitMilliSeconds, UnitNanoCores, UnitPercent, UnitSeconds, UnitUnspecified} -} diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/eventcategories.go b/services/preview/monitor/mgmt/2019-06-01/insights/eventcategories.go index 86e59b424363..f43c5468ac51 100644 --- a/services/preview/monitor/mgmt/2019-06-01/insights/eventcategories.go +++ b/services/preview/monitor/mgmt/2019-06-01/insights/eventcategories.go @@ -75,7 +75,7 @@ func (client EventCategoriesClient) ListPreparer(ctx context.Context) (*http.Req preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventcategories"), + autorest.WithPath("/providers/Microsoft.Insights/eventcategories"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/insightsapi/interfaces.go b/services/preview/monitor/mgmt/2019-06-01/insights/insightsapi/interfaces.go index 1b56cc2f51c8..f62bd1388504 100644 --- a/services/preview/monitor/mgmt/2019-06-01/insights/insightsapi/interfaces.go +++ b/services/preview/monitor/mgmt/2019-06-01/insights/insightsapi/interfaces.go @@ -144,14 +144,6 @@ type MetricsClientAPI interface { var _ MetricsClientAPI = (*insights.MetricsClient)(nil) -// MetricBaselineClientAPI contains the set of methods on the MetricBaselineClient type. -type MetricBaselineClientAPI interface { - CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation insights.TimeSeriesInformation) (result insights.CalculateBaselineResponse, err error) - Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType insights.ResultType) (result insights.BaselineResponse, err error) -} - -var _ MetricBaselineClientAPI = (*insights.MetricBaselineClient)(nil) - // BaselinesClientAPI contains the set of methods on the BaselinesClient type. type BaselinesClientAPI interface { List(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType insights.ResultType) (result insights.MetricBaselinesResponse, err error) diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/logprofiles.go b/services/preview/monitor/mgmt/2019-06-01/insights/logprofiles.go index ad1500b87bc9..cfa5e8be2997 100644 --- a/services/preview/monitor/mgmt/2019-06-01/insights/logprofiles.go +++ b/services/preview/monitor/mgmt/2019-06-01/insights/logprofiles.go @@ -56,7 +56,9 @@ func (client LogProfilesClient) CreateOrUpdate(ctx context.Context, logProfileNa {Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, }}, - }}}}}); err != nil { + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.LogProfilesClient", "CreateOrUpdate", err.Error()) } @@ -98,7 +100,7 @@ func (client LogProfilesClient) CreateOrUpdatePreparer(ctx context.Context, logP autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -136,6 +138,12 @@ func (client LogProfilesClient) Delete(ctx context.Context, logProfileName strin tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, logProfileName) if err != nil { err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", nil, "Failure preparing request") @@ -173,7 +181,7 @@ func (client LogProfilesClient) DeletePreparer(ctx context.Context, logProfileNa preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -209,6 +217,12 @@ func (client LogProfilesClient) Get(ctx context.Context, logProfileName string) tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, logProfileName) if err != nil { err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Get", nil, "Failure preparing request") @@ -246,7 +260,7 @@ func (client LogProfilesClient) GetPreparer(ctx context.Context, logProfileName preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -281,6 +295,12 @@ func (client LogProfilesClient) List(ctx context.Context) (result LogProfileColl tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "List", err.Error()) + } + req, err := client.ListPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "List", nil, "Failure preparing request") @@ -317,7 +337,7 @@ func (client LogProfilesClient) ListPreparer(ctx context.Context) (*http.Request preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -355,6 +375,12 @@ func (client LogProfilesClient) Update(ctx context.Context, logProfileName strin tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, logProfileName, logProfilesResource) if err != nil { err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Update", nil, "Failure preparing request") @@ -393,7 +419,7 @@ func (client LogProfilesClient) UpdatePreparer(ctx context.Context, logProfileNa autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithJSON(logProfilesResource), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/metricalerts.go b/services/preview/monitor/mgmt/2019-06-01/insights/metricalerts.go index 94231b6fa34e..f9706664d9be 100644 --- a/services/preview/monitor/mgmt/2019-06-01/insights/metricalerts.go +++ b/services/preview/monitor/mgmt/2019-06-01/insights/metricalerts.go @@ -33,7 +33,7 @@ func NewMetricAlertsClientWithBaseURI(baseURI string, subscriptionID string) Met // CreateOrUpdate create or update an metric alert definition. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to create or update. func (client MetricAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource) (result MetricAlertResource, err error) { @@ -48,11 +48,16 @@ func (client MetricAlertsClient) CreateOrUpdate(ctx context.Context, resourceGro }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.MetricAlertProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.MetricAlertProperties.Description", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.Severity", Name: validation.Null, Rule: true, Chain: nil}, + Chain: []validation.Constraint{{Target: "parameters.MetricAlertProperties.Severity", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.MetricAlertProperties.Enabled", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.MetricAlertProperties.Scopes", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.MetricAlertProperties.EvaluationFrequency", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.MetricAlertProperties.WindowSize", Name: validation.Null, Rule: true, Chain: nil}, }}}}}); err != nil { @@ -124,7 +129,7 @@ func (client MetricAlertsClient) CreateOrUpdateResponder(resp *http.Response) (r // Delete delete an alert rule definition. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client MetricAlertsClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -137,6 +142,15 @@ func (client MetricAlertsClient) Delete(ctx context.Context, resourceGroupName s tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", nil, "Failure preparing request") @@ -199,7 +213,7 @@ func (client MetricAlertsClient) DeleteResponder(resp *http.Response) (result au // Get retrieve an alert rule definition. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client MetricAlertsClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertResource, err error) { if tracing.IsEnabled() { @@ -212,6 +226,15 @@ func (client MetricAlertsClient) Get(ctx context.Context, resourceGroupName stri tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Get", nil, "Failure preparing request") @@ -275,7 +298,7 @@ func (client MetricAlertsClient) GetResponder(resp *http.Response) (result Metri // ListByResourceGroup retrieve alert rule definitions in a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client MetricAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result MetricAlertResourceCollection, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.ListByResourceGroup") @@ -287,6 +310,15 @@ func (client MetricAlertsClient) ListByResourceGroup(ctx context.Context, resour tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -359,6 +391,12 @@ func (client MetricAlertsClient) ListBySubscription(ctx context.Context) (result tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "ListBySubscription", err.Error()) + } + req, err := client.ListBySubscriptionPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", nil, "Failure preparing request") @@ -420,7 +458,7 @@ func (client MetricAlertsClient) ListBySubscriptionResponder(resp *http.Response // Update update an metric alert definition. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to update. func (client MetricAlertsClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch) (result MetricAlertResource, err error) { @@ -434,6 +472,15 @@ func (client MetricAlertsClient) Update(ctx context.Context, resourceGroupName s tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Update", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/metricalertsstatus.go b/services/preview/monitor/mgmt/2019-06-01/insights/metricalertsstatus.go index 43cfaed42765..4709142160be 100644 --- a/services/preview/monitor/mgmt/2019-06-01/insights/metricalertsstatus.go +++ b/services/preview/monitor/mgmt/2019-06-01/insights/metricalertsstatus.go @@ -10,6 +10,7 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" "net/http" ) @@ -33,7 +34,7 @@ func NewMetricAlertsStatusClientWithBaseURI(baseURI string, subscriptionID strin // List retrieve an alert rule status. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client MetricAlertsStatusClient) List(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertStatusCollection, err error) { if tracing.IsEnabled() { @@ -46,6 +47,15 @@ func (client MetricAlertsStatusClient) List(ctx context.Context, resourceGroupNa tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsStatusClient", "List", err.Error()) + } + req, err := client.ListPreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "List", nil, "Failure preparing request") @@ -109,7 +119,7 @@ func (client MetricAlertsStatusClient) ListResponder(resp *http.Response) (resul // ListByName retrieve an alert rule status. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // statusName - the name of the status. func (client MetricAlertsStatusClient) ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (result MetricAlertStatusCollection, err error) { @@ -123,6 +133,15 @@ func (client MetricAlertsStatusClient) ListByName(ctx context.Context, resourceG tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsStatusClient", "ListByName", err.Error()) + } + req, err := client.ListByNamePreparer(ctx, resourceGroupName, ruleName, statusName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/metricbaseline.go b/services/preview/monitor/mgmt/2019-06-01/insights/metricbaseline.go deleted file mode 100644 index d395fc67bc59..000000000000 --- a/services/preview/monitor/mgmt/2019-06-01/insights/metricbaseline.go +++ /dev/null @@ -1,217 +0,0 @@ -package insights - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// MetricBaselineClient is the monitor Management Client -type MetricBaselineClient struct { - BaseClient -} - -// NewMetricBaselineClient creates an instance of the MetricBaselineClient client. -func NewMetricBaselineClient(subscriptionID string) MetricBaselineClient { - return NewMetricBaselineClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricBaselineClientWithBaseURI creates an instance of the MetricBaselineClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewMetricBaselineClientWithBaseURI(baseURI string, subscriptionID string) MetricBaselineClient { - return MetricBaselineClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CalculateBaseline **Lists the baseline values for a resource**. -// Parameters: -// resourceURI - 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 -// timeSeriesInformation - information that need to be specified to calculate a baseline on a time series. -func (client MetricBaselineClient) CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (result CalculateBaselineResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricBaselineClient.CalculateBaseline") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: timeSeriesInformation, - Constraints: []validation.Constraint{{Target: "timeSeriesInformation.Sensitivities", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "timeSeriesInformation.Values", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.MetricBaselineClient", "CalculateBaseline", err.Error()) - } - - req, err := client.CalculateBaselinePreparer(ctx, resourceURI, timeSeriesInformation) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", nil, "Failure preparing request") - return - } - - resp, err := client.CalculateBaselineSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure sending request") - return - } - - result, err = client.CalculateBaselineResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure responding to request") - return - } - - return -} - -// CalculateBaselinePreparer prepares the CalculateBaseline request. -func (client MetricBaselineClient) CalculateBaselinePreparer(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/calculatebaseline", pathParameters), - autorest.WithJSON(timeSeriesInformation), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CalculateBaselineSender sends the CalculateBaseline request. The method will close the -// http.Response Body if it receives an error. -func (client MetricBaselineClient) CalculateBaselineSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CalculateBaselineResponder handles the response to the CalculateBaseline request. The method always -// closes the http.Response Body. -func (client MetricBaselineClient) CalculateBaselineResponder(resp *http.Response) (result CalculateBaselineResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get **Gets the baseline values for a specific metric**. -// Parameters: -// resourceURI - 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 -// metricName - the name of the metric to retrieve the baseline for. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// aggregation - the aggregation type of the metric to retrieve the baseline for. -// sensitivities - the list of sensitivities (comma separated) to retrieve. -// resultType - allows retrieving only metadata of the baseline. On data request all information is retrieved. -func (client MetricBaselineClient) Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (result BaselineResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricBaselineClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceURI, metricName, timespan, interval, aggregation, sensitivities, resultType) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client MetricBaselineClient) GetPreparer(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "metricName": autorest.Encode("path", metricName), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if len(sensitivities) > 0 { - queryParameters["sensitivities"] = autorest.Encode("query", sensitivities) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/baseline/{metricName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client MetricBaselineClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client MetricBaselineClient) GetResponder(resp *http.Response) (result BaselineResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/metricdefinitions.go b/services/preview/monitor/mgmt/2019-06-01/insights/metricdefinitions.go index 69fc2e0b465a..c316b154fe7e 100644 --- a/services/preview/monitor/mgmt/2019-06-01/insights/metricdefinitions.go +++ b/services/preview/monitor/mgmt/2019-06-01/insights/metricdefinitions.go @@ -85,7 +85,7 @@ func (client MetricDefinitionsClient) ListPreparer(ctx context.Context, resource preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricDefinitions", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metricDefinitions", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/metrics.go b/services/preview/monitor/mgmt/2019-06-01/insights/metrics.go index 97687a09b498..f2329253c944 100644 --- a/services/preview/monitor/mgmt/2019-06-01/insights/metrics.go +++ b/services/preview/monitor/mgmt/2019-06-01/insights/metrics.go @@ -36,7 +36,8 @@ func NewMetricsClientWithBaseURI(baseURI string, subscriptionID string) MetricsC // timespan - the timespan of the query. It is a string with the following format // 'startDateTime_ISO/endDateTime_ISO'. // interval - the interval (i.e. timegrain) of the query. -// metricnames - the names of the metrics (comma separated) to retrieve. +// metricnames - the names of the metrics (comma separated) to retrieve. Special case: If a metricname itself +// has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be **'Metric%2Name1'** // aggregation - the list of aggregation types (comma separated) to retrieve. // top - the maximum number of records to retrieve. // Valid only if $filter is specified. @@ -44,13 +45,16 @@ func NewMetricsClientWithBaseURI(baseURI string, subscriptionID string) MetricsC // orderby - the aggregation to use for sorting results and the direction of the sort. // Only one order can be specified. // Examples: sum asc. -// 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 -// ‘*’**. +// 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 '*'**. Special case: When +// dimension name or dimension value uses round brackets. Eg: When dimension name is **dim (test) 1** Instead +// of using $filter= "dim (test) 1 eq '*' " use **$filter= "dim %2528test%2529 1 eq '*' "** When dimension name +// is **dim (test) 3** and dimension value is **dim3 (test) val** Instead of using $filter= "dim (test) 3 eq +// 'dim3 (test) val' " use **$filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "** // resultType - reduces the set of data collected. The syntax allowed depends on the operation. See the // operation's description for details. // metricnamespace - metric namespace to query metric definitions for. @@ -128,7 +132,7 @@ func (client MetricsClient) ListPreparer(ctx context.Context, resourceURI string preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metrics", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metrics", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/models.go b/services/preview/monitor/mgmt/2019-06-01/insights/models.go index 66f6ec4f5f19..e786317abf17 100644 --- a/services/preview/monitor/mgmt/2019-06-01/insights/models.go +++ b/services/preview/monitor/mgmt/2019-06-01/insights/models.go @@ -210,6 +210,10 @@ type ActionGroupResource struct { Name *string `json:"name,omitempty"` // Type - READ-ONLY; Azure resource type Type *string `json:"type,omitempty"` + // Kind - READ-ONLY; Azure resource kind + Kind *string `json:"kind,omitempty"` + // Identity - READ-ONLY; Azure resource identity + Identity *string `json:"identity,omitempty"` // Location - Resource location Location *string `json:"location,omitempty"` // Tags - Resource tags @@ -276,6 +280,24 @@ func (agr *ActionGroupResource) UnmarshalJSON(body []byte) error { } agr.Type = &typeVar } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + agr.Kind = &kind + } + case "identity": + if v != nil { + var identity string + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + agr.Identity = &identity + } case "location": if v != nil { var location string @@ -439,6 +461,10 @@ type ActivityLogAlertResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for ActivityLogAlertResource. @@ -519,6 +545,24 @@ func (alar *ActivityLogAlertResource) UnmarshalJSON(body []byte) error { } alar.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + alar.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + alar.Etag = &etag + } } } @@ -587,10 +631,14 @@ type AlertRule struct { Name *string `json:"name,omitempty"` // Description - the description of the alert rule that will be included in the alert email. Description *string `json:"description,omitempty"` + // ProvisioningState - the provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` // IsEnabled - the flag that indicates whether the alert rule is enabled. IsEnabled *bool `json:"isEnabled,omitempty"` // Condition - the condition that results in the alert rule being activated. Condition BasicRuleCondition `json:"condition,omitempty"` + // Action - action that is performed when the alert rule becomes active, and when an alert condition is resolved. + Action BasicRuleAction `json:"action,omitempty"` // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. Actions *[]BasicRuleAction `json:"actions,omitempty"` // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. @@ -606,10 +654,14 @@ func (ar AlertRule) MarshalJSON() ([]byte, error) { if ar.Description != nil { objectMap["description"] = ar.Description } + if ar.ProvisioningState != nil { + objectMap["provisioningState"] = ar.ProvisioningState + } if ar.IsEnabled != nil { objectMap["isEnabled"] = ar.IsEnabled } objectMap["condition"] = ar.Condition + objectMap["action"] = ar.Action if ar.Actions != nil { objectMap["actions"] = ar.Actions } @@ -643,6 +695,15 @@ func (ar *AlertRule) UnmarshalJSON(body []byte) error { } ar.Description = &description } + case "provisioningState": + if v != nil { + var provisioningState string + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + ar.ProvisioningState = &provisioningState + } case "isEnabled": if v != nil { var isEnabled bool @@ -660,6 +721,14 @@ func (ar *AlertRule) UnmarshalJSON(body []byte) error { } ar.Condition = condition } + case "action": + if v != nil { + action, err := unmarshalBasicRuleAction(*v) + if err != nil { + return err + } + ar.Action = action + } case "actions": if v != nil { actions, err := unmarshalBasicRuleActionArray(*v) @@ -698,6 +767,10 @@ type AlertRuleResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for AlertRuleResource. @@ -778,6 +851,24 @@ func (arr *AlertRuleResource) UnmarshalJSON(body []byte) error { } arr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + arr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + arr.Etag = &etag + } } } @@ -909,6 +1000,8 @@ type AutoscaleSetting struct { Name *string `json:"name,omitempty"` // TargetResourceURI - the resource identifier of the resource that the autoscale setting should be added to. TargetResourceURI *string `json:"targetResourceUri,omitempty"` + // TargetResourceLocation - the location of the resource that the autoscale setting should be added to. + TargetResourceLocation *string `json:"targetResourceLocation,omitempty"` } // AutoscaleSettingResource the autoscale setting resource. @@ -926,6 +1019,10 @@ type AutoscaleSettingResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for AutoscaleSettingResource. @@ -1006,6 +1103,24 @@ func (asr *AutoscaleSettingResource) UnmarshalJSON(body []byte) error { } asr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + asr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + asr.Etag = &etag + } } } @@ -1257,130 +1372,42 @@ type AzureFunctionReceiver struct { UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` } -// Baseline the baseline values for a single sensitivity value. -type Baseline struct { - // Sensitivity - the sensitivity of the baseline. Possible values include: 'SensitivityLow', 'SensitivityMedium', 'SensitivityHigh' - Sensitivity Sensitivity `json:"sensitivity,omitempty"` - // LowThresholds - The low thresholds of the baseline. - LowThresholds *[]float64 `json:"lowThresholds,omitempty"` - // HighThresholds - The high thresholds of the baseline. - HighThresholds *[]float64 `json:"highThresholds,omitempty"` -} - -// BaselineMetadata represents a baseline metadata value. -type BaselineMetadata struct { - // Name - Name of the baseline metadata. - Name *string `json:"name,omitempty"` - // Value - Value of the baseline metadata. - Value *string `json:"value,omitempty"` -} - -// BaselineMetadataValue represents a baseline metadata value. -type BaselineMetadataValue struct { - // Name - the name of the metadata. - Name *LocalizableString `json:"name,omitempty"` - // Value - the value of the metadata. - Value *string `json:"value,omitempty"` -} - -// BaselineProperties the baseline properties class. -type BaselineProperties struct { - // 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. - Timespan *string `json:"timespan,omitempty"` - // 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. - Interval *string `json:"interval,omitempty"` - // Aggregation - The aggregation type of the metric. - Aggregation *string `json:"aggregation,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Baseline - the baseline values for each sensitivity. - Baseline *[]Baseline `json:"baseline,omitempty"` - // Metadata - the baseline metadata values. - Metadata *[]BaselineMetadataValue `json:"metadata,omitempty"` -} - -// BaselineResponse the response to a baseline query. -type BaselineResponse struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; the metric baseline Id. +// AzureResource an azure resource object +type AzureResource struct { + // ID - READ-ONLY; Azure resource Id ID *string `json:"id,omitempty"` - // Type - READ-ONLY; the resource type of the baseline resource. + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type Type *string `json:"type,omitempty"` - // Name - READ-ONLY; the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString `json:"name,omitempty"` - // BaselineProperties - the properties of the baseline. - *BaselineProperties `json:"properties,omitempty"` + // Kind - READ-ONLY; Azure resource kind + Kind *string `json:"kind,omitempty"` + // Identity - READ-ONLY; Azure resource identity + Identity *string `json:"identity,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` } -// MarshalJSON is the custom marshaler for BaselineResponse. -func (br BaselineResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for AzureResource. +func (ar AzureResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if br.BaselineProperties != nil { - objectMap["properties"] = br.BaselineProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BaselineResponse struct. -func (br *BaselineResponse) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err + if ar.Location != nil { + objectMap["location"] = ar.Location } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - br.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - br.Type = &typeVar - } - case "name": - if v != nil { - var name LocalizableString - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - br.Name = &name - } - case "properties": - if v != nil { - var baselineProperties BaselineProperties - err = json.Unmarshal(*v, &baselineProperties) - if err != nil { - return err - } - br.BaselineProperties = &baselineProperties - } - } + if ar.Tags != nil { + objectMap["tags"] = ar.Tags } - - return nil + return json.Marshal(objectMap) } -// CalculateBaselineResponse the response to a calculate baseline call. -type CalculateBaselineResponse struct { - autorest.Response `json:"-"` - // Type - the resource type of the baseline resource. - Type *string `json:"type,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Baseline - the baseline values for each sensitivity. - Baseline *[]Baseline `json:"baseline,omitempty"` +// BaselineMetadata represents a baseline metadata value. +type BaselineMetadata struct { + // Name - Name of the baseline metadata. + Name *string `json:"name,omitempty"` + // Value - Value of the baseline metadata. + Value *string `json:"value,omitempty"` } // Criteria specifies the criteria for converting log to metric. @@ -1612,8 +1639,8 @@ type DynamicMetricCriteria struct { MetricName *string `json:"metricName,omitempty"` // MetricNamespace - Namespace of the metric. MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` + // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' + TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` // Dimensions - List of dimension conditions. Dimensions *[]MetricDimension `json:"dimensions,omitempty"` // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. @@ -1647,7 +1674,7 @@ func (dmc DynamicMetricCriteria) MarshalJSON() ([]byte, error) { if dmc.MetricNamespace != nil { objectMap["metricNamespace"] = dmc.MetricNamespace } - if dmc.TimeAggregation != nil { + if dmc.TimeAggregation != "" { objectMap["timeAggregation"] = dmc.TimeAggregation } if dmc.Dimensions != nil { @@ -1771,7 +1798,7 @@ func (dmc *DynamicMetricCriteria) UnmarshalJSON(body []byte) error { } case "timeAggregation": if v != nil { - var timeAggregation interface{} + var timeAggregation AggregationTypeEnum err = json.Unmarshal(*v, &timeAggregation) if err != nil { return err @@ -1871,6 +1898,12 @@ type Error struct { Message *string `json:"message,omitempty"` } +// ErrorContract describes the format of Error response. +type ErrorContract struct { + // Error - The error details. + Error *ErrorResponse `json:"error,omitempty"` +} + // ErrorResponse describes the format of Error response. type ErrorResponse struct { // Code - Error code @@ -2284,7 +2317,7 @@ type LogicAppReceiver struct { // LogMetricTrigger a log metrics trigger descriptor. type LogMetricTrigger struct { - // ThresholdOperator - Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' + // ThresholdOperator - Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'ConditionalOperatorGreaterThanOrEqual', 'ConditionalOperatorLessThanOrEqual', 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` // Threshold - The threshold of the metric trigger. Threshold *float64 `json:"threshold,omitempty"` @@ -2330,6 +2363,10 @@ type LogProfileResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for LogProfileResource. @@ -2410,6 +2447,24 @@ func (lpr *LogProfileResource) UnmarshalJSON(body []byte) error { } lpr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + lpr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + lpr.Etag = &etag + } } } @@ -2471,8 +2526,16 @@ func (lprp *LogProfileResourcePatch) UnmarshalJSON(body []byte) error { // LogSearchRule log Search Rule Definition type LogSearchRule struct { + // CreatedWithAPIVersion - READ-ONLY; The api-version used when creating this alert rule + CreatedWithAPIVersion *string `json:"createdWithApiVersion,omitempty"` + // IsLegacyLogAnalyticsRule - READ-ONLY; True if alert rule is legacy Log Analytic rule + IsLegacyLogAnalyticsRule *bool `json:"isLegacyLogAnalyticsRule,omitempty"` // Description - The description of the Log Search rule. Description *string `json:"description,omitempty"` + // DisplayName - The display name of the alert rule + DisplayName *string `json:"displayName,omitempty"` + // AutoMitigate - The flag that indicates whether the alert should be automatically resolved or not. The default is false. + AutoMitigate *bool `json:"autoMitigate,omitempty"` // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'True', 'False' Enabled Enabled `json:"enabled,omitempty"` // LastUpdatedTime - READ-ONLY; Last time the rule was updated in IS08601 format. @@ -2493,6 +2556,12 @@ func (lsr LogSearchRule) MarshalJSON() ([]byte, error) { if lsr.Description != nil { objectMap["description"] = lsr.Description } + if lsr.DisplayName != nil { + objectMap["displayName"] = lsr.DisplayName + } + if lsr.AutoMitigate != nil { + objectMap["autoMitigate"] = lsr.AutoMitigate + } if lsr.Enabled != "" { objectMap["enabled"] = lsr.Enabled } @@ -2515,6 +2584,24 @@ func (lsr *LogSearchRule) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { + case "createdWithApiVersion": + if v != nil { + var createdWithAPIVersion string + err = json.Unmarshal(*v, &createdWithAPIVersion) + if err != nil { + return err + } + lsr.CreatedWithAPIVersion = &createdWithAPIVersion + } + case "isLegacyLogAnalyticsRule": + if v != nil { + var isLegacyLogAnalyticsRule bool + err = json.Unmarshal(*v, &isLegacyLogAnalyticsRule) + if err != nil { + return err + } + lsr.IsLegacyLogAnalyticsRule = &isLegacyLogAnalyticsRule + } case "description": if v != nil { var description string @@ -2524,6 +2611,24 @@ func (lsr *LogSearchRule) UnmarshalJSON(body []byte) error { } lsr.Description = &description } + case "displayName": + if v != nil { + var displayName string + err = json.Unmarshal(*v, &displayName) + if err != nil { + return err + } + lsr.DisplayName = &displayName + } + case "autoMitigate": + if v != nil { + var autoMitigate bool + err = json.Unmarshal(*v, &autoMitigate) + if err != nil { + return err + } + lsr.AutoMitigate = &autoMitigate + } case "enabled": if v != nil { var enabled Enabled @@ -2604,6 +2709,10 @@ type LogSearchRuleResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for LogSearchRuleResource. @@ -2684,6 +2793,24 @@ func (lsrr *LogSearchRuleResource) UnmarshalJSON(body []byte) error { } lsrr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + lsrr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + lsrr.Etag = &etag + } } } @@ -2917,8 +3044,14 @@ type Metric struct { Type *string `json:"type,omitempty"` // Name - the name and the display name of the metric, i.e. it is localizable string. Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' - Unit Unit `json:"unit,omitempty"` + // DisplayDescription - Detailed description of this metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + // ErrorCode - 'Success' or the error details on query failures for this metric. + ErrorCode *string `json:"errorCode,omitempty"` + // ErrorMessage - Error message encountered querying this specific metric. + ErrorMessage *string `json:"errorMessage,omitempty"` + // Unit - The unit of the metric. Possible values include: 'MetricUnitCount', 'MetricUnitBytes', 'MetricUnitSeconds', 'MetricUnitCountPerSecond', 'MetricUnitBytesPerSecond', 'MetricUnitPercent', 'MetricUnitMilliSeconds', 'MetricUnitByteSeconds', 'MetricUnitUnspecified', 'MetricUnitCores', 'MetricUnitMilliCores', 'MetricUnitNanoCores', 'MetricUnitBitsPerSecond' + Unit MetricUnit `json:"unit,omitempty"` // Timeseries - the time series returned when a data query is performed. Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"` } @@ -2927,7 +3060,7 @@ type Metric struct { type MetricAlertAction struct { // ActionGroupID - the id of the action group to use. ActionGroupID *string `json:"actionGroupId,omitempty"` - // WebHookProperties - The properties of a webhook object. + // WebHookProperties - This field allows specifying custom properties, which would be appended to the alert payload sent as input to the webhook. WebHookProperties map[string]*string `json:"webHookProperties"` } @@ -3188,9 +3321,9 @@ type MetricAlertProperties struct { EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. WindowSize *string `json:"windowSize,omitempty"` - // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource. TargetResourceType *string `json:"targetResourceType,omitempty"` - // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource. TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` // Criteria - defines the specific alert criteria information. Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` @@ -3200,6 +3333,8 @@ type MetricAlertProperties struct { Actions *[]MetricAlertAction `json:"actions,omitempty"` // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` + // IsMigrated - READ-ONLY; the value indicating whether this alert rule is migrated. + IsMigrated *bool `json:"isMigrated,omitempty"` } // MarshalJSON is the custom marshaler for MetricAlertProperties. @@ -3355,6 +3490,213 @@ func (mapVar *MetricAlertProperties) UnmarshalJSON(body []byte) error { } mapVar.LastUpdatedTime = &lastUpdatedTime } + case "isMigrated": + if v != nil { + var isMigrated bool + err = json.Unmarshal(*v, &isMigrated) + if err != nil { + return err + } + mapVar.IsMigrated = &isMigrated + } + } + } + + return nil +} + +// MetricAlertPropertiesPatch an alert rule properties for patch. +type MetricAlertPropertiesPatch struct { + // Description - the description of the metric alert that will be included in the alert email. + Description *string `json:"description,omitempty"` + // Severity - Alert severity {0, 1, 2, 3, 4} + Severity *int32 `json:"severity,omitempty"` + // Enabled - the flag that indicates whether the metric alert is enabled. + Enabled *bool `json:"enabled,omitempty"` + // Scopes - the list of resource id's that this metric alert is scoped to. + Scopes *[]string `json:"scopes,omitempty"` + // EvaluationFrequency - how often the metric alert is evaluated represented in ISO 8601 duration format. + EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` + // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. + WindowSize *string `json:"windowSize,omitempty"` + // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + TargetResourceType *string `json:"targetResourceType,omitempty"` + // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` + // Criteria - defines the specific alert criteria information. + Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` + // AutoMitigate - the flag that indicates whether the alert should be auto resolved or not. The default is true. + AutoMitigate *bool `json:"autoMitigate,omitempty"` + // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + Actions *[]MetricAlertAction `json:"actions,omitempty"` + // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. + LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` + // IsMigrated - READ-ONLY; the value indicating whether this alert rule is migrated. + IsMigrated *bool `json:"isMigrated,omitempty"` +} + +// MarshalJSON is the custom marshaler for MetricAlertPropertiesPatch. +func (mapp MetricAlertPropertiesPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mapp.Description != nil { + objectMap["description"] = mapp.Description + } + if mapp.Severity != nil { + objectMap["severity"] = mapp.Severity + } + if mapp.Enabled != nil { + objectMap["enabled"] = mapp.Enabled + } + if mapp.Scopes != nil { + objectMap["scopes"] = mapp.Scopes + } + if mapp.EvaluationFrequency != nil { + objectMap["evaluationFrequency"] = mapp.EvaluationFrequency + } + if mapp.WindowSize != nil { + objectMap["windowSize"] = mapp.WindowSize + } + if mapp.TargetResourceType != nil { + objectMap["targetResourceType"] = mapp.TargetResourceType + } + if mapp.TargetResourceRegion != nil { + objectMap["targetResourceRegion"] = mapp.TargetResourceRegion + } + objectMap["criteria"] = mapp.Criteria + if mapp.AutoMitigate != nil { + objectMap["autoMitigate"] = mapp.AutoMitigate + } + if mapp.Actions != nil { + objectMap["actions"] = mapp.Actions + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MetricAlertPropertiesPatch struct. +func (mapp *MetricAlertPropertiesPatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + mapp.Description = &description + } + case "severity": + if v != nil { + var severity int32 + err = json.Unmarshal(*v, &severity) + if err != nil { + return err + } + mapp.Severity = &severity + } + case "enabled": + if v != nil { + var enabled bool + err = json.Unmarshal(*v, &enabled) + if err != nil { + return err + } + mapp.Enabled = &enabled + } + case "scopes": + if v != nil { + var scopes []string + err = json.Unmarshal(*v, &scopes) + if err != nil { + return err + } + mapp.Scopes = &scopes + } + case "evaluationFrequency": + if v != nil { + var evaluationFrequency string + err = json.Unmarshal(*v, &evaluationFrequency) + if err != nil { + return err + } + mapp.EvaluationFrequency = &evaluationFrequency + } + case "windowSize": + if v != nil { + var windowSize string + err = json.Unmarshal(*v, &windowSize) + if err != nil { + return err + } + mapp.WindowSize = &windowSize + } + case "targetResourceType": + if v != nil { + var targetResourceType string + err = json.Unmarshal(*v, &targetResourceType) + if err != nil { + return err + } + mapp.TargetResourceType = &targetResourceType + } + case "targetResourceRegion": + if v != nil { + var targetResourceRegion string + err = json.Unmarshal(*v, &targetResourceRegion) + if err != nil { + return err + } + mapp.TargetResourceRegion = &targetResourceRegion + } + case "criteria": + if v != nil { + criteria, err := unmarshalBasicMetricAlertCriteria(*v) + if err != nil { + return err + } + mapp.Criteria = criteria + } + case "autoMitigate": + if v != nil { + var autoMitigate bool + err = json.Unmarshal(*v, &autoMitigate) + if err != nil { + return err + } + mapp.AutoMitigate = &autoMitigate + } + case "actions": + if v != nil { + var actions []MetricAlertAction + err = json.Unmarshal(*v, &actions) + if err != nil { + return err + } + mapp.Actions = &actions + } + case "lastUpdatedTime": + if v != nil { + var lastUpdatedTime date.Time + err = json.Unmarshal(*v, &lastUpdatedTime) + if err != nil { + return err + } + mapp.LastUpdatedTime = &lastUpdatedTime + } + case "isMigrated": + if v != nil { + var isMigrated bool + err = json.Unmarshal(*v, &isMigrated) + if err != nil { + return err + } + mapp.IsMigrated = &isMigrated + } } } @@ -3376,6 +3718,10 @@ type MetricAlertResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for MetricAlertResource. @@ -3456,6 +3802,24 @@ func (mar *MetricAlertResource) UnmarshalJSON(body []byte) error { } mar.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + mar.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + mar.Etag = &etag + } } } @@ -3473,8 +3837,8 @@ type MetricAlertResourceCollection struct { type MetricAlertResourcePatch struct { // Tags - Resource tags Tags map[string]*string `json:"tags"` - // MetricAlertProperties - The alert rule properties of the resource. - *MetricAlertProperties `json:"properties,omitempty"` + // MetricAlertPropertiesPatch - The alert rule properties of the resource. + *MetricAlertPropertiesPatch `json:"properties,omitempty"` } // MarshalJSON is the custom marshaler for MetricAlertResourcePatch. @@ -3483,8 +3847,8 @@ func (marp MetricAlertResourcePatch) MarshalJSON() ([]byte, error) { if marp.Tags != nil { objectMap["tags"] = marp.Tags } - if marp.MetricAlertProperties != nil { - objectMap["properties"] = marp.MetricAlertProperties + if marp.MetricAlertPropertiesPatch != nil { + objectMap["properties"] = marp.MetricAlertPropertiesPatch } return json.Marshal(objectMap) } @@ -3509,12 +3873,12 @@ func (marp *MetricAlertResourcePatch) UnmarshalJSON(body []byte) error { } case "properties": if v != nil { - var metricAlertProperties MetricAlertProperties - err = json.Unmarshal(*v, &metricAlertProperties) + var metricAlertPropertiesPatch MetricAlertPropertiesPatch + err = json.Unmarshal(*v, &metricAlertPropertiesPatch) if err != nil { return err } - marp.MetricAlertProperties = &metricAlertProperties + marp.MetricAlertPropertiesPatch = &metricAlertPropertiesPatch } } } @@ -3693,7 +4057,7 @@ type MetricBaselinesResponse struct { // MetricCriteria criterion to filter metrics. type MetricCriteria struct { - // Operator - the criteria operator. Possible values include: 'OperatorEquals', 'OperatorNotEquals', 'OperatorGreaterThan', 'OperatorGreaterThanOrEqual', 'OperatorLessThan', 'OperatorLessThanOrEqual' + // Operator - the criteria operator. Possible values include: 'OperatorEquals', 'OperatorGreaterThan', 'OperatorGreaterThanOrEqual', 'OperatorLessThan', 'OperatorLessThanOrEqual' Operator Operator `json:"operator,omitempty"` // Threshold - the criteria threshold value that activates the alert. Threshold *float64 `json:"threshold,omitempty"` @@ -3705,8 +4069,8 @@ type MetricCriteria struct { MetricName *string `json:"metricName,omitempty"` // MetricNamespace - Namespace of the metric. MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` + // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' + TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` // Dimensions - List of dimension conditions. Dimensions *[]MetricDimension `json:"dimensions,omitempty"` // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. @@ -3734,7 +4098,7 @@ func (mc MetricCriteria) MarshalJSON() ([]byte, error) { if mc.MetricNamespace != nil { objectMap["metricNamespace"] = mc.MetricNamespace } - if mc.TimeAggregation != nil { + if mc.TimeAggregation != "" { objectMap["timeAggregation"] = mc.TimeAggregation } if mc.Dimensions != nil { @@ -3840,7 +4204,7 @@ func (mc *MetricCriteria) UnmarshalJSON(body []byte) error { } case "timeAggregation": if v != nil { - var timeAggregation interface{} + var timeAggregation AggregationTypeEnum err = json.Unmarshal(*v, &timeAggregation) if err != nil { return err @@ -3890,8 +4254,14 @@ type MetricDefinition struct { Namespace *string `json:"namespace,omitempty"` // Name - the name and the display name of the metric, i.e. it is a localizable string. Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' - Unit Unit `json:"unit,omitempty"` + // DisplayDescription - Detailed description of this metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + // Category - Custom category name for this metric. + Category *string `json:"category,omitempty"` + // MetricClass - The class of the metric. Possible values include: 'Availability', 'Transactions', 'Errors', 'Latency', 'Saturation' + MetricClass MetricClass `json:"metricClass,omitempty"` + // Unit - The unit of the metric. Possible values include: 'MetricUnitCount', 'MetricUnitBytes', 'MetricUnitSeconds', 'MetricUnitCountPerSecond', 'MetricUnitBytesPerSecond', 'MetricUnitPercent', 'MetricUnitMilliSeconds', 'MetricUnitByteSeconds', 'MetricUnitUnspecified', 'MetricUnitCores', 'MetricUnitMilliCores', 'MetricUnitNanoCores', 'MetricUnitBitsPerSecond' + Unit MetricUnit `json:"unit,omitempty"` // PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' PrimaryAggregationType AggregationType `json:"primaryAggregationType,omitempty"` // SupportedAggregationTypes - the collection of what aggregation types are supported. @@ -3923,12 +4293,14 @@ type MetricDimension struct { // MetricNamespace metric namespace class specifies the metadata for a metric namespace. type MetricNamespace struct { - // ID - The ID of the metricNamespace. + // ID - The ID of the metric namespace. ID *string `json:"id,omitempty"` // Type - The type of the namespace. Type *string `json:"type,omitempty"` - // Name - The name of the namespace. + // Name - The escaped name of the namespace. Name *string `json:"name,omitempty"` + // Classification - Kind of namespace. Possible values include: 'Platform', 'Custom', 'Qos' + Classification NamespaceClassification `json:"classification,omitempty"` // Properties - Properties which include the fully qualified namespace name. Properties *MetricNamespaceName `json:"properties,omitempty"` } @@ -3974,9 +4346,11 @@ type MetricTrigger struct { MetricNamespace *string `json:"metricNamespace,omitempty"` // MetricResourceURI - the resource identifier of the resource the rule monitors. MetricResourceURI *string `json:"metricResourceUri,omitempty"` + // MetricResourceLocation - the location of the resource the rule monitors. + MetricResourceLocation *string `json:"metricResourceLocation,omitempty"` // TimeGrain - 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. TimeGrain *string `json:"timeGrain,omitempty"` - // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum' + // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum', 'MetricStatisticTypeCount' Statistic MetricStatisticType `json:"statistic,omitempty"` // TimeWindow - 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. TimeWindow *string `json:"timeWindow,omitempty"` @@ -3988,6 +4362,8 @@ type MetricTrigger struct { Threshold *float64 `json:"threshold,omitempty"` // Dimensions - List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. Dimensions *[]ScaleRuleMetricDimension `json:"dimensions,omitempty"` + // DividePerInstance - a value indicating whether metric should divide per instance. + DividePerInstance *bool `json:"dividePerInstance,omitempty"` } // MetricValue represents a metric value. @@ -4023,8 +4399,8 @@ type MultiMetricCriteria struct { MetricName *string `json:"metricName,omitempty"` // MetricNamespace - Namespace of the metric. MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` + // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' + TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` // Dimensions - List of dimension conditions. Dimensions *[]MetricDimension `json:"dimensions,omitempty"` // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. @@ -4087,7 +4463,7 @@ func (mmc MultiMetricCriteria) MarshalJSON() ([]byte, error) { if mmc.MetricNamespace != nil { objectMap["metricNamespace"] = mmc.MetricNamespace } - if mmc.TimeAggregation != nil { + if mmc.TimeAggregation != "" { objectMap["timeAggregation"] = mmc.TimeAggregation } if mmc.Dimensions != nil { @@ -4175,7 +4551,7 @@ func (mmc *MultiMetricCriteria) UnmarshalJSON(body []byte) error { } case "timeAggregation": if v != nil { - var timeAggregation interface{} + var timeAggregation AggregationTypeEnum err = json.Unmarshal(*v, &timeAggregation) if err != nil { return err @@ -4308,6 +4684,10 @@ type Resource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for Resource. @@ -4325,15 +4705,15 @@ func (r Resource) MarshalJSON() ([]byte, error) { // Response the response to a metrics query. type Response struct { autorest.Response `json:"-"` - // Cost - The integer value representing the cost of the query, for data case. + // Cost - The integer value representing the relative cost of the query. Cost *float64 `json:"cost,omitempty"` // 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. Timespan *string `json:"timespan,omitempty"` // 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. Interval *string `json:"interval,omitempty"` - // Namespace - The namespace of the metrics been queried + // Namespace - The namespace of the metrics being queried Namespace *string `json:"namespace,omitempty"` - // Resourceregion - The region of the resource been queried for metrics. + // Resourceregion - The region of the resource being queried for metrics. Resourceregion *string `json:"resourceregion,omitempty"` // Value - the value of the collection. Value *[]Metric `json:"value,omitempty"` @@ -4579,6 +4959,12 @@ type BasicRuleDataSource interface { type RuleDataSource struct { // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' OdataType OdataType `json:"odata.type,omitempty"` } @@ -4631,6 +5017,15 @@ func (rds RuleDataSource) MarshalJSON() ([]byte, error) { if rds.ResourceURI != nil { objectMap["resourceUri"] = rds.ResourceURI } + if rds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rds.LegacyResourceID + } + if rds.ResourceLocation != nil { + objectMap["resourceLocation"] = rds.ResourceLocation + } + if rds.MetricNamespace != nil { + objectMap["metricNamespace"] = rds.MetricNamespace + } if rds.OdataType != "" { objectMap["odata.type"] = rds.OdataType } @@ -4733,6 +5128,12 @@ type RuleManagementEventDataSource struct { Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' OdataType OdataType `json:"odata.type,omitempty"` } @@ -4771,6 +5172,15 @@ func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { if rmeds.ResourceURI != nil { objectMap["resourceUri"] = rmeds.ResourceURI } + if rmeds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rmeds.LegacyResourceID + } + if rmeds.ResourceLocation != nil { + objectMap["resourceLocation"] = rmeds.ResourceLocation + } + if rmeds.MetricNamespace != nil { + objectMap["metricNamespace"] = rmeds.MetricNamespace + } if rmeds.OdataType != "" { objectMap["odata.type"] = rmeds.OdataType } @@ -4804,6 +5214,12 @@ type RuleMetricDataSource struct { MetricName *string `json:"metricName,omitempty"` // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' OdataType OdataType `json:"odata.type,omitempty"` } @@ -4818,6 +5234,15 @@ func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) { if rmds.ResourceURI != nil { objectMap["resourceUri"] = rmds.ResourceURI } + if rmds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rmds.LegacyResourceID + } + if rmds.ResourceLocation != nil { + objectMap["resourceLocation"] = rmds.ResourceLocation + } + if rmds.MetricNamespace != nil { + objectMap["metricNamespace"] = rmds.MetricNamespace + } if rmds.OdataType != "" { objectMap["odata.type"] = rmds.OdataType } @@ -4895,7 +5320,7 @@ func (rwa RuleWebhookAction) AsBasicRuleAction() (BasicRuleAction, bool) { type ScaleAction struct { // Direction - the scale direction. Whether the scaling action increases or decreases the number of instances. Possible values include: 'ScaleDirectionNone', 'ScaleDirectionIncrease', 'ScaleDirectionDecrease' Direction ScaleDirection `json:"direction,omitempty"` - // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount' + // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount', 'ServiceAllowedNextValue' Type ScaleType `json:"type,omitempty"` // Value - the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1. Value *string `json:"value,omitempty"` @@ -5223,8 +5648,8 @@ type TimeSeriesBaseline struct { Timestamps *[]date.Time `json:"timestamps,omitempty"` // Data - The baseline values for each sensitivity. Data *[]SingleBaseline `json:"data,omitempty"` - // Metadata - The baseline metadata values. - Metadata *[]BaselineMetadata `json:"metadata,omitempty"` + // MetadataValues - The baseline metadata values. + MetadataValues *[]BaselineMetadata `json:"metadataValues,omitempty"` } // TimeSeriesElement a time series result type. The discriminator value is always TimeSeries in this case. @@ -5235,16 +5660,6 @@ type TimeSeriesElement struct { Data *[]MetricValue `json:"data,omitempty"` } -// TimeSeriesInformation the time series info needed for calculating the baseline. -type TimeSeriesInformation struct { - // Sensitivities - the list of sensitivities for calculating the baseline. - Sensitivities *[]string `json:"sensitivities,omitempty"` - // Values - The metric values to calculate the baseline. - Values *[]float64 `json:"values,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` -} - // TimeWindow a specific date-time for the profile. type TimeWindow struct { // TimeZone - 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 @@ -5257,7 +5672,7 @@ type TimeWindow struct { // TriggerCondition the condition that results in the Log Search rule. type TriggerCondition struct { - // ThresholdOperator - Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' + // ThresholdOperator - Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'ConditionalOperatorGreaterThanOrEqual', 'ConditionalOperatorLessThanOrEqual', 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` // Threshold - Result or count threshold based on which rule should be triggered. Threshold *float64 `json:"threshold,omitempty"` diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/operations.go b/services/preview/monitor/mgmt/2019-06-01/insights/operations.go index 3f82351c7f23..afb74dc9248f 100644 --- a/services/preview/monitor/mgmt/2019-06-01/insights/operations.go +++ b/services/preview/monitor/mgmt/2019-06-01/insights/operations.go @@ -74,7 +74,7 @@ func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/operations"), + autorest.WithPath("/providers/Microsoft.Insights/operations"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/scheduledqueryrules.go b/services/preview/monitor/mgmt/2019-06-01/insights/scheduledqueryrules.go index c9d43964ecb0..22b09a5f8997 100644 --- a/services/preview/monitor/mgmt/2019-06-01/insights/scheduledqueryrules.go +++ b/services/preview/monitor/mgmt/2019-06-01/insights/scheduledqueryrules.go @@ -34,7 +34,7 @@ func NewScheduledQueryRulesClientWithBaseURI(baseURI string, subscriptionID stri // CreateOrUpdate creates or updates an log search rule. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to create or update. func (client ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResource) (result LogSearchRuleResource, err error) { @@ -49,6 +49,11 @@ func (client ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, reso }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.LogSearchRule", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source", Name: validation.Null, Rule: true, @@ -100,7 +105,7 @@ func (client ScheduledQueryRulesClient) CreateOrUpdatePreparer(ctx context.Conte autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -126,7 +131,7 @@ func (client ScheduledQueryRulesClient) CreateOrUpdateResponder(resp *http.Respo // Delete deletes a Log Search rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client ScheduledQueryRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -139,6 +144,15 @@ func (client ScheduledQueryRulesClient) Delete(ctx context.Context, resourceGrou tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", nil, "Failure preparing request") @@ -177,7 +191,7 @@ func (client ScheduledQueryRulesClient) DeletePreparer(ctx context.Context, reso preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -201,7 +215,7 @@ func (client ScheduledQueryRulesClient) DeleteResponder(resp *http.Response) (re // Get gets an Log Search rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client ScheduledQueryRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result LogSearchRuleResource, err error) { if tracing.IsEnabled() { @@ -214,6 +228,15 @@ func (client ScheduledQueryRulesClient) Get(ctx context.Context, resourceGroupNa tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Get", nil, "Failure preparing request") @@ -252,7 +275,7 @@ func (client ScheduledQueryRulesClient) GetPreparer(ctx context.Context, resourc preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -277,7 +300,7 @@ func (client ScheduledQueryRulesClient) GetResponder(resp *http.Response) (resul // ListByResourceGroup list the Log Search rules within a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // filter - the filter to apply on the operation. For more information please see // https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx func (client ScheduledQueryRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result LogSearchRuleResourceCollection, err error) { @@ -291,6 +314,15 @@ func (client ScheduledQueryRulesClient) ListByResourceGroup(ctx context.Context, tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -331,7 +363,7 @@ func (client ScheduledQueryRulesClient) ListByResourceGroupPreparer(ctx context. preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -369,6 +401,12 @@ func (client ScheduledQueryRulesClient) ListBySubscription(ctx context.Context, tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "ListBySubscription", err.Error()) + } + req, err := client.ListBySubscriptionPreparer(ctx, filter) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", nil, "Failure preparing request") @@ -408,7 +446,7 @@ func (client ScheduledQueryRulesClient) ListBySubscriptionPreparer(ctx context.C preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/scheduledQueryRules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -433,7 +471,7 @@ func (client ScheduledQueryRulesClient) ListBySubscriptionResponder(resp *http.R // Update update log search Rule. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to update. func (client ScheduledQueryRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResourcePatch) (result LogSearchRuleResource, err error) { @@ -447,6 +485,15 @@ func (client ScheduledQueryRulesClient) Update(ctx context.Context, resourceGrou tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Update", nil, "Failure preparing request") @@ -486,7 +533,7 @@ func (client ScheduledQueryRulesClient) UpdatePreparer(ctx context.Context, reso autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/tenantactivitylogs.go b/services/preview/monitor/mgmt/2019-06-01/insights/tenantactivitylogs.go index 7501f047bb38..7c6ee7981381 100644 --- a/services/preview/monitor/mgmt/2019-06-01/insights/tenantactivitylogs.go +++ b/services/preview/monitor/mgmt/2019-06-01/insights/tenantactivitylogs.go @@ -107,7 +107,7 @@ func (client TenantActivityLogsClient) ListPreparer(ctx context.Context, filter preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventtypes/management/values"), + autorest.WithPath("/providers/Microsoft.Insights/eventtypes/management/values"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/CHANGELOG.md b/services/preview/monitor/mgmt/2019-11-01-preview/insights/CHANGELOG.md index 52911e4cc5e4..7e43d212c466 100644 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/CHANGELOG.md +++ b/services/preview/monitor/mgmt/2019-11-01-preview/insights/CHANGELOG.md @@ -1,2 +1,163 @@ -# Change History +# Unreleased +## Breaking Changes + +### Removed Constants + +1. Operator.OperatorNotEquals +1. Sensitivity.SensitivityHigh +1. Sensitivity.SensitivityLow +1. Sensitivity.SensitivityMedium +1. Unit.UnitBitsPerSecond +1. Unit.UnitByteSeconds +1. Unit.UnitBytes +1. Unit.UnitBytesPerSecond +1. Unit.UnitCores +1. Unit.UnitCount +1. Unit.UnitCountPerSecond +1. Unit.UnitMilliCores +1. Unit.UnitMilliSeconds +1. Unit.UnitNanoCores +1. Unit.UnitPercent +1. Unit.UnitSeconds +1. Unit.UnitUnspecified + +### Removed Funcs + +1. *BaselineResponse.UnmarshalJSON([]byte) error +1. BaselineResponse.MarshalJSON() ([]byte, error) +1. MetricBaselineClient.CalculateBaseline(context.Context, string, TimeSeriesInformation) (CalculateBaselineResponse, error) +1. MetricBaselineClient.CalculateBaselinePreparer(context.Context, string, TimeSeriesInformation) (*http.Request, error) +1. MetricBaselineClient.CalculateBaselineResponder(*http.Response) (CalculateBaselineResponse, error) +1. MetricBaselineClient.CalculateBaselineSender(*http.Request) (*http.Response, error) +1. MetricBaselineClient.Get(context.Context, string, string, string, *string, string, string, ResultType) (BaselineResponse, error) +1. MetricBaselineClient.GetPreparer(context.Context, string, string, string, *string, string, string, ResultType) (*http.Request, error) +1. MetricBaselineClient.GetResponder(*http.Response) (BaselineResponse, error) +1. MetricBaselineClient.GetSender(*http.Request) (*http.Response, error) +1. NewMetricBaselineClient(string) MetricBaselineClient +1. NewMetricBaselineClientWithBaseURI(string, string) MetricBaselineClient +1. PossibleSensitivityValues() []Sensitivity +1. PossibleUnitValues() []Unit + +### Struct Changes + +#### Removed Structs + +1. Baseline +1. BaselineMetadataValue +1. BaselineProperties +1. BaselineResponse +1. CalculateBaselineResponse +1. MetricBaselineClient +1. TimeSeriesInformation + +#### Removed Struct Fields + +1. TimeSeriesBaseline.Metadata + +### Signature Changes + +#### Struct Fields + +1. DynamicMetricCriteria.TimeAggregation changed type from interface{} to AggregationTypeEnum +1. Metric.Unit changed type from Unit to MetricUnit +1. MetricCriteria.TimeAggregation changed type from interface{} to AggregationTypeEnum +1. MetricDefinition.Unit changed type from Unit to MetricUnit +1. MultiMetricCriteria.TimeAggregation changed type from interface{} to AggregationTypeEnum + +## Additive Changes + +### New Constants + +1. AggregationTypeEnum.AggregationTypeEnumAverage +1. AggregationTypeEnum.AggregationTypeEnumCount +1. AggregationTypeEnum.AggregationTypeEnumMaximum +1. AggregationTypeEnum.AggregationTypeEnumMinimum +1. AggregationTypeEnum.AggregationTypeEnumTotal +1. ConditionalOperator.ConditionalOperatorGreaterThanOrEqual +1. ConditionalOperator.ConditionalOperatorLessThanOrEqual +1. MetricClass.Availability +1. MetricClass.Errors +1. MetricClass.Latency +1. MetricClass.Saturation +1. MetricClass.Transactions +1. MetricStatisticType.MetricStatisticTypeCount +1. MetricUnit.MetricUnitBitsPerSecond +1. MetricUnit.MetricUnitByteSeconds +1. MetricUnit.MetricUnitBytes +1. MetricUnit.MetricUnitBytesPerSecond +1. MetricUnit.MetricUnitCores +1. MetricUnit.MetricUnitCount +1. MetricUnit.MetricUnitCountPerSecond +1. MetricUnit.MetricUnitMilliCores +1. MetricUnit.MetricUnitMilliSeconds +1. MetricUnit.MetricUnitNanoCores +1. MetricUnit.MetricUnitPercent +1. MetricUnit.MetricUnitSeconds +1. MetricUnit.MetricUnitUnspecified +1. NamespaceClassification.Custom +1. NamespaceClassification.Platform +1. NamespaceClassification.Qos +1. ScaleType.ServiceAllowedNextValue + +### New Funcs + +1. AzureResource.MarshalJSON() ([]byte, error) +1. PossibleAggregationTypeEnumValues() []AggregationTypeEnum +1. PossibleMetricClassValues() []MetricClass +1. PossibleMetricUnitValues() []MetricUnit +1. PossibleNamespaceClassificationValues() []NamespaceClassification + +### Struct Changes + +#### New Structs + +1. AzureResource +1. ErrorContract + +#### New Struct Fields + +1. ActionGroupResource.Identity +1. ActionGroupResource.Kind +1. ActivityLogAlertResource.Etag +1. ActivityLogAlertResource.Kind +1. AlertRule.Action +1. AlertRule.ProvisioningState +1. AlertRuleResource.Etag +1. AlertRuleResource.Kind +1. AutoscaleSetting.TargetResourceLocation +1. AutoscaleSettingResource.Etag +1. AutoscaleSettingResource.Kind +1. LogProfileResource.Etag +1. LogProfileResource.Kind +1. LogSearchRule.AutoMitigate +1. LogSearchRule.CreatedWithAPIVersion +1. LogSearchRule.DisplayName +1. LogSearchRule.IsLegacyLogAnalyticsRule +1. LogSearchRuleResource.Etag +1. LogSearchRuleResource.Kind +1. Metric.DisplayDescription +1. Metric.ErrorCode +1. Metric.ErrorMessage +1. MetricAlertProperties.IsMigrated +1. MetricAlertPropertiesPatch.IsMigrated +1. MetricAlertResource.Etag +1. MetricAlertResource.Kind +1. MetricDefinition.Category +1. MetricDefinition.DisplayDescription +1. MetricDefinition.MetricClass +1. MetricNamespace.Classification +1. MetricTrigger.DividePerInstance +1. MetricTrigger.MetricResourceLocation +1. Resource.Etag +1. Resource.Kind +1. RuleDataSource.LegacyResourceID +1. RuleDataSource.MetricNamespace +1. RuleDataSource.ResourceLocation +1. RuleManagementEventDataSource.LegacyResourceID +1. RuleManagementEventDataSource.MetricNamespace +1. RuleManagementEventDataSource.ResourceLocation +1. RuleMetricDataSource.LegacyResourceID +1. RuleMetricDataSource.MetricNamespace +1. RuleMetricDataSource.ResourceLocation +1. TimeSeriesBaseline.MetadataValues diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/_meta.json b/services/preview/monitor/mgmt/2019-11-01-preview/insights/_meta.json index be94626a714d..e62ac82c63e7 100644 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/_meta.json +++ b/services/preview/monitor/mgmt/2019-11-01-preview/insights/_meta.json @@ -1,5 +1,5 @@ { - "commit": "4c93f28f89435f6d244f4db61bbf810b5d20f09f", + "commit": "83f6c7b9ac240d3862e909245f0a61d70ae33908", "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", "tag": "package-2019-11", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/actiongroups.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/actiongroups.go index fe4664342676..ce2e6509e2da 100644 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/actiongroups.go +++ b/services/preview/monitor/mgmt/2019-11-01-preview/insights/actiongroups.go @@ -33,7 +33,7 @@ func NewActionGroupsClientWithBaseURI(baseURI string, subscriptionID string) Act // CreateOrUpdate create a new action group or update an existing one. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. // actionGroup - the action group to create or use for the update. func (client ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (result ActionGroupResource, err error) { @@ -48,6 +48,9 @@ func (client ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGro }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: actionGroup, Constraints: []validation.Constraint{{Target: "actionGroup.ActionGroup", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.Null, Rule: true, @@ -124,7 +127,7 @@ func (client ActionGroupsClient) CreateOrUpdateResponder(resp *http.Response) (r // Delete delete an action group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. func (client ActionGroupsClient) Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -138,6 +141,9 @@ func (client ActionGroupsClient) Delete(ctx context.Context, resourceGroupName s }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ActionGroupsClient", "Delete", err.Error()) @@ -206,7 +212,7 @@ func (client ActionGroupsClient) DeleteResponder(resp *http.Response) (result au // EnableReceiver 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. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. // enableRequest - the receiver to re-enable. func (client ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (result autorest.Response, err error) { @@ -221,6 +227,9 @@ func (client ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGro }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: enableRequest, Constraints: []validation.Constraint{{Target: "enableRequest.ReceiverName", Name: validation.Null, Rule: true, Chain: nil}}}, {TargetValue: client.SubscriptionID, @@ -292,7 +301,7 @@ func (client ActionGroupsClient) EnableReceiverResponder(resp *http.Response) (r // Get get an action group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. func (client ActionGroupsClient) Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result ActionGroupResource, err error) { if tracing.IsEnabled() { @@ -306,6 +315,9 @@ func (client ActionGroupsClient) Get(ctx context.Context, resourceGroupName stri }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ActionGroupsClient", "Get", err.Error()) @@ -374,7 +386,7 @@ func (client ActionGroupsClient) GetResponder(resp *http.Response) (result Actio // ListByResourceGroup get a list of all action groups in a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client ActionGroupsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActionGroupList, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.ListByResourceGroup") @@ -387,6 +399,9 @@ func (client ActionGroupsClient) ListByResourceGroup(ctx context.Context, resour }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ActionGroupsClient", "ListByResourceGroup", err.Error()) @@ -531,7 +546,7 @@ func (client ActionGroupsClient) ListBySubscriptionIDResponder(resp *http.Respon // Update updates an existing action group's tags. To update other fields use the CreateOrUpdate method. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // actionGroupName - the name of the action group. // actionGroupPatch - parameters supplied to the operation. func (client ActionGroupsClient) Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (result ActionGroupResource, err error) { @@ -547,7 +562,10 @@ func (client ActionGroupsClient) Update(ctx context.Context, resourceGroupName s } if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ActionGroupsClient", "Update", err.Error()) } diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/activitylogalerts.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/activitylogalerts.go index 959d56c034a6..f897b08a6f0c 100644 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/activitylogalerts.go +++ b/services/preview/monitor/mgmt/2019-11-01-preview/insights/activitylogalerts.go @@ -34,7 +34,7 @@ func NewActivityLogAlertsClientWithBaseURI(baseURI string, subscriptionID string // CreateOrUpdate create a new activity log alert or update an existing one. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // activityLogAlertName - the name of the activity log alert. // activityLogAlert - the activity log alert to create or use for the update. func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (result ActivityLogAlertResource, err error) { @@ -51,6 +51,9 @@ func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resour if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: activityLogAlert, Constraints: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Scopes", Name: validation.Null, Rule: true, Chain: nil}, @@ -126,7 +129,7 @@ func (client ActivityLogAlertsClient) CreateOrUpdateResponder(resp *http.Respons // Delete delete an activity log alert. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // activityLogAlertName - the name of the activity log alert. func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -141,7 +144,10 @@ func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupN } if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ActivityLogAlertsClient", "Delete", err.Error()) } @@ -207,7 +213,7 @@ func (client ActivityLogAlertsClient) DeleteResponder(resp *http.Response) (resu // Get get an activity log alert. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // activityLogAlertName - the name of the activity log alert. func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result ActivityLogAlertResource, err error) { if tracing.IsEnabled() { @@ -222,7 +228,10 @@ func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName } if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ActivityLogAlertsClient", "Get", err.Error()) } @@ -289,7 +298,7 @@ func (client ActivityLogAlertsClient) GetResponder(resp *http.Response) (result // ListByResourceGroup get a list of all activity log alerts in a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActivityLogAlertList, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.ListByResourceGroup") @@ -303,7 +312,10 @@ func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, r } if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ActivityLogAlertsClient", "ListByResourceGroup", err.Error()) } @@ -446,7 +458,7 @@ func (client ActivityLogAlertsClient) ListBySubscriptionIDResponder(resp *http.R // Update updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // activityLogAlertName - the name of the activity log alert. // activityLogAlertPatch - parameters supplied to the operation. func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (result ActivityLogAlertResource, err error) { @@ -462,7 +474,10 @@ func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupN } if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ActivityLogAlertsClient", "Update", err.Error()) } diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/activitylogs.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/activitylogs.go index 468cd15e3148..fc6927fa0e16 100644 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/activitylogs.go +++ b/services/preview/monitor/mgmt/2019-11-01-preview/insights/activitylogs.go @@ -112,7 +112,7 @@ func (client ActivityLogsClient) ListPreparer(ctx context.Context, filter string preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/eventtypes/management/values", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/eventtypes/management/values", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/alertruleincidents.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/alertruleincidents.go index 8ae4293a8f6f..a7dcd9cba31e 100644 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/alertruleincidents.go +++ b/services/preview/monitor/mgmt/2019-11-01-preview/insights/alertruleincidents.go @@ -34,7 +34,7 @@ func NewAlertRuleIncidentsClientWithBaseURI(baseURI string, subscriptionID strin // Get gets an incident associated to an alert rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // incidentName - the name of the incident to retrieve. func (client AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result Incident, err error) { @@ -49,6 +49,9 @@ func (client AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupNam }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AlertRuleIncidentsClient", "Get", err.Error()) @@ -118,7 +121,7 @@ func (client AlertRuleIncidentsClient) GetResponder(resp *http.Response) (result // ListByAlertRule gets a list of incidents associated to an alert rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client AlertRuleIncidentsClient) ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result IncidentListResult, err error) { if tracing.IsEnabled() { @@ -132,6 +135,9 @@ func (client AlertRuleIncidentsClient) ListByAlertRule(ctx context.Context, reso }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AlertRuleIncidentsClient", "ListByAlertRule", err.Error()) diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/alertrules.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/alertrules.go index 5d66e2a881f9..888ed122e267 100644 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/alertrules.go +++ b/services/preview/monitor/mgmt/2019-11-01-preview/insights/alertrules.go @@ -33,7 +33,7 @@ func NewAlertRulesClientWithBaseURI(baseURI string, subscriptionID string) Alert // CreateOrUpdate creates or updates a classic metric alert rule. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to create or update. func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (result AlertRuleResource, err error) { @@ -48,6 +48,9 @@ func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroup }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.AlertRule", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.AlertRule.Name", Name: validation.Null, Rule: true, Chain: nil}, @@ -97,7 +100,7 @@ func (client AlertRulesClient) CreateOrUpdatePreparer(ctx context.Context, resou autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -123,7 +126,7 @@ func (client AlertRulesClient) CreateOrUpdateResponder(resp *http.Response) (res // Delete deletes a classic metric alert rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -137,6 +140,9 @@ func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName str }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AlertRulesClient", "Delete", err.Error()) @@ -180,7 +186,7 @@ func (client AlertRulesClient) DeletePreparer(ctx context.Context, resourceGroup preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -204,7 +210,7 @@ func (client AlertRulesClient) DeleteResponder(resp *http.Response) (result auto // Get gets a classic metric alert rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result AlertRuleResource, err error) { if tracing.IsEnabled() { @@ -218,6 +224,9 @@ func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AlertRulesClient", "Get", err.Error()) @@ -261,7 +270,7 @@ func (client AlertRulesClient) GetPreparer(ctx context.Context, resourceGroupNam preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -286,7 +295,7 @@ func (client AlertRulesClient) GetResponder(resp *http.Response) (result AlertRu // ListByResourceGroup list the classic metric alert rules within a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client AlertRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AlertRuleResourceCollection, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.ListByResourceGroup") @@ -299,6 +308,9 @@ func (client AlertRulesClient) ListByResourceGroup(ctx context.Context, resource }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AlertRulesClient", "ListByResourceGroup", err.Error()) @@ -341,7 +353,7 @@ func (client AlertRulesClient) ListByResourceGroupPreparer(ctx context.Context, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -418,7 +430,7 @@ func (client AlertRulesClient) ListBySubscriptionPreparer(ctx context.Context) ( preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/alertrules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -443,7 +455,7 @@ func (client AlertRulesClient) ListBySubscriptionResponder(resp *http.Response) // Update updates an existing classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // alertRulesResource - parameters supplied to the operation. func (client AlertRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (result AlertRuleResource, err error) { @@ -459,7 +471,10 @@ func (client AlertRulesClient) Update(ctx context.Context, resourceGroupName str } if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AlertRulesClient", "Update", err.Error()) } @@ -502,7 +517,7 @@ func (client AlertRulesClient) UpdatePreparer(ctx context.Context, resourceGroup autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithJSON(alertRulesResource), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/autoscalesettings.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/autoscalesettings.go index a7197859ce03..d9118bd2d049 100644 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/autoscalesettings.go +++ b/services/preview/monitor/mgmt/2019-11-01-preview/insights/autoscalesettings.go @@ -34,7 +34,7 @@ func NewAutoscaleSettingsClientWithBaseURI(baseURI string, subscriptionID string // CreateOrUpdate creates or updates an autoscale setting. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // autoscaleSettingName - the autoscale setting name. // parameters - parameters supplied to the operation. func (client AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (result AutoscaleSettingResource, err error) { @@ -49,6 +49,9 @@ func (client AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resour }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.AutoscaleSetting", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.Null, Rule: true, @@ -98,7 +101,7 @@ func (client AutoscaleSettingsClient) CreateOrUpdatePreparer(ctx context.Context autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -124,7 +127,7 @@ func (client AutoscaleSettingsClient) CreateOrUpdateResponder(resp *http.Respons // Delete deletes and autoscale setting // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // autoscaleSettingName - the autoscale setting name. func (client AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -138,6 +141,9 @@ func (client AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupN }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AutoscaleSettingsClient", "Delete", err.Error()) @@ -181,7 +187,7 @@ func (client AutoscaleSettingsClient) DeletePreparer(ctx context.Context, resour preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -205,7 +211,7 @@ func (client AutoscaleSettingsClient) DeleteResponder(resp *http.Response) (resu // Get gets an autoscale setting // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // autoscaleSettingName - the autoscale setting name. func (client AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result AutoscaleSettingResource, err error) { if tracing.IsEnabled() { @@ -219,6 +225,9 @@ func (client AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AutoscaleSettingsClient", "Get", err.Error()) @@ -262,7 +271,7 @@ func (client AutoscaleSettingsClient) GetPreparer(ctx context.Context, resourceG preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -287,7 +296,7 @@ func (client AutoscaleSettingsClient) GetResponder(resp *http.Response) (result // ListByResourceGroup lists the autoscale settings for a resource group // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client AutoscaleSettingsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.ListByResourceGroup") @@ -300,6 +309,9 @@ func (client AutoscaleSettingsClient) ListByResourceGroup(ctx context.Context, r }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AutoscaleSettingsClient", "ListByResourceGroup", err.Error()) @@ -347,7 +359,7 @@ func (client AutoscaleSettingsClient) ListByResourceGroupPreparer(ctx context.Co preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -466,7 +478,7 @@ func (client AutoscaleSettingsClient) ListBySubscriptionPreparer(ctx context.Con preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/autoscalesettings", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -528,7 +540,7 @@ func (client AutoscaleSettingsClient) ListBySubscriptionComplete(ctx context.Con // Update updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // autoscaleSettingName - the autoscale setting name. // autoscaleSettingResource - parameters supplied to the operation. func (client AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (result AutoscaleSettingResource, err error) { @@ -544,7 +556,10 @@ func (client AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupN } if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AutoscaleSettingsClient", "Update", err.Error()) } @@ -587,7 +602,7 @@ func (client AutoscaleSettingsClient) UpdatePreparer(ctx context.Context, resour autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithJSON(autoscaleSettingResource), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/baselines.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/baselines.go index f9666917c515..1ead7936040e 100644 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/baselines.go +++ b/services/preview/monitor/mgmt/2019-11-01-preview/insights/baselines.go @@ -33,20 +33,24 @@ func NewBaselinesClientWithBaseURI(baseURI string, subscriptionID string) Baseli // List **Lists the metric baseline values for a resource**. // Parameters: // resourceURI - the identifier of the resource. -// metricnames - the names of the metrics (comma separated) to retrieve. +// metricnames - the names of the metrics (comma separated) to retrieve. Special case: If a metricname itself +// has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be **'Metric%2Name1'** // metricnamespace - metric namespace to query metric definitions for. // timespan - the timespan of the query. It is a string with the following format // 'startDateTime_ISO/endDateTime_ISO'. // interval - the interval (i.e. timegrain) of the query. // aggregation - the list of aggregation types (comma separated) to retrieve. // sensitivities - the list of sensitivities (comma separated) to retrieve. -// 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 -// ‘*’**. +// 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 '*'**. Special case: When +// dimension name or dimension value uses round brackets. Eg: When dimension name is **dim (test) 1** Instead +// of using $filter= "dim (test) 1 eq '*' " use **$filter= "dim %2528test%2529 1 eq '*' "** When dimension name +// is **dim (test) 3** and dimension value is **dim3 (test) val** Instead of using $filter= "dim (test) 3 eq +// 'dim3 (test) val' " use **$filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "** // resultType - allows retrieving only metadata of the baseline. On data request all information is retrieved. func (client BaselinesClient) List(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType ResultType) (result MetricBaselinesResponse, err error) { if tracing.IsEnabled() { diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/diagnosticsettings.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/diagnosticsettings.go index 9708c52c2499..db8aa282d0f3 100644 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/diagnosticsettings.go +++ b/services/preview/monitor/mgmt/2019-11-01-preview/insights/diagnosticsettings.go @@ -85,7 +85,7 @@ func (client DiagnosticSettingsClient) CreateOrUpdatePreparer(ctx context.Contex autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -161,7 +161,7 @@ func (client DiagnosticSettingsClient) DeletePreparer(ctx context.Context, resou preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -235,7 +235,7 @@ func (client DiagnosticSettingsClient) GetPreparer(ctx context.Context, resource preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -308,7 +308,7 @@ func (client DiagnosticSettingsClient) ListPreparer(ctx context.Context, resourc preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/diagnosticsettingscategory.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/diagnosticsettingscategory.go index 48365ed67e65..07b7295848ef 100644 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/diagnosticsettingscategory.go +++ b/services/preview/monitor/mgmt/2019-11-01-preview/insights/diagnosticsettingscategory.go @@ -83,7 +83,7 @@ func (client DiagnosticSettingsCategoryClient) GetPreparer(ctx context.Context, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -156,7 +156,7 @@ func (client DiagnosticSettingsCategoryClient) ListPreparer(ctx context.Context, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/enums.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/enums.go index b0a6aee8f846..6483334fb07f 100644 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/enums.go +++ b/services/preview/monitor/mgmt/2019-11-01-preview/insights/enums.go @@ -29,6 +29,27 @@ func PossibleAggregationTypeValues() []AggregationType { return []AggregationType{Average, Count, Maximum, Minimum, None, Total} } +// AggregationTypeEnum enumerates the values for aggregation type enum. +type AggregationTypeEnum string + +const ( + // AggregationTypeEnumAverage ... + AggregationTypeEnumAverage AggregationTypeEnum = "Average" + // AggregationTypeEnumCount ... + AggregationTypeEnumCount AggregationTypeEnum = "Count" + // AggregationTypeEnumMaximum ... + AggregationTypeEnumMaximum AggregationTypeEnum = "Maximum" + // AggregationTypeEnumMinimum ... + AggregationTypeEnumMinimum AggregationTypeEnum = "Minimum" + // AggregationTypeEnumTotal ... + AggregationTypeEnumTotal AggregationTypeEnum = "Total" +) + +// PossibleAggregationTypeEnumValues returns an array of possible values for the AggregationTypeEnum const type. +func PossibleAggregationTypeEnumValues() []AggregationTypeEnum { + return []AggregationTypeEnum{AggregationTypeEnumAverage, AggregationTypeEnumCount, AggregationTypeEnumMaximum, AggregationTypeEnumMinimum, AggregationTypeEnumTotal} +} + // AlertSeverity enumerates the values for alert severity. type AlertSeverity string @@ -113,13 +134,17 @@ const ( ConditionalOperatorEqual ConditionalOperator = "Equal" // ConditionalOperatorGreaterThan ... ConditionalOperatorGreaterThan ConditionalOperator = "GreaterThan" + // ConditionalOperatorGreaterThanOrEqual ... + ConditionalOperatorGreaterThanOrEqual ConditionalOperator = "GreaterThanOrEqual" // ConditionalOperatorLessThan ... ConditionalOperatorLessThan ConditionalOperator = "LessThan" + // ConditionalOperatorLessThanOrEqual ... + ConditionalOperatorLessThanOrEqual ConditionalOperator = "LessThanOrEqual" ) // PossibleConditionalOperatorValues returns an array of possible values for the ConditionalOperator const type. func PossibleConditionalOperatorValues() []ConditionalOperator { - return []ConditionalOperator{ConditionalOperatorEqual, ConditionalOperatorGreaterThan, ConditionalOperatorLessThan} + return []ConditionalOperator{ConditionalOperatorEqual, ConditionalOperatorGreaterThan, ConditionalOperatorGreaterThanOrEqual, ConditionalOperatorLessThan, ConditionalOperatorLessThanOrEqual} } // ConditionOperator enumerates the values for condition operator. @@ -243,12 +268,35 @@ func PossibleEventLevelValues() []EventLevel { return []EventLevel{EventLevelCritical, EventLevelError, EventLevelInformational, EventLevelVerbose, EventLevelWarning} } +// MetricClass enumerates the values for metric class. +type MetricClass string + +const ( + // Availability ... + Availability MetricClass = "Availability" + // Errors ... + Errors MetricClass = "Errors" + // Latency ... + Latency MetricClass = "Latency" + // Saturation ... + Saturation MetricClass = "Saturation" + // Transactions ... + Transactions MetricClass = "Transactions" +) + +// PossibleMetricClassValues returns an array of possible values for the MetricClass const type. +func PossibleMetricClassValues() []MetricClass { + return []MetricClass{Availability, Errors, Latency, Saturation, Transactions} +} + // MetricStatisticType enumerates the values for metric statistic type. type MetricStatisticType string const ( // MetricStatisticTypeAverage ... MetricStatisticTypeAverage MetricStatisticType = "Average" + // MetricStatisticTypeCount ... + MetricStatisticTypeCount MetricStatisticType = "Count" // MetricStatisticTypeMax ... MetricStatisticTypeMax MetricStatisticType = "Max" // MetricStatisticTypeMin ... @@ -259,7 +307,7 @@ const ( // PossibleMetricStatisticTypeValues returns an array of possible values for the MetricStatisticType const type. func PossibleMetricStatisticTypeValues() []MetricStatisticType { - return []MetricStatisticType{MetricStatisticTypeAverage, MetricStatisticTypeMax, MetricStatisticTypeMin, MetricStatisticTypeSum} + return []MetricStatisticType{MetricStatisticTypeAverage, MetricStatisticTypeCount, MetricStatisticTypeMax, MetricStatisticTypeMin, MetricStatisticTypeSum} } // MetricTriggerType enumerates the values for metric trigger type. @@ -277,6 +325,60 @@ func PossibleMetricTriggerTypeValues() []MetricTriggerType { return []MetricTriggerType{MetricTriggerTypeConsecutive, MetricTriggerTypeTotal} } +// MetricUnit enumerates the values for metric unit. +type MetricUnit string + +const ( + // MetricUnitBitsPerSecond ... + MetricUnitBitsPerSecond MetricUnit = "BitsPerSecond" + // MetricUnitBytes ... + MetricUnitBytes MetricUnit = "Bytes" + // MetricUnitByteSeconds ... + MetricUnitByteSeconds MetricUnit = "ByteSeconds" + // MetricUnitBytesPerSecond ... + MetricUnitBytesPerSecond MetricUnit = "BytesPerSecond" + // MetricUnitCores ... + MetricUnitCores MetricUnit = "Cores" + // MetricUnitCount ... + MetricUnitCount MetricUnit = "Count" + // MetricUnitCountPerSecond ... + MetricUnitCountPerSecond MetricUnit = "CountPerSecond" + // MetricUnitMilliCores ... + MetricUnitMilliCores MetricUnit = "MilliCores" + // MetricUnitMilliSeconds ... + MetricUnitMilliSeconds MetricUnit = "MilliSeconds" + // MetricUnitNanoCores ... + MetricUnitNanoCores MetricUnit = "NanoCores" + // MetricUnitPercent ... + MetricUnitPercent MetricUnit = "Percent" + // MetricUnitSeconds ... + MetricUnitSeconds MetricUnit = "Seconds" + // MetricUnitUnspecified ... + MetricUnitUnspecified MetricUnit = "Unspecified" +) + +// PossibleMetricUnitValues returns an array of possible values for the MetricUnit const type. +func PossibleMetricUnitValues() []MetricUnit { + return []MetricUnit{MetricUnitBitsPerSecond, MetricUnitBytes, MetricUnitByteSeconds, MetricUnitBytesPerSecond, MetricUnitCores, MetricUnitCount, MetricUnitCountPerSecond, MetricUnitMilliCores, MetricUnitMilliSeconds, MetricUnitNanoCores, MetricUnitPercent, MetricUnitSeconds, MetricUnitUnspecified} +} + +// NamespaceClassification enumerates the values for namespace classification. +type NamespaceClassification string + +const ( + // Custom ... + Custom NamespaceClassification = "Custom" + // Platform ... + Platform NamespaceClassification = "Platform" + // Qos ... + Qos NamespaceClassification = "Qos" +) + +// PossibleNamespaceClassificationValues returns an array of possible values for the NamespaceClassification const type. +func PossibleNamespaceClassificationValues() []NamespaceClassification { + return []NamespaceClassification{Custom, Platform, Qos} +} + // OdataType enumerates the values for odata type. type OdataType string @@ -397,13 +499,11 @@ const ( OperatorLessThan Operator = "LessThan" // OperatorLessThanOrEqual ... OperatorLessThanOrEqual Operator = "LessThanOrEqual" - // OperatorNotEquals ... - OperatorNotEquals Operator = "NotEquals" ) // PossibleOperatorValues returns an array of possible values for the Operator const type. func PossibleOperatorValues() []Operator { - return []Operator{OperatorEquals, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorLessThan, OperatorLessThanOrEqual, OperatorNotEquals} + return []Operator{OperatorEquals, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorLessThan, OperatorLessThanOrEqual} } // ProvisioningState enumerates the values for provisioning state. @@ -539,28 +639,13 @@ const ( ExactCount ScaleType = "ExactCount" // PercentChangeCount ... PercentChangeCount ScaleType = "PercentChangeCount" + // ServiceAllowedNextValue ... + ServiceAllowedNextValue ScaleType = "ServiceAllowedNextValue" ) // PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. func PossibleScaleTypeValues() []ScaleType { - return []ScaleType{ChangeCount, ExactCount, PercentChangeCount} -} - -// Sensitivity enumerates the values for sensitivity. -type Sensitivity string - -const ( - // SensitivityHigh ... - SensitivityHigh Sensitivity = "High" - // SensitivityLow ... - SensitivityLow Sensitivity = "Low" - // SensitivityMedium ... - SensitivityMedium Sensitivity = "Medium" -) - -// PossibleSensitivityValues returns an array of possible values for the Sensitivity const type. -func PossibleSensitivityValues() []Sensitivity { - return []Sensitivity{SensitivityHigh, SensitivityLow, SensitivityMedium} + return []ScaleType{ChangeCount, ExactCount, PercentChangeCount, ServiceAllowedNextValue} } // TimeAggregationOperator enumerates the values for time aggregation operator. @@ -606,40 +691,3 @@ const ( func PossibleTimeAggregationTypeValues() []TimeAggregationType { return []TimeAggregationType{TimeAggregationTypeAverage, TimeAggregationTypeCount, TimeAggregationTypeLast, TimeAggregationTypeMaximum, TimeAggregationTypeMinimum, TimeAggregationTypeTotal} } - -// Unit enumerates the values for unit. -type Unit string - -const ( - // UnitBitsPerSecond ... - UnitBitsPerSecond Unit = "BitsPerSecond" - // UnitBytes ... - UnitBytes Unit = "Bytes" - // UnitByteSeconds ... - UnitByteSeconds Unit = "ByteSeconds" - // UnitBytesPerSecond ... - UnitBytesPerSecond Unit = "BytesPerSecond" - // UnitCores ... - UnitCores Unit = "Cores" - // UnitCount ... - UnitCount Unit = "Count" - // UnitCountPerSecond ... - UnitCountPerSecond Unit = "CountPerSecond" - // UnitMilliCores ... - UnitMilliCores Unit = "MilliCores" - // UnitMilliSeconds ... - UnitMilliSeconds Unit = "MilliSeconds" - // UnitNanoCores ... - UnitNanoCores Unit = "NanoCores" - // UnitPercent ... - UnitPercent Unit = "Percent" - // UnitSeconds ... - UnitSeconds Unit = "Seconds" - // UnitUnspecified ... - UnitUnspecified Unit = "Unspecified" -) - -// PossibleUnitValues returns an array of possible values for the Unit const type. -func PossibleUnitValues() []Unit { - return []Unit{UnitBitsPerSecond, UnitBytes, UnitByteSeconds, UnitBytesPerSecond, UnitCores, UnitCount, UnitCountPerSecond, UnitMilliCores, UnitMilliSeconds, UnitNanoCores, UnitPercent, UnitSeconds, UnitUnspecified} -} diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/eventcategories.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/eventcategories.go index 86e59b424363..f43c5468ac51 100644 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/eventcategories.go +++ b/services/preview/monitor/mgmt/2019-11-01-preview/insights/eventcategories.go @@ -75,7 +75,7 @@ func (client EventCategoriesClient) ListPreparer(ctx context.Context) (*http.Req preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventcategories"), + autorest.WithPath("/providers/Microsoft.Insights/eventcategories"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/insightsapi/interfaces.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/insightsapi/interfaces.go index b0a7f5ed8d17..a1c88420240b 100644 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/insightsapi/interfaces.go +++ b/services/preview/monitor/mgmt/2019-11-01-preview/insights/insightsapi/interfaces.go @@ -154,14 +154,6 @@ type MetricsClientAPI interface { var _ MetricsClientAPI = (*insights.MetricsClient)(nil) -// MetricBaselineClientAPI contains the set of methods on the MetricBaselineClient type. -type MetricBaselineClientAPI interface { - CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation insights.TimeSeriesInformation) (result insights.CalculateBaselineResponse, err error) - Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType insights.ResultType) (result insights.BaselineResponse, err error) -} - -var _ MetricBaselineClientAPI = (*insights.MetricBaselineClient)(nil) - // BaselinesClientAPI contains the set of methods on the BaselinesClient type. type BaselinesClientAPI interface { List(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType insights.ResultType) (result insights.MetricBaselinesResponse, err error) diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/logprofiles.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/logprofiles.go index 64fda18dde7c..cfa5e8be2997 100644 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/logprofiles.go +++ b/services/preview/monitor/mgmt/2019-11-01-preview/insights/logprofiles.go @@ -100,7 +100,7 @@ func (client LogProfilesClient) CreateOrUpdatePreparer(ctx context.Context, logP autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -181,7 +181,7 @@ func (client LogProfilesClient) DeletePreparer(ctx context.Context, logProfileNa preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -260,7 +260,7 @@ func (client LogProfilesClient) GetPreparer(ctx context.Context, logProfileName preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -337,7 +337,7 @@ func (client LogProfilesClient) ListPreparer(ctx context.Context) (*http.Request preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -419,7 +419,7 @@ func (client LogProfilesClient) UpdatePreparer(ctx context.Context, logProfileNa autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), autorest.WithJSON(logProfilesResource), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/metricalerts.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/metricalerts.go index d31f6a2e8a9e..f9706664d9be 100644 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/metricalerts.go +++ b/services/preview/monitor/mgmt/2019-11-01-preview/insights/metricalerts.go @@ -33,7 +33,7 @@ func NewMetricAlertsClientWithBaseURI(baseURI string, subscriptionID string) Met // CreateOrUpdate create or update an metric alert definition. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to create or update. func (client MetricAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource) (result MetricAlertResource, err error) { @@ -50,11 +50,14 @@ func (client MetricAlertsClient) CreateOrUpdate(ctx context.Context, resourceGro if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.MetricAlertProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.MetricAlertProperties.Description", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.Severity", Name: validation.Null, Rule: true, Chain: nil}, + Chain: []validation.Constraint{{Target: "parameters.MetricAlertProperties.Severity", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.MetricAlertProperties.Enabled", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.MetricAlertProperties.Scopes", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.MetricAlertProperties.EvaluationFrequency", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.MetricAlertProperties.WindowSize", Name: validation.Null, Rule: true, Chain: nil}, }}}}}); err != nil { @@ -126,7 +129,7 @@ func (client MetricAlertsClient) CreateOrUpdateResponder(resp *http.Response) (r // Delete delete an alert rule definition. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client MetricAlertsClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -141,7 +144,10 @@ func (client MetricAlertsClient) Delete(ctx context.Context, resourceGroupName s } if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.MetricAlertsClient", "Delete", err.Error()) } @@ -207,7 +213,7 @@ func (client MetricAlertsClient) DeleteResponder(resp *http.Response) (result au // Get retrieve an alert rule definition. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client MetricAlertsClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertResource, err error) { if tracing.IsEnabled() { @@ -222,7 +228,10 @@ func (client MetricAlertsClient) Get(ctx context.Context, resourceGroupName stri } if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.MetricAlertsClient", "Get", err.Error()) } @@ -289,7 +298,7 @@ func (client MetricAlertsClient) GetResponder(resp *http.Response) (result Metri // ListByResourceGroup retrieve alert rule definitions in a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client MetricAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result MetricAlertResourceCollection, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.ListByResourceGroup") @@ -303,7 +312,10 @@ func (client MetricAlertsClient) ListByResourceGroup(ctx context.Context, resour } if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.MetricAlertsClient", "ListByResourceGroup", err.Error()) } @@ -446,7 +458,7 @@ func (client MetricAlertsClient) ListBySubscriptionResponder(resp *http.Response // Update update an metric alert definition. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to update. func (client MetricAlertsClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch) (result MetricAlertResource, err error) { @@ -462,7 +474,10 @@ func (client MetricAlertsClient) Update(ctx context.Context, resourceGroupName s } if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.MetricAlertsClient", "Update", err.Error()) } diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/metricalertsstatus.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/metricalertsstatus.go index 7644133efea3..4709142160be 100644 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/metricalertsstatus.go +++ b/services/preview/monitor/mgmt/2019-11-01-preview/insights/metricalertsstatus.go @@ -34,7 +34,7 @@ func NewMetricAlertsStatusClientWithBaseURI(baseURI string, subscriptionID strin // List retrieve an alert rule status. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client MetricAlertsStatusClient) List(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertStatusCollection, err error) { if tracing.IsEnabled() { @@ -49,7 +49,10 @@ func (client MetricAlertsStatusClient) List(ctx context.Context, resourceGroupNa } if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.MetricAlertsStatusClient", "List", err.Error()) } @@ -116,7 +119,7 @@ func (client MetricAlertsStatusClient) ListResponder(resp *http.Response) (resul // ListByName retrieve an alert rule status. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // statusName - the name of the status. func (client MetricAlertsStatusClient) ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (result MetricAlertStatusCollection, err error) { @@ -132,7 +135,10 @@ func (client MetricAlertsStatusClient) ListByName(ctx context.Context, resourceG } if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.MetricAlertsStatusClient", "ListByName", err.Error()) } diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/metricbaseline.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/metricbaseline.go deleted file mode 100644 index 709571486dd7..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/metricbaseline.go +++ /dev/null @@ -1,217 +0,0 @@ -package insights - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// MetricBaselineClient is the monitor Management Client -type MetricBaselineClient struct { - BaseClient -} - -// NewMetricBaselineClient creates an instance of the MetricBaselineClient client. -func NewMetricBaselineClient(subscriptionID string) MetricBaselineClient { - return NewMetricBaselineClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricBaselineClientWithBaseURI creates an instance of the MetricBaselineClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewMetricBaselineClientWithBaseURI(baseURI string, subscriptionID string) MetricBaselineClient { - return MetricBaselineClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CalculateBaseline **Lists the baseline values for a resource**. -// Parameters: -// resourceURI - 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 -// timeSeriesInformation - information that need to be specified to calculate a baseline on a time series. -func (client MetricBaselineClient) CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (result CalculateBaselineResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricBaselineClient.CalculateBaseline") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: timeSeriesInformation, - Constraints: []validation.Constraint{{Target: "timeSeriesInformation.Sensitivities", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "timeSeriesInformation.Values", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.MetricBaselineClient", "CalculateBaseline", err.Error()) - } - - req, err := client.CalculateBaselinePreparer(ctx, resourceURI, timeSeriesInformation) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", nil, "Failure preparing request") - return - } - - resp, err := client.CalculateBaselineSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure sending request") - return - } - - result, err = client.CalculateBaselineResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure responding to request") - return - } - - return -} - -// CalculateBaselinePreparer prepares the CalculateBaseline request. -func (client MetricBaselineClient) CalculateBaselinePreparer(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/calculatebaseline", pathParameters), - autorest.WithJSON(timeSeriesInformation), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CalculateBaselineSender sends the CalculateBaseline request. The method will close the -// http.Response Body if it receives an error. -func (client MetricBaselineClient) CalculateBaselineSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CalculateBaselineResponder handles the response to the CalculateBaseline request. The method always -// closes the http.Response Body. -func (client MetricBaselineClient) CalculateBaselineResponder(resp *http.Response) (result CalculateBaselineResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get **Gets the baseline values for a specific metric**. -// Parameters: -// resourceURI - 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 -// metricName - the name of the metric to retrieve the baseline for. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// aggregation - the aggregation type of the metric to retrieve the baseline for. -// sensitivities - the list of sensitivities (comma separated) to retrieve. -// resultType - allows retrieving only metadata of the baseline. On data request all information is retrieved. -func (client MetricBaselineClient) Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (result BaselineResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricBaselineClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceURI, metricName, timespan, interval, aggregation, sensitivities, resultType) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client MetricBaselineClient) GetPreparer(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "metricName": autorest.Encode("path", metricName), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if len(sensitivities) > 0 { - queryParameters["sensitivities"] = autorest.Encode("query", sensitivities) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/baseline/{metricName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client MetricBaselineClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client MetricBaselineClient) GetResponder(resp *http.Response) (result BaselineResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/metricdefinitions.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/metricdefinitions.go index 69fc2e0b465a..c316b154fe7e 100644 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/metricdefinitions.go +++ b/services/preview/monitor/mgmt/2019-11-01-preview/insights/metricdefinitions.go @@ -85,7 +85,7 @@ func (client MetricDefinitionsClient) ListPreparer(ctx context.Context, resource preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricDefinitions", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metricDefinitions", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/metrics.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/metrics.go index 97687a09b498..f2329253c944 100644 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/metrics.go +++ b/services/preview/monitor/mgmt/2019-11-01-preview/insights/metrics.go @@ -36,7 +36,8 @@ func NewMetricsClientWithBaseURI(baseURI string, subscriptionID string) MetricsC // timespan - the timespan of the query. It is a string with the following format // 'startDateTime_ISO/endDateTime_ISO'. // interval - the interval (i.e. timegrain) of the query. -// metricnames - the names of the metrics (comma separated) to retrieve. +// metricnames - the names of the metrics (comma separated) to retrieve. Special case: If a metricname itself +// has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be **'Metric%2Name1'** // aggregation - the list of aggregation types (comma separated) to retrieve. // top - the maximum number of records to retrieve. // Valid only if $filter is specified. @@ -44,13 +45,16 @@ func NewMetricsClientWithBaseURI(baseURI string, subscriptionID string) MetricsC // orderby - the aggregation to use for sorting results and the direction of the sort. // Only one order can be specified. // Examples: sum asc. -// 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 -// ‘*’**. +// 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 '*'**. Special case: When +// dimension name or dimension value uses round brackets. Eg: When dimension name is **dim (test) 1** Instead +// of using $filter= "dim (test) 1 eq '*' " use **$filter= "dim %2528test%2529 1 eq '*' "** When dimension name +// is **dim (test) 3** and dimension value is **dim3 (test) val** Instead of using $filter= "dim (test) 3 eq +// 'dim3 (test) val' " use **$filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "** // resultType - reduces the set of data collected. The syntax allowed depends on the operation. See the // operation's description for details. // metricnamespace - metric namespace to query metric definitions for. @@ -128,7 +132,7 @@ func (client MetricsClient) ListPreparer(ctx context.Context, resourceURI string preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metrics", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metrics", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/models.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/models.go index ebc7fdbddcab..f70fae7453ca 100644 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/models.go +++ b/services/preview/monitor/mgmt/2019-11-01-preview/insights/models.go @@ -211,6 +211,10 @@ type ActionGroupResource struct { Name *string `json:"name,omitempty"` // Type - READ-ONLY; Azure resource type Type *string `json:"type,omitempty"` + // Kind - READ-ONLY; Azure resource kind + Kind *string `json:"kind,omitempty"` + // Identity - READ-ONLY; Azure resource identity + Identity *string `json:"identity,omitempty"` // Location - Resource location Location *string `json:"location,omitempty"` // Tags - Resource tags @@ -277,6 +281,24 @@ func (agr *ActionGroupResource) UnmarshalJSON(body []byte) error { } agr.Type = &typeVar } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + agr.Kind = &kind + } + case "identity": + if v != nil { + var identity string + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + agr.Identity = &identity + } case "location": if v != nil { var location string @@ -440,6 +462,10 @@ type ActivityLogAlertResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for ActivityLogAlertResource. @@ -520,6 +546,24 @@ func (alar *ActivityLogAlertResource) UnmarshalJSON(body []byte) error { } alar.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + alar.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + alar.Etag = &etag + } } } @@ -588,10 +632,14 @@ type AlertRule struct { Name *string `json:"name,omitempty"` // Description - the description of the alert rule that will be included in the alert email. Description *string `json:"description,omitempty"` + // ProvisioningState - the provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` // IsEnabled - the flag that indicates whether the alert rule is enabled. IsEnabled *bool `json:"isEnabled,omitempty"` // Condition - the condition that results in the alert rule being activated. Condition BasicRuleCondition `json:"condition,omitempty"` + // Action - action that is performed when the alert rule becomes active, and when an alert condition is resolved. + Action BasicRuleAction `json:"action,omitempty"` // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. Actions *[]BasicRuleAction `json:"actions,omitempty"` // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. @@ -607,10 +655,14 @@ func (ar AlertRule) MarshalJSON() ([]byte, error) { if ar.Description != nil { objectMap["description"] = ar.Description } + if ar.ProvisioningState != nil { + objectMap["provisioningState"] = ar.ProvisioningState + } if ar.IsEnabled != nil { objectMap["isEnabled"] = ar.IsEnabled } objectMap["condition"] = ar.Condition + objectMap["action"] = ar.Action if ar.Actions != nil { objectMap["actions"] = ar.Actions } @@ -644,6 +696,15 @@ func (ar *AlertRule) UnmarshalJSON(body []byte) error { } ar.Description = &description } + case "provisioningState": + if v != nil { + var provisioningState string + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + ar.ProvisioningState = &provisioningState + } case "isEnabled": if v != nil { var isEnabled bool @@ -661,6 +722,14 @@ func (ar *AlertRule) UnmarshalJSON(body []byte) error { } ar.Condition = condition } + case "action": + if v != nil { + action, err := unmarshalBasicRuleAction(*v) + if err != nil { + return err + } + ar.Action = action + } case "actions": if v != nil { actions, err := unmarshalBasicRuleActionArray(*v) @@ -699,6 +768,10 @@ type AlertRuleResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for AlertRuleResource. @@ -779,6 +852,24 @@ func (arr *AlertRuleResource) UnmarshalJSON(body []byte) error { } arr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + arr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + arr.Etag = &etag + } } } @@ -910,6 +1001,8 @@ type AutoscaleSetting struct { Name *string `json:"name,omitempty"` // TargetResourceURI - the resource identifier of the resource that the autoscale setting should be added to. TargetResourceURI *string `json:"targetResourceUri,omitempty"` + // TargetResourceLocation - the location of the resource that the autoscale setting should be added to. + TargetResourceLocation *string `json:"targetResourceLocation,omitempty"` } // AutoscaleSettingResource the autoscale setting resource. @@ -927,6 +1020,10 @@ type AutoscaleSettingResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for AutoscaleSettingResource. @@ -1007,6 +1104,24 @@ func (asr *AutoscaleSettingResource) UnmarshalJSON(body []byte) error { } asr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + asr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + asr.Etag = &etag + } } } @@ -1533,132 +1648,42 @@ func (amplsp AzureMonitorPrivateLinkScopeProperties) MarshalJSON() ([]byte, erro return json.Marshal(objectMap) } -// Baseline the baseline values for a single sensitivity value. -type Baseline struct { - // Sensitivity - the sensitivity of the baseline. Possible values include: 'SensitivityLow', 'SensitivityMedium', 'SensitivityHigh' - Sensitivity Sensitivity `json:"sensitivity,omitempty"` - // LowThresholds - The low thresholds of the baseline. - LowThresholds *[]float64 `json:"lowThresholds,omitempty"` - // HighThresholds - The high thresholds of the baseline. - HighThresholds *[]float64 `json:"highThresholds,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` -} - -// BaselineMetadata represents a baseline metadata value. -type BaselineMetadata struct { - // Name - Name of the baseline metadata. - Name *string `json:"name,omitempty"` - // Value - Value of the baseline metadata. - Value *string `json:"value,omitempty"` -} - -// BaselineMetadataValue represents a baseline metadata value. -type BaselineMetadataValue struct { - // Name - the name of the metadata. - Name *LocalizableString `json:"name,omitempty"` - // Value - the value of the metadata. - Value *string `json:"value,omitempty"` -} - -// BaselineProperties the baseline properties class. -type BaselineProperties struct { - // 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. - Timespan *string `json:"timespan,omitempty"` - // 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. - Interval *string `json:"interval,omitempty"` - // Aggregation - The aggregation type of the metric. - Aggregation *string `json:"aggregation,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Baseline - the baseline values for each sensitivity. - Baseline *[]Baseline `json:"baseline,omitempty"` - // Metadata - the baseline metadata values. - Metadata *[]BaselineMetadataValue `json:"metadata,omitempty"` -} - -// BaselineResponse the response to a baseline query. -type BaselineResponse struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; the metric baseline Id. +// AzureResource an azure resource object +type AzureResource struct { + // ID - READ-ONLY; Azure resource Id ID *string `json:"id,omitempty"` - // Type - READ-ONLY; the resource type of the baseline resource. + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type Type *string `json:"type,omitempty"` - // Name - READ-ONLY; the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString `json:"name,omitempty"` - // BaselineProperties - the properties of the baseline. - *BaselineProperties `json:"properties,omitempty"` + // Kind - READ-ONLY; Azure resource kind + Kind *string `json:"kind,omitempty"` + // Identity - READ-ONLY; Azure resource identity + Identity *string `json:"identity,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` } -// MarshalJSON is the custom marshaler for BaselineResponse. -func (br BaselineResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for AzureResource. +func (ar AzureResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if br.BaselineProperties != nil { - objectMap["properties"] = br.BaselineProperties + if ar.Location != nil { + objectMap["location"] = ar.Location } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BaselineResponse struct. -func (br *BaselineResponse) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err + if ar.Tags != nil { + objectMap["tags"] = ar.Tags } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - br.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - br.Type = &typeVar - } - case "name": - if v != nil { - var name LocalizableString - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - br.Name = &name - } - case "properties": - if v != nil { - var baselineProperties BaselineProperties - err = json.Unmarshal(*v, &baselineProperties) - if err != nil { - return err - } - br.BaselineProperties = &baselineProperties - } - } - } - - return nil + return json.Marshal(objectMap) } -// CalculateBaselineResponse the response to a calculate baseline call. -type CalculateBaselineResponse struct { - autorest.Response `json:"-"` - // Type - the resource type of the baseline resource. - Type *string `json:"type,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Baseline - the baseline values for each sensitivity. - Baseline *[]Baseline `json:"baseline,omitempty"` +// BaselineMetadata represents a baseline metadata value. +type BaselineMetadata struct { + // Name - Name of the baseline metadata. + Name *string `json:"name,omitempty"` + // Value - Value of the baseline metadata. + Value *string `json:"value,omitempty"` } // Criteria specifies the criteria for converting log to metric. @@ -1890,8 +1915,8 @@ type DynamicMetricCriteria struct { MetricName *string `json:"metricName,omitempty"` // MetricNamespace - Namespace of the metric. MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` + // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' + TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` // Dimensions - List of dimension conditions. Dimensions *[]MetricDimension `json:"dimensions,omitempty"` // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. @@ -1925,7 +1950,7 @@ func (dmc DynamicMetricCriteria) MarshalJSON() ([]byte, error) { if dmc.MetricNamespace != nil { objectMap["metricNamespace"] = dmc.MetricNamespace } - if dmc.TimeAggregation != nil { + if dmc.TimeAggregation != "" { objectMap["timeAggregation"] = dmc.TimeAggregation } if dmc.Dimensions != nil { @@ -2049,7 +2074,7 @@ func (dmc *DynamicMetricCriteria) UnmarshalJSON(body []byte) error { } case "timeAggregation": if v != nil { - var timeAggregation interface{} + var timeAggregation AggregationTypeEnum err = json.Unmarshal(*v, &timeAggregation) if err != nil { return err @@ -2163,6 +2188,12 @@ func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// ErrorContract describes the format of Error response. +type ErrorContract struct { + // Error - The error details. + Error *ErrorResponse `json:"error,omitempty"` +} + // ErrorResponse describes the format of Error response. type ErrorResponse struct { // Code - Error code @@ -2600,7 +2631,7 @@ type LogicAppReceiver struct { // LogMetricTrigger a log metrics trigger descriptor. type LogMetricTrigger struct { - // ThresholdOperator - Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' + // ThresholdOperator - Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'ConditionalOperatorGreaterThanOrEqual', 'ConditionalOperatorLessThanOrEqual', 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` // Threshold - The threshold of the metric trigger. Threshold *float64 `json:"threshold,omitempty"` @@ -2646,6 +2677,10 @@ type LogProfileResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for LogProfileResource. @@ -2726,6 +2761,24 @@ func (lpr *LogProfileResource) UnmarshalJSON(body []byte) error { } lpr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + lpr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + lpr.Etag = &etag + } } } @@ -2787,8 +2840,16 @@ func (lprp *LogProfileResourcePatch) UnmarshalJSON(body []byte) error { // LogSearchRule log Search Rule Definition type LogSearchRule struct { + // CreatedWithAPIVersion - READ-ONLY; The api-version used when creating this alert rule + CreatedWithAPIVersion *string `json:"createdWithApiVersion,omitempty"` + // IsLegacyLogAnalyticsRule - READ-ONLY; True if alert rule is legacy Log Analytic rule + IsLegacyLogAnalyticsRule *bool `json:"isLegacyLogAnalyticsRule,omitempty"` // Description - The description of the Log Search rule. Description *string `json:"description,omitempty"` + // DisplayName - The display name of the alert rule + DisplayName *string `json:"displayName,omitempty"` + // AutoMitigate - The flag that indicates whether the alert should be automatically resolved or not. The default is false. + AutoMitigate *bool `json:"autoMitigate,omitempty"` // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'True', 'False' Enabled Enabled `json:"enabled,omitempty"` // LastUpdatedTime - READ-ONLY; Last time the rule was updated in IS08601 format. @@ -2809,6 +2870,12 @@ func (lsr LogSearchRule) MarshalJSON() ([]byte, error) { if lsr.Description != nil { objectMap["description"] = lsr.Description } + if lsr.DisplayName != nil { + objectMap["displayName"] = lsr.DisplayName + } + if lsr.AutoMitigate != nil { + objectMap["autoMitigate"] = lsr.AutoMitigate + } if lsr.Enabled != "" { objectMap["enabled"] = lsr.Enabled } @@ -2831,6 +2898,24 @@ func (lsr *LogSearchRule) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { + case "createdWithApiVersion": + if v != nil { + var createdWithAPIVersion string + err = json.Unmarshal(*v, &createdWithAPIVersion) + if err != nil { + return err + } + lsr.CreatedWithAPIVersion = &createdWithAPIVersion + } + case "isLegacyLogAnalyticsRule": + if v != nil { + var isLegacyLogAnalyticsRule bool + err = json.Unmarshal(*v, &isLegacyLogAnalyticsRule) + if err != nil { + return err + } + lsr.IsLegacyLogAnalyticsRule = &isLegacyLogAnalyticsRule + } case "description": if v != nil { var description string @@ -2840,6 +2925,24 @@ func (lsr *LogSearchRule) UnmarshalJSON(body []byte) error { } lsr.Description = &description } + case "displayName": + if v != nil { + var displayName string + err = json.Unmarshal(*v, &displayName) + if err != nil { + return err + } + lsr.DisplayName = &displayName + } + case "autoMitigate": + if v != nil { + var autoMitigate bool + err = json.Unmarshal(*v, &autoMitigate) + if err != nil { + return err + } + lsr.AutoMitigate = &autoMitigate + } case "enabled": if v != nil { var enabled Enabled @@ -2920,6 +3023,10 @@ type LogSearchRuleResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for LogSearchRuleResource. @@ -3000,6 +3107,24 @@ func (lsrr *LogSearchRuleResource) UnmarshalJSON(body []byte) error { } lsrr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + lsrr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + lsrr.Etag = &etag + } } } @@ -3233,8 +3358,14 @@ type Metric struct { Type *string `json:"type,omitempty"` // Name - the name and the display name of the metric, i.e. it is localizable string. Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' - Unit Unit `json:"unit,omitempty"` + // DisplayDescription - Detailed description of this metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + // ErrorCode - 'Success' or the error details on query failures for this metric. + ErrorCode *string `json:"errorCode,omitempty"` + // ErrorMessage - Error message encountered querying this specific metric. + ErrorMessage *string `json:"errorMessage,omitempty"` + // Unit - The unit of the metric. Possible values include: 'MetricUnitCount', 'MetricUnitBytes', 'MetricUnitSeconds', 'MetricUnitCountPerSecond', 'MetricUnitBytesPerSecond', 'MetricUnitPercent', 'MetricUnitMilliSeconds', 'MetricUnitByteSeconds', 'MetricUnitUnspecified', 'MetricUnitCores', 'MetricUnitMilliCores', 'MetricUnitNanoCores', 'MetricUnitBitsPerSecond' + Unit MetricUnit `json:"unit,omitempty"` // Timeseries - the time series returned when a data query is performed. Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"` } @@ -3243,7 +3374,7 @@ type Metric struct { type MetricAlertAction struct { // ActionGroupID - the id of the action group to use. ActionGroupID *string `json:"actionGroupId,omitempty"` - // WebHookProperties - The properties of a webhook object. + // WebHookProperties - This field allows specifying custom properties, which would be appended to the alert payload sent as input to the webhook. WebHookProperties map[string]*string `json:"webHookProperties"` } @@ -3504,9 +3635,9 @@ type MetricAlertProperties struct { EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. WindowSize *string `json:"windowSize,omitempty"` - // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource. TargetResourceType *string `json:"targetResourceType,omitempty"` - // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource. TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` // Criteria - defines the specific alert criteria information. Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` @@ -3516,6 +3647,8 @@ type MetricAlertProperties struct { Actions *[]MetricAlertAction `json:"actions,omitempty"` // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` + // IsMigrated - READ-ONLY; the value indicating whether this alert rule is migrated. + IsMigrated *bool `json:"isMigrated,omitempty"` } // MarshalJSON is the custom marshaler for MetricAlertProperties. @@ -3671,6 +3804,15 @@ func (mapVar *MetricAlertProperties) UnmarshalJSON(body []byte) error { } mapVar.LastUpdatedTime = &lastUpdatedTime } + case "isMigrated": + if v != nil { + var isMigrated bool + err = json.Unmarshal(*v, &isMigrated) + if err != nil { + return err + } + mapVar.IsMigrated = &isMigrated + } } } @@ -3703,6 +3845,8 @@ type MetricAlertPropertiesPatch struct { Actions *[]MetricAlertAction `json:"actions,omitempty"` // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` + // IsMigrated - READ-ONLY; the value indicating whether this alert rule is migrated. + IsMigrated *bool `json:"isMigrated,omitempty"` } // MarshalJSON is the custom marshaler for MetricAlertPropertiesPatch. @@ -3858,6 +4002,15 @@ func (mapp *MetricAlertPropertiesPatch) UnmarshalJSON(body []byte) error { } mapp.LastUpdatedTime = &lastUpdatedTime } + case "isMigrated": + if v != nil { + var isMigrated bool + err = json.Unmarshal(*v, &isMigrated) + if err != nil { + return err + } + mapp.IsMigrated = &isMigrated + } } } @@ -3879,6 +4032,10 @@ type MetricAlertResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for MetricAlertResource. @@ -3959,6 +4116,24 @@ func (mar *MetricAlertResource) UnmarshalJSON(body []byte) error { } mar.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + mar.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + mar.Etag = &etag + } } } @@ -4196,7 +4371,7 @@ type MetricBaselinesResponse struct { // MetricCriteria criterion to filter metrics. type MetricCriteria struct { - // Operator - the criteria operator. Possible values include: 'OperatorEquals', 'OperatorNotEquals', 'OperatorGreaterThan', 'OperatorGreaterThanOrEqual', 'OperatorLessThan', 'OperatorLessThanOrEqual' + // Operator - the criteria operator. Possible values include: 'OperatorEquals', 'OperatorGreaterThan', 'OperatorGreaterThanOrEqual', 'OperatorLessThan', 'OperatorLessThanOrEqual' Operator Operator `json:"operator,omitempty"` // Threshold - the criteria threshold value that activates the alert. Threshold *float64 `json:"threshold,omitempty"` @@ -4208,8 +4383,8 @@ type MetricCriteria struct { MetricName *string `json:"metricName,omitempty"` // MetricNamespace - Namespace of the metric. MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` + // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' + TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` // Dimensions - List of dimension conditions. Dimensions *[]MetricDimension `json:"dimensions,omitempty"` // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. @@ -4237,7 +4412,7 @@ func (mc MetricCriteria) MarshalJSON() ([]byte, error) { if mc.MetricNamespace != nil { objectMap["metricNamespace"] = mc.MetricNamespace } - if mc.TimeAggregation != nil { + if mc.TimeAggregation != "" { objectMap["timeAggregation"] = mc.TimeAggregation } if mc.Dimensions != nil { @@ -4343,7 +4518,7 @@ func (mc *MetricCriteria) UnmarshalJSON(body []byte) error { } case "timeAggregation": if v != nil { - var timeAggregation interface{} + var timeAggregation AggregationTypeEnum err = json.Unmarshal(*v, &timeAggregation) if err != nil { return err @@ -4393,8 +4568,14 @@ type MetricDefinition struct { Namespace *string `json:"namespace,omitempty"` // Name - the name and the display name of the metric, i.e. it is a localizable string. Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' - Unit Unit `json:"unit,omitempty"` + // DisplayDescription - Detailed description of this metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + // Category - Custom category name for this metric. + Category *string `json:"category,omitempty"` + // MetricClass - The class of the metric. Possible values include: 'Availability', 'Transactions', 'Errors', 'Latency', 'Saturation' + MetricClass MetricClass `json:"metricClass,omitempty"` + // Unit - The unit of the metric. Possible values include: 'MetricUnitCount', 'MetricUnitBytes', 'MetricUnitSeconds', 'MetricUnitCountPerSecond', 'MetricUnitBytesPerSecond', 'MetricUnitPercent', 'MetricUnitMilliSeconds', 'MetricUnitByteSeconds', 'MetricUnitUnspecified', 'MetricUnitCores', 'MetricUnitMilliCores', 'MetricUnitNanoCores', 'MetricUnitBitsPerSecond' + Unit MetricUnit `json:"unit,omitempty"` // PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' PrimaryAggregationType AggregationType `json:"primaryAggregationType,omitempty"` // SupportedAggregationTypes - the collection of what aggregation types are supported. @@ -4426,12 +4607,14 @@ type MetricDimension struct { // MetricNamespace metric namespace class specifies the metadata for a metric namespace. type MetricNamespace struct { - // ID - The ID of the metricNamespace. + // ID - The ID of the metric namespace. ID *string `json:"id,omitempty"` // Type - The type of the namespace. Type *string `json:"type,omitempty"` - // Name - The name of the namespace. + // Name - The escaped name of the namespace. Name *string `json:"name,omitempty"` + // Classification - Kind of namespace. Possible values include: 'Platform', 'Custom', 'Qos' + Classification NamespaceClassification `json:"classification,omitempty"` // Properties - Properties which include the fully qualified namespace name. Properties *MetricNamespaceName `json:"properties,omitempty"` } @@ -4477,9 +4660,11 @@ type MetricTrigger struct { MetricNamespace *string `json:"metricNamespace,omitempty"` // MetricResourceURI - the resource identifier of the resource the rule monitors. MetricResourceURI *string `json:"metricResourceUri,omitempty"` + // MetricResourceLocation - the location of the resource the rule monitors. + MetricResourceLocation *string `json:"metricResourceLocation,omitempty"` // TimeGrain - 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. TimeGrain *string `json:"timeGrain,omitempty"` - // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum' + // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum', 'MetricStatisticTypeCount' Statistic MetricStatisticType `json:"statistic,omitempty"` // TimeWindow - 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. TimeWindow *string `json:"timeWindow,omitempty"` @@ -4491,6 +4676,8 @@ type MetricTrigger struct { Threshold *float64 `json:"threshold,omitempty"` // Dimensions - List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. Dimensions *[]ScaleRuleMetricDimension `json:"dimensions,omitempty"` + // DividePerInstance - a value indicating whether metric should divide per instance. + DividePerInstance *bool `json:"dividePerInstance,omitempty"` } // MetricValue represents a metric value. @@ -4526,8 +4713,8 @@ type MultiMetricCriteria struct { MetricName *string `json:"metricName,omitempty"` // MetricNamespace - Namespace of the metric. MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` + // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' + TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` // Dimensions - List of dimension conditions. Dimensions *[]MetricDimension `json:"dimensions,omitempty"` // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. @@ -4590,7 +4777,7 @@ func (mmc MultiMetricCriteria) MarshalJSON() ([]byte, error) { if mmc.MetricNamespace != nil { objectMap["metricNamespace"] = mmc.MetricNamespace } - if mmc.TimeAggregation != nil { + if mmc.TimeAggregation != "" { objectMap["timeAggregation"] = mmc.TimeAggregation } if mmc.Dimensions != nil { @@ -4678,7 +4865,7 @@ func (mmc *MultiMetricCriteria) UnmarshalJSON(body []byte) error { } case "timeAggregation": if v != nil { - var timeAggregation interface{} + var timeAggregation AggregationTypeEnum err = json.Unmarshal(*v, &timeAggregation) if err != nil { return err @@ -5593,6 +5780,10 @@ type Resource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for Resource. @@ -5610,15 +5801,15 @@ func (r Resource) MarshalJSON() ([]byte, error) { // Response the response to a metrics query. type Response struct { autorest.Response `json:"-"` - // Cost - The integer value representing the cost of the query, for data case. + // Cost - The integer value representing the relative cost of the query. Cost *float64 `json:"cost,omitempty"` // 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. Timespan *string `json:"timespan,omitempty"` // 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. Interval *string `json:"interval,omitempty"` - // Namespace - The namespace of the metrics been queried + // Namespace - The namespace of the metrics being queried Namespace *string `json:"namespace,omitempty"` - // Resourceregion - The region of the resource been queried for metrics. + // Resourceregion - The region of the resource being queried for metrics. Resourceregion *string `json:"resourceregion,omitempty"` // Value - the value of the collection. Value *[]Metric `json:"value,omitempty"` @@ -5864,6 +6055,12 @@ type BasicRuleDataSource interface { type RuleDataSource struct { // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' OdataType OdataType `json:"odata.type,omitempty"` } @@ -5916,6 +6113,15 @@ func (rds RuleDataSource) MarshalJSON() ([]byte, error) { if rds.ResourceURI != nil { objectMap["resourceUri"] = rds.ResourceURI } + if rds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rds.LegacyResourceID + } + if rds.ResourceLocation != nil { + objectMap["resourceLocation"] = rds.ResourceLocation + } + if rds.MetricNamespace != nil { + objectMap["metricNamespace"] = rds.MetricNamespace + } if rds.OdataType != "" { objectMap["odata.type"] = rds.OdataType } @@ -6018,6 +6224,12 @@ type RuleManagementEventDataSource struct { Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' OdataType OdataType `json:"odata.type,omitempty"` } @@ -6056,6 +6268,15 @@ func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { if rmeds.ResourceURI != nil { objectMap["resourceUri"] = rmeds.ResourceURI } + if rmeds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rmeds.LegacyResourceID + } + if rmeds.ResourceLocation != nil { + objectMap["resourceLocation"] = rmeds.ResourceLocation + } + if rmeds.MetricNamespace != nil { + objectMap["metricNamespace"] = rmeds.MetricNamespace + } if rmeds.OdataType != "" { objectMap["odata.type"] = rmeds.OdataType } @@ -6089,6 +6310,12 @@ type RuleMetricDataSource struct { MetricName *string `json:"metricName,omitempty"` // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' OdataType OdataType `json:"odata.type,omitempty"` } @@ -6103,6 +6330,15 @@ func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) { if rmds.ResourceURI != nil { objectMap["resourceUri"] = rmds.ResourceURI } + if rmds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rmds.LegacyResourceID + } + if rmds.ResourceLocation != nil { + objectMap["resourceLocation"] = rmds.ResourceLocation + } + if rmds.MetricNamespace != nil { + objectMap["metricNamespace"] = rmds.MetricNamespace + } if rmds.OdataType != "" { objectMap["odata.type"] = rmds.OdataType } @@ -6180,7 +6416,7 @@ func (rwa RuleWebhookAction) AsBasicRuleAction() (BasicRuleAction, bool) { type ScaleAction struct { // Direction - the scale direction. Whether the scaling action increases or decreases the number of instances. Possible values include: 'ScaleDirectionNone', 'ScaleDirectionIncrease', 'ScaleDirectionDecrease' Direction ScaleDirection `json:"direction,omitempty"` - // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount' + // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount', 'ServiceAllowedNextValue' Type ScaleType `json:"type,omitempty"` // Value - the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1. Value *string `json:"value,omitempty"` @@ -6920,8 +7156,8 @@ type TimeSeriesBaseline struct { Timestamps *[]date.Time `json:"timestamps,omitempty"` // Data - The baseline values for each sensitivity. Data *[]SingleBaseline `json:"data,omitempty"` - // Metadata - The baseline metadata values. - Metadata *[]BaselineMetadata `json:"metadata,omitempty"` + // MetadataValues - The baseline metadata values. + MetadataValues *[]BaselineMetadata `json:"metadataValues,omitempty"` } // TimeSeriesElement a time series result type. The discriminator value is always TimeSeries in this case. @@ -6932,16 +7168,6 @@ type TimeSeriesElement struct { Data *[]MetricValue `json:"data,omitempty"` } -// TimeSeriesInformation the time series info needed for calculating the baseline. -type TimeSeriesInformation struct { - // Sensitivities - the list of sensitivities for calculating the baseline. - Sensitivities *[]string `json:"sensitivities,omitempty"` - // Values - The metric values to calculate the baseline. - Values *[]float64 `json:"values,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` -} - // TimeWindow a specific date-time for the profile. type TimeWindow struct { // TimeZone - 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 @@ -6954,7 +7180,7 @@ type TimeWindow struct { // TriggerCondition the condition that results in the Log Search rule. type TriggerCondition struct { - // ThresholdOperator - Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' + // ThresholdOperator - Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'ConditionalOperatorGreaterThanOrEqual', 'ConditionalOperatorLessThanOrEqual', 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` // Threshold - Result or count threshold based on which rule should be triggered. Threshold *float64 `json:"threshold,omitempty"` diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/operations.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/operations.go index 3f82351c7f23..afb74dc9248f 100644 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/operations.go +++ b/services/preview/monitor/mgmt/2019-11-01-preview/insights/operations.go @@ -74,7 +74,7 @@ func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/operations"), + autorest.WithPath("/providers/Microsoft.Insights/operations"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/privateendpointconnections.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/privateendpointconnections.go index 0d69382e47aa..c8bc7078ed76 100644 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/privateendpointconnections.go +++ b/services/preview/monitor/mgmt/2019-11-01-preview/insights/privateendpointconnections.go @@ -34,7 +34,7 @@ func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscription // CreateOrUpdate approve or reject a private endpoint connection with a given name. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // scopeName - the name of the Azure Monitor PrivateLinkScope resource. // privateEndpointConnectionName - the name of the private endpoint connection. func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { @@ -51,6 +51,9 @@ func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Contex if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: false, @@ -130,7 +133,7 @@ func (client PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *htt // Delete deletes a private endpoint connection with a given name. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // scopeName - the name of the Azure Monitor PrivateLinkScope resource. // privateEndpointConnectionName - the name of the private endpoint connection. func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { @@ -146,7 +149,10 @@ func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resou } if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.PrivateEndpointConnectionsClient", "Delete", err.Error()) } @@ -216,7 +222,7 @@ func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Respon // Get gets a private endpoint connection. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // scopeName - the name of the Azure Monitor PrivateLinkScope resource. // privateEndpointConnectionName - the name of the private endpoint connection. func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { @@ -232,7 +238,10 @@ func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resource } if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.PrivateEndpointConnectionsClient", "Get", err.Error()) } @@ -300,7 +309,7 @@ func (client PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) // ListByPrivateLinkScope gets all private endpoint connections on a private link scope. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // scopeName - the name of the Azure Monitor PrivateLinkScope resource. func (client PrivateEndpointConnectionsClient) ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result PrivateEndpointConnectionListResultPage, err error) { if tracing.IsEnabled() { @@ -315,7 +324,10 @@ func (client PrivateEndpointConnectionsClient) ListByPrivateLinkScope(ctx contex } if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", err.Error()) } diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkresources.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkresources.go index 649f2b047a6a..02157f85d6c4 100644 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkresources.go +++ b/services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkresources.go @@ -34,7 +34,7 @@ func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID str // Get gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // scopeName - the name of the Azure Monitor PrivateLinkScope resource. // groupName - the name of the private link resource. func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, scopeName string, groupName string) (result PrivateLinkResource, err error) { @@ -50,7 +50,10 @@ func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupN } if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.PrivateLinkResourcesClient", "Get", err.Error()) } @@ -118,7 +121,7 @@ func (client PrivateLinkResourcesClient) GetResponder(resp *http.Response) (resu // ListByPrivateLinkScope gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // scopeName - the name of the Azure Monitor PrivateLinkScope resource. func (client PrivateLinkResourcesClient) ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result PrivateLinkResourceListResultPage, err error) { if tracing.IsEnabled() { @@ -133,7 +136,10 @@ func (client PrivateLinkResourcesClient) ListByPrivateLinkScope(ctx context.Cont } if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.PrivateLinkResourcesClient", "ListByPrivateLinkScope", err.Error()) } diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkscopedresources.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkscopedresources.go index b1b205008123..87ad66e22a67 100644 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkscopedresources.go +++ b/services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkscopedresources.go @@ -34,7 +34,7 @@ func NewPrivateLinkScopedResourcesClientWithBaseURI(baseURI string, subscription // CreateOrUpdate approve or reject a private endpoint connection with a given name. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // scopeName - the name of the Azure Monitor PrivateLinkScope resource. // name - the name of the scoped resource object. func (client PrivateLinkScopedResourcesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, name string, parameters ScopedResource) (result PrivateLinkScopedResourcesCreateOrUpdateFuture, err error) { @@ -50,7 +50,10 @@ func (client PrivateLinkScopedResourcesClient) CreateOrUpdate(ctx context.Contex } if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.PrivateLinkScopedResourcesClient", "CreateOrUpdate", err.Error()) } @@ -123,7 +126,7 @@ func (client PrivateLinkScopedResourcesClient) CreateOrUpdateResponder(resp *htt // Delete deletes a private endpoint connection with a given name. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // scopeName - the name of the Azure Monitor PrivateLinkScope resource. // name - the name of the scoped resource object. func (client PrivateLinkScopedResourcesClient) Delete(ctx context.Context, resourceGroupName string, scopeName string, name string) (result PrivateLinkScopedResourcesDeleteFuture, err error) { @@ -139,7 +142,10 @@ func (client PrivateLinkScopedResourcesClient) Delete(ctx context.Context, resou } if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.PrivateLinkScopedResourcesClient", "Delete", err.Error()) } @@ -209,7 +215,7 @@ func (client PrivateLinkScopedResourcesClient) DeleteResponder(resp *http.Respon // Get gets a scoped resource in a private link scope. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // scopeName - the name of the Azure Monitor PrivateLinkScope resource. // name - the name of the scoped resource object. func (client PrivateLinkScopedResourcesClient) Get(ctx context.Context, resourceGroupName string, scopeName string, name string) (result ScopedResource, err error) { @@ -225,7 +231,10 @@ func (client PrivateLinkScopedResourcesClient) Get(ctx context.Context, resource } if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.PrivateLinkScopedResourcesClient", "Get", err.Error()) } @@ -293,7 +302,7 @@ func (client PrivateLinkScopedResourcesClient) GetResponder(resp *http.Response) // ListByPrivateLinkScope gets all private endpoint connections on a private link scope. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // scopeName - the name of the Azure Monitor PrivateLinkScope resource. func (client PrivateLinkScopedResourcesClient) ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result ScopedResourceListResultPage, err error) { if tracing.IsEnabled() { @@ -308,7 +317,10 @@ func (client PrivateLinkScopedResourcesClient) ListByPrivateLinkScope(ctx contex } if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.PrivateLinkScopedResourcesClient", "ListByPrivateLinkScope", err.Error()) } diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkscopeoperationstatus.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkscopeoperationstatus.go index 9e483edc658d..a29fa9edf886 100644 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkscopeoperationstatus.go +++ b/services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkscopeoperationstatus.go @@ -35,7 +35,7 @@ func NewPrivateLinkScopeOperationStatusClientWithBaseURI(baseURI string, subscri // Get get the status of an azure asynchronous operation associated with a private link scope operation. // Parameters: // asyncOperationID - the operation Id. -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client PrivateLinkScopeOperationStatusClient) Get(ctx context.Context, asyncOperationID string, resourceGroupName string) (result OperationStatus, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopeOperationStatusClient.Get") @@ -48,6 +48,9 @@ func (client PrivateLinkScopeOperationStatusClient) Get(ctx context.Context, asy }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.PrivateLinkScopeOperationStatusClient", "Get", err.Error()) diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkscopes.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkscopes.go index 6d9c83285c08..fc2796420366 100644 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkscopes.go +++ b/services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkscopes.go @@ -35,7 +35,7 @@ func NewPrivateLinkScopesClientWithBaseURI(baseURI string, subscriptionID string // CreateOrUpdate creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot specify a different value for // InstrumentationKey nor AppId in the Put operation. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // scopeName - the name of the Azure Monitor PrivateLinkScope resource. // azureMonitorPrivateLinkScopePayload - properties that need to be specified to create or update a Azure // Monitor PrivateLinkScope. @@ -51,6 +51,9 @@ func (client PrivateLinkScopesClient) CreateOrUpdate(ctx context.Context, resour }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: azureMonitorPrivateLinkScopePayload, @@ -123,7 +126,7 @@ func (client PrivateLinkScopesClient) CreateOrUpdateResponder(resp *http.Respons // Delete deletes a Azure Monitor PrivateLinkScope. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // scopeName - the name of the Azure Monitor PrivateLinkScope resource. func (client PrivateLinkScopesClient) Delete(ctx context.Context, resourceGroupName string, scopeName string) (result PrivateLinkScopesDeleteFuture, err error) { if tracing.IsEnabled() { @@ -137,6 +140,9 @@ func (client PrivateLinkScopesClient) Delete(ctx context.Context, resourceGroupN }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.PrivateLinkScopesClient", "Delete", err.Error()) @@ -207,7 +213,7 @@ func (client PrivateLinkScopesClient) DeleteResponder(resp *http.Response) (resu // Get returns a Azure Monitor PrivateLinkScope. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // scopeName - the name of the Azure Monitor PrivateLinkScope resource. func (client PrivateLinkScopesClient) Get(ctx context.Context, resourceGroupName string, scopeName string) (result AzureMonitorPrivateLinkScope, err error) { if tracing.IsEnabled() { @@ -221,6 +227,9 @@ func (client PrivateLinkScopesClient) Get(ctx context.Context, resourceGroupName }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.PrivateLinkScopesClient", "Get", err.Error()) @@ -408,7 +417,7 @@ func (client PrivateLinkScopesClient) ListComplete(ctx context.Context) (result // ListByResourceGroup gets a list of Azure Monitor PrivateLinkScopes within a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client PrivateLinkScopesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AzureMonitorPrivateLinkScopeListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.ListByResourceGroup") @@ -421,6 +430,9 @@ func (client PrivateLinkScopesClient) ListByResourceGroup(ctx context.Context, r }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.PrivateLinkScopesClient", "ListByResourceGroup", err.Error()) @@ -530,7 +542,7 @@ func (client PrivateLinkScopesClient) ListByResourceGroupComplete(ctx context.Co // UpdateTags updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate method. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // scopeName - the name of the Azure Monitor PrivateLinkScope resource. // privateLinkScopeTags - updated tag information to set into the PrivateLinkScope instance. func (client PrivateLinkScopesClient) UpdateTags(ctx context.Context, resourceGroupName string, scopeName string, privateLinkScopeTags TagsResource) (result AzureMonitorPrivateLinkScope, err error) { @@ -545,6 +557,9 @@ func (client PrivateLinkScopesClient) UpdateTags(ctx context.Context, resourceGr }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.PrivateLinkScopesClient", "UpdateTags", err.Error()) diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/scheduledqueryrules.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/scheduledqueryrules.go index c6dab9c1e3c8..22b09a5f8997 100644 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/scheduledqueryrules.go +++ b/services/preview/monitor/mgmt/2019-11-01-preview/insights/scheduledqueryrules.go @@ -34,7 +34,7 @@ func NewScheduledQueryRulesClientWithBaseURI(baseURI string, subscriptionID stri // CreateOrUpdate creates or updates an log search rule. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to create or update. func (client ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResource) (result LogSearchRuleResource, err error) { @@ -51,6 +51,9 @@ func (client ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, reso if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.LogSearchRule", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source", Name: validation.Null, Rule: true, @@ -102,7 +105,7 @@ func (client ScheduledQueryRulesClient) CreateOrUpdatePreparer(ctx context.Conte autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -128,7 +131,7 @@ func (client ScheduledQueryRulesClient) CreateOrUpdateResponder(resp *http.Respo // Delete deletes a Log Search rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client ScheduledQueryRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { if tracing.IsEnabled() { @@ -142,6 +145,9 @@ func (client ScheduledQueryRulesClient) Delete(ctx context.Context, resourceGrou }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ScheduledQueryRulesClient", "Delete", err.Error()) @@ -185,7 +191,7 @@ func (client ScheduledQueryRulesClient) DeletePreparer(ctx context.Context, reso preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -209,7 +215,7 @@ func (client ScheduledQueryRulesClient) DeleteResponder(resp *http.Response) (re // Get gets an Log Search rule // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. func (client ScheduledQueryRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result LogSearchRuleResource, err error) { if tracing.IsEnabled() { @@ -223,6 +229,9 @@ func (client ScheduledQueryRulesClient) Get(ctx context.Context, resourceGroupNa }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ScheduledQueryRulesClient", "Get", err.Error()) @@ -266,7 +275,7 @@ func (client ScheduledQueryRulesClient) GetPreparer(ctx context.Context, resourc preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -291,7 +300,7 @@ func (client ScheduledQueryRulesClient) GetResponder(resp *http.Response) (resul // ListByResourceGroup list the Log Search rules within a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // filter - the filter to apply on the operation. For more information please see // https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx func (client ScheduledQueryRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result LogSearchRuleResourceCollection, err error) { @@ -306,6 +315,9 @@ func (client ScheduledQueryRulesClient) ListByResourceGroup(ctx context.Context, }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ScheduledQueryRulesClient", "ListByResourceGroup", err.Error()) @@ -351,7 +363,7 @@ func (client ScheduledQueryRulesClient) ListByResourceGroupPreparer(ctx context. preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -434,7 +446,7 @@ func (client ScheduledQueryRulesClient) ListBySubscriptionPreparer(ctx context.C preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/scheduledQueryRules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -459,7 +471,7 @@ func (client ScheduledQueryRulesClient) ListBySubscriptionResponder(resp *http.R // Update update log search Rule. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to update. func (client ScheduledQueryRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResourcePatch) (result LogSearchRuleResource, err error) { @@ -475,7 +487,10 @@ func (client ScheduledQueryRulesClient) Update(ctx context.Context, resourceGrou } if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ScheduledQueryRulesClient", "Update", err.Error()) } @@ -518,7 +533,7 @@ func (client ScheduledQueryRulesClient) UpdatePreparer(ctx context.Context, reso autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/tenantactivitylogs.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/tenantactivitylogs.go index 7501f047bb38..7c6ee7981381 100644 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/tenantactivitylogs.go +++ b/services/preview/monitor/mgmt/2019-11-01-preview/insights/tenantactivitylogs.go @@ -107,7 +107,7 @@ func (client TenantActivityLogsClient) ListPreparer(ctx context.Context, filter preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventtypes/management/values"), + autorest.WithPath("/providers/Microsoft.Insights/eventtypes/management/values"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/CHANGELOG.md b/services/preview/monitor/mgmt/2021-04-01-preview/insights/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/_meta.json b/services/preview/monitor/mgmt/2021-04-01-preview/insights/_meta.json deleted file mode 100644 index 92647bcdbe57..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "8dff86df71bee429af84ea4713288ef3cdd1db2f", - "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", - "tag": "package-2021-04", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-04 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/datacollectionruleassociations.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/datacollectionruleassociations.go deleted file mode 100644 index 59878dbc8c2f..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/datacollectionruleassociations.go +++ /dev/null @@ -1,534 +0,0 @@ -package insights - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DataCollectionRuleAssociationsClient is the monitor Management Client -type DataCollectionRuleAssociationsClient struct { - BaseClient -} - -// NewDataCollectionRuleAssociationsClient creates an instance of the DataCollectionRuleAssociationsClient client. -func NewDataCollectionRuleAssociationsClient(subscriptionID string) DataCollectionRuleAssociationsClient { - return NewDataCollectionRuleAssociationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDataCollectionRuleAssociationsClientWithBaseURI creates an instance of the DataCollectionRuleAssociationsClient -// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI -// (sovereign clouds, Azure stack). -func NewDataCollectionRuleAssociationsClientWithBaseURI(baseURI string, subscriptionID string) DataCollectionRuleAssociationsClient { - return DataCollectionRuleAssociationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create sends the create request. -// Parameters: -// resourceURI - the identifier of the resource. -// associationName - the name of the association. The name is case insensitive. -// body - the payload -func (client DataCollectionRuleAssociationsClient) Create(ctx context.Context, resourceURI string, associationName string, body *DataCollectionRuleAssociationProxyOnlyResource) (result DataCollectionRuleAssociationProxyOnlyResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationsClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceURI, - Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DataCollectionRuleAssociationsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceURI, associationName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client DataCollectionRuleAssociationsClient) CreatePreparer(ctx context.Context, resourceURI string, associationName string, body *DataCollectionRuleAssociationProxyOnlyResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "associationName": autorest.Encode("path", associationName), - "resourceUri": resourceURI, - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Type = nil - body.Etag = nil - body.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if body != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(body)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client DataCollectionRuleAssociationsClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client DataCollectionRuleAssociationsClient) CreateResponder(resp *http.Response) (result DataCollectionRuleAssociationProxyOnlyResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete sends the delete request. -// Parameters: -// resourceURI - the identifier of the resource. -// associationName - the name of the association. The name is case insensitive. -func (client DataCollectionRuleAssociationsClient) Delete(ctx context.Context, resourceURI string, associationName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceURI, - Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DataCollectionRuleAssociationsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceURI, associationName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DataCollectionRuleAssociationsClient) DeletePreparer(ctx context.Context, resourceURI string, associationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "associationName": autorest.Encode("path", associationName), - "resourceUri": resourceURI, - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client DataCollectionRuleAssociationsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DataCollectionRuleAssociationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get sends the get request. -// Parameters: -// resourceURI - the identifier of the resource. -// associationName - the name of the association. The name is case insensitive. -func (client DataCollectionRuleAssociationsClient) Get(ctx context.Context, resourceURI string, associationName string) (result DataCollectionRuleAssociationProxyOnlyResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceURI, - Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DataCollectionRuleAssociationsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceURI, associationName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DataCollectionRuleAssociationsClient) GetPreparer(ctx context.Context, resourceURI string, associationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "associationName": autorest.Encode("path", associationName), - "resourceUri": resourceURI, - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DataCollectionRuleAssociationsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DataCollectionRuleAssociationsClient) GetResponder(resp *http.Response) (result DataCollectionRuleAssociationProxyOnlyResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResource sends the list by resource request. -// Parameters: -// resourceURI - the identifier of the resource. -func (client DataCollectionRuleAssociationsClient) ListByResource(ctx context.Context, resourceURI string) (result DataCollectionRuleAssociationProxyOnlyResourceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationsClient.ListByResource") - defer func() { - sc := -1 - if result.dcraporlr.Response.Response != nil { - sc = result.dcraporlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceURI, - Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DataCollectionRuleAssociationsClient", "ListByResource", err.Error()) - } - - result.fn = client.listByResourceNextResults - req, err := client.ListByResourcePreparer(ctx, resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "ListByResource", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceSender(req) - if err != nil { - result.dcraporlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "ListByResource", resp, "Failure sending request") - return - } - - result.dcraporlr, err = client.ListByResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "ListByResource", resp, "Failure responding to request") - return - } - if result.dcraporlr.hasNextLink() && result.dcraporlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourcePreparer prepares the ListByResource request. -func (client DataCollectionRuleAssociationsClient) ListByResourcePreparer(ctx context.Context, resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceSender sends the ListByResource request. The method will close the -// http.Response Body if it receives an error. -func (client DataCollectionRuleAssociationsClient) ListByResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListByResourceResponder handles the response to the ListByResource request. The method always -// closes the http.Response Body. -func (client DataCollectionRuleAssociationsClient) ListByResourceResponder(resp *http.Response) (result DataCollectionRuleAssociationProxyOnlyResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceNextResults retrieves the next set of results, if any. -func (client DataCollectionRuleAssociationsClient) listByResourceNextResults(ctx context.Context, lastResults DataCollectionRuleAssociationProxyOnlyResourceListResult) (result DataCollectionRuleAssociationProxyOnlyResourceListResult, err error) { - req, err := lastResults.dataCollectionRuleAssociationProxyOnlyResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "listByResourceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "listByResourceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "listByResourceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceComplete enumerates all values, automatically crossing page boundaries as required. -func (client DataCollectionRuleAssociationsClient) ListByResourceComplete(ctx context.Context, resourceURI string) (result DataCollectionRuleAssociationProxyOnlyResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationsClient.ListByResource") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResource(ctx, resourceURI) - return -} - -// ListByRule sends the list by rule request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// dataCollectionRuleName - the name of the data collection rule. The name is case insensitive. -func (client DataCollectionRuleAssociationsClient) ListByRule(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result DataCollectionRuleAssociationProxyOnlyResourceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationsClient.ListByRule") - defer func() { - sc := -1 - if result.dcraporlr.Response.Response != nil { - sc = result.dcraporlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DataCollectionRuleAssociationsClient", "ListByRule", err.Error()) - } - - result.fn = client.listByRuleNextResults - req, err := client.ListByRulePreparer(ctx, resourceGroupName, dataCollectionRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "ListByRule", nil, "Failure preparing request") - return - } - - resp, err := client.ListByRuleSender(req) - if err != nil { - result.dcraporlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "ListByRule", resp, "Failure sending request") - return - } - - result.dcraporlr, err = client.ListByRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "ListByRule", resp, "Failure responding to request") - return - } - if result.dcraporlr.hasNextLink() && result.dcraporlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByRulePreparer prepares the ListByRule request. -func (client DataCollectionRuleAssociationsClient) ListByRulePreparer(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dataCollectionRuleName": autorest.Encode("path", dataCollectionRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByRuleSender sends the ListByRule request. The method will close the -// http.Response Body if it receives an error. -func (client DataCollectionRuleAssociationsClient) ListByRuleSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByRuleResponder handles the response to the ListByRule request. The method always -// closes the http.Response Body. -func (client DataCollectionRuleAssociationsClient) ListByRuleResponder(resp *http.Response) (result DataCollectionRuleAssociationProxyOnlyResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByRuleNextResults retrieves the next set of results, if any. -func (client DataCollectionRuleAssociationsClient) listByRuleNextResults(ctx context.Context, lastResults DataCollectionRuleAssociationProxyOnlyResourceListResult) (result DataCollectionRuleAssociationProxyOnlyResourceListResult, err error) { - req, err := lastResults.dataCollectionRuleAssociationProxyOnlyResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "listByRuleNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "listByRuleNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "listByRuleNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByRuleComplete enumerates all values, automatically crossing page boundaries as required. -func (client DataCollectionRuleAssociationsClient) ListByRuleComplete(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result DataCollectionRuleAssociationProxyOnlyResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationsClient.ListByRule") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByRule(ctx, resourceGroupName, dataCollectionRuleName) - return -} diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/diagnosticsettingscategory.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/diagnosticsettingscategory.go deleted file mode 100644 index bb7a66926c3e..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/diagnosticsettingscategory.go +++ /dev/null @@ -1,193 +0,0 @@ -package insights - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DiagnosticSettingsCategoryClient is the monitor Management Client -type DiagnosticSettingsCategoryClient struct { - BaseClient -} - -// NewDiagnosticSettingsCategoryClient creates an instance of the DiagnosticSettingsCategoryClient client. -func NewDiagnosticSettingsCategoryClient(subscriptionID string) DiagnosticSettingsCategoryClient { - return NewDiagnosticSettingsCategoryClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDiagnosticSettingsCategoryClientWithBaseURI creates an instance of the DiagnosticSettingsCategoryClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewDiagnosticSettingsCategoryClientWithBaseURI(baseURI string, subscriptionID string) DiagnosticSettingsCategoryClient { - return DiagnosticSettingsCategoryClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the diagnostic settings category for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsCategoryClient) Get(ctx context.Context, resourceURI string, name string) (result DiagnosticSettingsCategoryResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsCategoryClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceURI, - Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DiagnosticSettingsCategoryClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceURI, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DiagnosticSettingsCategoryClient) GetPreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DiagnosticSettingsCategoryClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DiagnosticSettingsCategoryClient) GetResponder(resp *http.Response) (result DiagnosticSettingsCategoryResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists the diagnostic settings categories for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -func (client DiagnosticSettingsCategoryClient) List(ctx context.Context, resourceURI string) (result DiagnosticSettingsCategoryResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsCategoryClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceURI, - Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DiagnosticSettingsCategoryClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DiagnosticSettingsCategoryClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client DiagnosticSettingsCategoryClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client DiagnosticSettingsCategoryClient) ListResponder(resp *http.Response) (result DiagnosticSettingsCategoryResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/enums.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/enums.go deleted file mode 100644 index bd101099eb89..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/enums.go +++ /dev/null @@ -1,989 +0,0 @@ -package insights - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AggregationType enumerates the values for aggregation type. -type AggregationType string - -const ( - // AggregationTypeAverage ... - AggregationTypeAverage AggregationType = "Average" - // AggregationTypeCount ... - AggregationTypeCount AggregationType = "Count" - // AggregationTypeMaximum ... - AggregationTypeMaximum AggregationType = "Maximum" - // AggregationTypeMinimum ... - AggregationTypeMinimum AggregationType = "Minimum" - // AggregationTypeNone ... - AggregationTypeNone AggregationType = "None" - // AggregationTypeTotal ... - AggregationTypeTotal AggregationType = "Total" -) - -// PossibleAggregationTypeValues returns an array of possible values for the AggregationType const type. -func PossibleAggregationTypeValues() []AggregationType { - return []AggregationType{AggregationTypeAverage, AggregationTypeCount, AggregationTypeMaximum, AggregationTypeMinimum, AggregationTypeNone, AggregationTypeTotal} -} - -// AggregationTypeEnum enumerates the values for aggregation type enum. -type AggregationTypeEnum string - -const ( - // AggregationTypeEnumAverage ... - AggregationTypeEnumAverage AggregationTypeEnum = "Average" - // AggregationTypeEnumCount ... - AggregationTypeEnumCount AggregationTypeEnum = "Count" - // AggregationTypeEnumMaximum ... - AggregationTypeEnumMaximum AggregationTypeEnum = "Maximum" - // AggregationTypeEnumMinimum ... - AggregationTypeEnumMinimum AggregationTypeEnum = "Minimum" - // AggregationTypeEnumTotal ... - AggregationTypeEnumTotal AggregationTypeEnum = "Total" -) - -// PossibleAggregationTypeEnumValues returns an array of possible values for the AggregationTypeEnum const type. -func PossibleAggregationTypeEnumValues() []AggregationTypeEnum { - return []AggregationTypeEnum{AggregationTypeEnumAverage, AggregationTypeEnumCount, AggregationTypeEnumMaximum, AggregationTypeEnumMinimum, AggregationTypeEnumTotal} -} - -// AlertSeverity enumerates the values for alert severity. -type AlertSeverity string - -const ( - // AlertSeverityFour ... - AlertSeverityFour AlertSeverity = "4" - // AlertSeverityOne ... - AlertSeverityOne AlertSeverity = "1" - // AlertSeverityThree ... - AlertSeverityThree AlertSeverity = "3" - // AlertSeverityTwo ... - AlertSeverityTwo AlertSeverity = "2" - // AlertSeverityZero ... - AlertSeverityZero AlertSeverity = "0" -) - -// PossibleAlertSeverityValues returns an array of possible values for the AlertSeverity const type. -func PossibleAlertSeverityValues() []AlertSeverity { - return []AlertSeverity{AlertSeverityFour, AlertSeverityOne, AlertSeverityThree, AlertSeverityTwo, AlertSeverityZero} -} - -// BaselineSensitivity enumerates the values for baseline sensitivity. -type BaselineSensitivity string - -const ( - // BaselineSensitivityHigh ... - BaselineSensitivityHigh BaselineSensitivity = "High" - // BaselineSensitivityLow ... - BaselineSensitivityLow BaselineSensitivity = "Low" - // BaselineSensitivityMedium ... - BaselineSensitivityMedium BaselineSensitivity = "Medium" -) - -// PossibleBaselineSensitivityValues returns an array of possible values for the BaselineSensitivity const type. -func PossibleBaselineSensitivityValues() []BaselineSensitivity { - return []BaselineSensitivity{BaselineSensitivityHigh, BaselineSensitivityLow, BaselineSensitivityMedium} -} - -// CategoryType enumerates the values for category type. -type CategoryType string - -const ( - // CategoryTypeLogs ... - CategoryTypeLogs CategoryType = "Logs" - // CategoryTypeMetrics ... - CategoryTypeMetrics CategoryType = "Metrics" -) - -// PossibleCategoryTypeValues returns an array of possible values for the CategoryType const type. -func PossibleCategoryTypeValues() []CategoryType { - return []CategoryType{CategoryTypeLogs, CategoryTypeMetrics} -} - -// ComparisonOperationType enumerates the values for comparison operation type. -type ComparisonOperationType string - -const ( - // ComparisonOperationTypeEquals ... - ComparisonOperationTypeEquals ComparisonOperationType = "Equals" - // ComparisonOperationTypeGreaterThan ... - ComparisonOperationTypeGreaterThan ComparisonOperationType = "GreaterThan" - // ComparisonOperationTypeGreaterThanOrEqual ... - ComparisonOperationTypeGreaterThanOrEqual ComparisonOperationType = "GreaterThanOrEqual" - // ComparisonOperationTypeLessThan ... - ComparisonOperationTypeLessThan ComparisonOperationType = "LessThan" - // ComparisonOperationTypeLessThanOrEqual ... - ComparisonOperationTypeLessThanOrEqual ComparisonOperationType = "LessThanOrEqual" - // ComparisonOperationTypeNotEquals ... - ComparisonOperationTypeNotEquals ComparisonOperationType = "NotEquals" -) - -// PossibleComparisonOperationTypeValues returns an array of possible values for the ComparisonOperationType const type. -func PossibleComparisonOperationTypeValues() []ComparisonOperationType { - return []ComparisonOperationType{ComparisonOperationTypeEquals, ComparisonOperationTypeGreaterThan, ComparisonOperationTypeGreaterThanOrEqual, ComparisonOperationTypeLessThan, ComparisonOperationTypeLessThanOrEqual, ComparisonOperationTypeNotEquals} -} - -// ConditionalOperator enumerates the values for conditional operator. -type ConditionalOperator string - -const ( - // ConditionalOperatorEqual ... - ConditionalOperatorEqual ConditionalOperator = "Equal" - // ConditionalOperatorGreaterThan ... - ConditionalOperatorGreaterThan ConditionalOperator = "GreaterThan" - // ConditionalOperatorGreaterThanOrEqual ... - ConditionalOperatorGreaterThanOrEqual ConditionalOperator = "GreaterThanOrEqual" - // ConditionalOperatorLessThan ... - ConditionalOperatorLessThan ConditionalOperator = "LessThan" - // ConditionalOperatorLessThanOrEqual ... - ConditionalOperatorLessThanOrEqual ConditionalOperator = "LessThanOrEqual" -) - -// PossibleConditionalOperatorValues returns an array of possible values for the ConditionalOperator const type. -func PossibleConditionalOperatorValues() []ConditionalOperator { - return []ConditionalOperator{ConditionalOperatorEqual, ConditionalOperatorGreaterThan, ConditionalOperatorGreaterThanOrEqual, ConditionalOperatorLessThan, ConditionalOperatorLessThanOrEqual} -} - -// ConditionOperator enumerates the values for condition operator. -type ConditionOperator string - -const ( - // ConditionOperatorGreaterThan ... - ConditionOperatorGreaterThan ConditionOperator = "GreaterThan" - // ConditionOperatorGreaterThanOrEqual ... - ConditionOperatorGreaterThanOrEqual ConditionOperator = "GreaterThanOrEqual" - // ConditionOperatorLessThan ... - ConditionOperatorLessThan ConditionOperator = "LessThan" - // ConditionOperatorLessThanOrEqual ... - ConditionOperatorLessThanOrEqual ConditionOperator = "LessThanOrEqual" -) - -// PossibleConditionOperatorValues returns an array of possible values for the ConditionOperator const type. -func PossibleConditionOperatorValues() []ConditionOperator { - return []ConditionOperator{ConditionOperatorGreaterThan, ConditionOperatorGreaterThanOrEqual, ConditionOperatorLessThan, ConditionOperatorLessThanOrEqual} -} - -// CreatedByType enumerates the values for created by type. -type CreatedByType string - -const ( - // CreatedByTypeApplication ... - CreatedByTypeApplication CreatedByType = "Application" - // CreatedByTypeKey ... - CreatedByTypeKey CreatedByType = "Key" - // CreatedByTypeManagedIdentity ... - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - // CreatedByTypeUser ... - CreatedByTypeUser CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} -} - -// CriterionType enumerates the values for criterion type. -type CriterionType string - -const ( - // CriterionTypeDynamicThresholdCriterion ... - CriterionTypeDynamicThresholdCriterion CriterionType = "DynamicThresholdCriterion" - // CriterionTypeMultiMetricCriteria ... - CriterionTypeMultiMetricCriteria CriterionType = "MultiMetricCriteria" - // CriterionTypeStaticThresholdCriterion ... - CriterionTypeStaticThresholdCriterion CriterionType = "StaticThresholdCriterion" -) - -// PossibleCriterionTypeValues returns an array of possible values for the CriterionType const type. -func PossibleCriterionTypeValues() []CriterionType { - return []CriterionType{CriterionTypeDynamicThresholdCriterion, CriterionTypeMultiMetricCriteria, CriterionTypeStaticThresholdCriterion} -} - -// DataStatus enumerates the values for data status. -type DataStatus string - -const ( - // DataStatusNotPresent ... - DataStatusNotPresent DataStatus = "notPresent" - // DataStatusPresent ... - DataStatusPresent DataStatus = "present" -) - -// PossibleDataStatusValues returns an array of possible values for the DataStatus const type. -func PossibleDataStatusValues() []DataStatus { - return []DataStatus{DataStatusNotPresent, DataStatusPresent} -} - -// DynamicThresholdOperator enumerates the values for dynamic threshold operator. -type DynamicThresholdOperator string - -const ( - // DynamicThresholdOperatorGreaterOrLessThan ... - DynamicThresholdOperatorGreaterOrLessThan DynamicThresholdOperator = "GreaterOrLessThan" - // DynamicThresholdOperatorGreaterThan ... - DynamicThresholdOperatorGreaterThan DynamicThresholdOperator = "GreaterThan" - // DynamicThresholdOperatorLessThan ... - DynamicThresholdOperatorLessThan DynamicThresholdOperator = "LessThan" -) - -// PossibleDynamicThresholdOperatorValues returns an array of possible values for the DynamicThresholdOperator const type. -func PossibleDynamicThresholdOperatorValues() []DynamicThresholdOperator { - return []DynamicThresholdOperator{DynamicThresholdOperatorGreaterOrLessThan, DynamicThresholdOperatorGreaterThan, DynamicThresholdOperatorLessThan} -} - -// DynamicThresholdSensitivity enumerates the values for dynamic threshold sensitivity. -type DynamicThresholdSensitivity string - -const ( - // DynamicThresholdSensitivityHigh ... - DynamicThresholdSensitivityHigh DynamicThresholdSensitivity = "High" - // DynamicThresholdSensitivityLow ... - DynamicThresholdSensitivityLow DynamicThresholdSensitivity = "Low" - // DynamicThresholdSensitivityMedium ... - DynamicThresholdSensitivityMedium DynamicThresholdSensitivity = "Medium" -) - -// PossibleDynamicThresholdSensitivityValues returns an array of possible values for the DynamicThresholdSensitivity const type. -func PossibleDynamicThresholdSensitivityValues() []DynamicThresholdSensitivity { - return []DynamicThresholdSensitivity{DynamicThresholdSensitivityHigh, DynamicThresholdSensitivityLow, DynamicThresholdSensitivityMedium} -} - -// Enabled enumerates the values for enabled. -type Enabled string - -const ( - // EnabledFalse ... - EnabledFalse Enabled = "false" - // EnabledTrue ... - EnabledTrue Enabled = "true" -) - -// PossibleEnabledValues returns an array of possible values for the Enabled const type. -func PossibleEnabledValues() []Enabled { - return []Enabled{EnabledFalse, EnabledTrue} -} - -// EventLevel enumerates the values for event level. -type EventLevel string - -const ( - // EventLevelCritical ... - EventLevelCritical EventLevel = "Critical" - // EventLevelError ... - EventLevelError EventLevel = "Error" - // EventLevelInformational ... - EventLevelInformational EventLevel = "Informational" - // EventLevelVerbose ... - EventLevelVerbose EventLevel = "Verbose" - // EventLevelWarning ... - EventLevelWarning EventLevel = "Warning" -) - -// PossibleEventLevelValues returns an array of possible values for the EventLevel const type. -func PossibleEventLevelValues() []EventLevel { - return []EventLevel{EventLevelCritical, EventLevelError, EventLevelInformational, EventLevelVerbose, EventLevelWarning} -} - -// KnownDataCollectionEndpointProvisioningState enumerates the values for known data collection endpoint -// provisioning state. -type KnownDataCollectionEndpointProvisioningState string - -const ( - // KnownDataCollectionEndpointProvisioningStateCreating ... - KnownDataCollectionEndpointProvisioningStateCreating KnownDataCollectionEndpointProvisioningState = "Creating" - // KnownDataCollectionEndpointProvisioningStateDeleting ... - KnownDataCollectionEndpointProvisioningStateDeleting KnownDataCollectionEndpointProvisioningState = "Deleting" - // KnownDataCollectionEndpointProvisioningStateFailed ... - KnownDataCollectionEndpointProvisioningStateFailed KnownDataCollectionEndpointProvisioningState = "Failed" - // KnownDataCollectionEndpointProvisioningStateSucceeded ... - KnownDataCollectionEndpointProvisioningStateSucceeded KnownDataCollectionEndpointProvisioningState = "Succeeded" - // KnownDataCollectionEndpointProvisioningStateUpdating ... - KnownDataCollectionEndpointProvisioningStateUpdating KnownDataCollectionEndpointProvisioningState = "Updating" -) - -// PossibleKnownDataCollectionEndpointProvisioningStateValues returns an array of possible values for the KnownDataCollectionEndpointProvisioningState const type. -func PossibleKnownDataCollectionEndpointProvisioningStateValues() []KnownDataCollectionEndpointProvisioningState { - return []KnownDataCollectionEndpointProvisioningState{KnownDataCollectionEndpointProvisioningStateCreating, KnownDataCollectionEndpointProvisioningStateDeleting, KnownDataCollectionEndpointProvisioningStateFailed, KnownDataCollectionEndpointProvisioningStateSucceeded, KnownDataCollectionEndpointProvisioningStateUpdating} -} - -// KnownDataCollectionEndpointResourceKind enumerates the values for known data collection endpoint resource -// kind. -type KnownDataCollectionEndpointResourceKind string - -const ( - // KnownDataCollectionEndpointResourceKindLinux ... - KnownDataCollectionEndpointResourceKindLinux KnownDataCollectionEndpointResourceKind = "Linux" - // KnownDataCollectionEndpointResourceKindWindows ... - KnownDataCollectionEndpointResourceKindWindows KnownDataCollectionEndpointResourceKind = "Windows" -) - -// PossibleKnownDataCollectionEndpointResourceKindValues returns an array of possible values for the KnownDataCollectionEndpointResourceKind const type. -func PossibleKnownDataCollectionEndpointResourceKindValues() []KnownDataCollectionEndpointResourceKind { - return []KnownDataCollectionEndpointResourceKind{KnownDataCollectionEndpointResourceKindLinux, KnownDataCollectionEndpointResourceKindWindows} -} - -// KnownDataCollectionRuleAssociationProvisioningState enumerates the values for known data collection rule -// association provisioning state. -type KnownDataCollectionRuleAssociationProvisioningState string - -const ( - // KnownDataCollectionRuleAssociationProvisioningStateCreating ... - KnownDataCollectionRuleAssociationProvisioningStateCreating KnownDataCollectionRuleAssociationProvisioningState = "Creating" - // KnownDataCollectionRuleAssociationProvisioningStateDeleting ... - KnownDataCollectionRuleAssociationProvisioningStateDeleting KnownDataCollectionRuleAssociationProvisioningState = "Deleting" - // KnownDataCollectionRuleAssociationProvisioningStateFailed ... - KnownDataCollectionRuleAssociationProvisioningStateFailed KnownDataCollectionRuleAssociationProvisioningState = "Failed" - // KnownDataCollectionRuleAssociationProvisioningStateSucceeded ... - KnownDataCollectionRuleAssociationProvisioningStateSucceeded KnownDataCollectionRuleAssociationProvisioningState = "Succeeded" - // KnownDataCollectionRuleAssociationProvisioningStateUpdating ... - KnownDataCollectionRuleAssociationProvisioningStateUpdating KnownDataCollectionRuleAssociationProvisioningState = "Updating" -) - -// PossibleKnownDataCollectionRuleAssociationProvisioningStateValues returns an array of possible values for the KnownDataCollectionRuleAssociationProvisioningState const type. -func PossibleKnownDataCollectionRuleAssociationProvisioningStateValues() []KnownDataCollectionRuleAssociationProvisioningState { - return []KnownDataCollectionRuleAssociationProvisioningState{KnownDataCollectionRuleAssociationProvisioningStateCreating, KnownDataCollectionRuleAssociationProvisioningStateDeleting, KnownDataCollectionRuleAssociationProvisioningStateFailed, KnownDataCollectionRuleAssociationProvisioningStateSucceeded, KnownDataCollectionRuleAssociationProvisioningStateUpdating} -} - -// KnownDataCollectionRuleProvisioningState enumerates the values for known data collection rule provisioning -// state. -type KnownDataCollectionRuleProvisioningState string - -const ( - // KnownDataCollectionRuleProvisioningStateCreating ... - KnownDataCollectionRuleProvisioningStateCreating KnownDataCollectionRuleProvisioningState = "Creating" - // KnownDataCollectionRuleProvisioningStateDeleting ... - KnownDataCollectionRuleProvisioningStateDeleting KnownDataCollectionRuleProvisioningState = "Deleting" - // KnownDataCollectionRuleProvisioningStateFailed ... - KnownDataCollectionRuleProvisioningStateFailed KnownDataCollectionRuleProvisioningState = "Failed" - // KnownDataCollectionRuleProvisioningStateSucceeded ... - KnownDataCollectionRuleProvisioningStateSucceeded KnownDataCollectionRuleProvisioningState = "Succeeded" - // KnownDataCollectionRuleProvisioningStateUpdating ... - KnownDataCollectionRuleProvisioningStateUpdating KnownDataCollectionRuleProvisioningState = "Updating" -) - -// PossibleKnownDataCollectionRuleProvisioningStateValues returns an array of possible values for the KnownDataCollectionRuleProvisioningState const type. -func PossibleKnownDataCollectionRuleProvisioningStateValues() []KnownDataCollectionRuleProvisioningState { - return []KnownDataCollectionRuleProvisioningState{KnownDataCollectionRuleProvisioningStateCreating, KnownDataCollectionRuleProvisioningStateDeleting, KnownDataCollectionRuleProvisioningStateFailed, KnownDataCollectionRuleProvisioningStateSucceeded, KnownDataCollectionRuleProvisioningStateUpdating} -} - -// KnownDataCollectionRuleResourceKind enumerates the values for known data collection rule resource kind. -type KnownDataCollectionRuleResourceKind string - -const ( - // KnownDataCollectionRuleResourceKindLinux ... - KnownDataCollectionRuleResourceKindLinux KnownDataCollectionRuleResourceKind = "Linux" - // KnownDataCollectionRuleResourceKindWindows ... - KnownDataCollectionRuleResourceKindWindows KnownDataCollectionRuleResourceKind = "Windows" -) - -// PossibleKnownDataCollectionRuleResourceKindValues returns an array of possible values for the KnownDataCollectionRuleResourceKind const type. -func PossibleKnownDataCollectionRuleResourceKindValues() []KnownDataCollectionRuleResourceKind { - return []KnownDataCollectionRuleResourceKind{KnownDataCollectionRuleResourceKindLinux, KnownDataCollectionRuleResourceKindWindows} -} - -// KnownDataFlowStreams enumerates the values for known data flow streams. -type KnownDataFlowStreams string - -const ( - // KnownDataFlowStreamsMicrosoftEvent ... - KnownDataFlowStreamsMicrosoftEvent KnownDataFlowStreams = "Microsoft-Event" - // KnownDataFlowStreamsMicrosoftInsightsMetrics ... - KnownDataFlowStreamsMicrosoftInsightsMetrics KnownDataFlowStreams = "Microsoft-InsightsMetrics" - // KnownDataFlowStreamsMicrosoftPerf ... - KnownDataFlowStreamsMicrosoftPerf KnownDataFlowStreams = "Microsoft-Perf" - // KnownDataFlowStreamsMicrosoftSyslog ... - KnownDataFlowStreamsMicrosoftSyslog KnownDataFlowStreams = "Microsoft-Syslog" - // KnownDataFlowStreamsMicrosoftWindowsEvent ... - KnownDataFlowStreamsMicrosoftWindowsEvent KnownDataFlowStreams = "Microsoft-WindowsEvent" -) - -// PossibleKnownDataFlowStreamsValues returns an array of possible values for the KnownDataFlowStreams const type. -func PossibleKnownDataFlowStreamsValues() []KnownDataFlowStreams { - return []KnownDataFlowStreams{KnownDataFlowStreamsMicrosoftEvent, KnownDataFlowStreamsMicrosoftInsightsMetrics, KnownDataFlowStreamsMicrosoftPerf, KnownDataFlowStreamsMicrosoftSyslog, KnownDataFlowStreamsMicrosoftWindowsEvent} -} - -// KnownExtensionDataSourceStreams enumerates the values for known extension data source streams. -type KnownExtensionDataSourceStreams string - -const ( - // KnownExtensionDataSourceStreamsMicrosoftEvent ... - KnownExtensionDataSourceStreamsMicrosoftEvent KnownExtensionDataSourceStreams = "Microsoft-Event" - // KnownExtensionDataSourceStreamsMicrosoftInsightsMetrics ... - KnownExtensionDataSourceStreamsMicrosoftInsightsMetrics KnownExtensionDataSourceStreams = "Microsoft-InsightsMetrics" - // KnownExtensionDataSourceStreamsMicrosoftPerf ... - KnownExtensionDataSourceStreamsMicrosoftPerf KnownExtensionDataSourceStreams = "Microsoft-Perf" - // KnownExtensionDataSourceStreamsMicrosoftSyslog ... - KnownExtensionDataSourceStreamsMicrosoftSyslog KnownExtensionDataSourceStreams = "Microsoft-Syslog" - // KnownExtensionDataSourceStreamsMicrosoftWindowsEvent ... - KnownExtensionDataSourceStreamsMicrosoftWindowsEvent KnownExtensionDataSourceStreams = "Microsoft-WindowsEvent" -) - -// PossibleKnownExtensionDataSourceStreamsValues returns an array of possible values for the KnownExtensionDataSourceStreams const type. -func PossibleKnownExtensionDataSourceStreamsValues() []KnownExtensionDataSourceStreams { - return []KnownExtensionDataSourceStreams{KnownExtensionDataSourceStreamsMicrosoftEvent, KnownExtensionDataSourceStreamsMicrosoftInsightsMetrics, KnownExtensionDataSourceStreamsMicrosoftPerf, KnownExtensionDataSourceStreamsMicrosoftSyslog, KnownExtensionDataSourceStreamsMicrosoftWindowsEvent} -} - -// KnownPerfCounterDataSourceStreams enumerates the values for known perf counter data source streams. -type KnownPerfCounterDataSourceStreams string - -const ( - // KnownPerfCounterDataSourceStreamsMicrosoftInsightsMetrics ... - KnownPerfCounterDataSourceStreamsMicrosoftInsightsMetrics KnownPerfCounterDataSourceStreams = "Microsoft-InsightsMetrics" - // KnownPerfCounterDataSourceStreamsMicrosoftPerf ... - KnownPerfCounterDataSourceStreamsMicrosoftPerf KnownPerfCounterDataSourceStreams = "Microsoft-Perf" -) - -// PossibleKnownPerfCounterDataSourceStreamsValues returns an array of possible values for the KnownPerfCounterDataSourceStreams const type. -func PossibleKnownPerfCounterDataSourceStreamsValues() []KnownPerfCounterDataSourceStreams { - return []KnownPerfCounterDataSourceStreams{KnownPerfCounterDataSourceStreamsMicrosoftInsightsMetrics, KnownPerfCounterDataSourceStreamsMicrosoftPerf} -} - -// KnownPublicNetworkAccessOptions enumerates the values for known public network access options. -type KnownPublicNetworkAccessOptions string - -const ( - // KnownPublicNetworkAccessOptionsDisabled ... - KnownPublicNetworkAccessOptionsDisabled KnownPublicNetworkAccessOptions = "Disabled" - // KnownPublicNetworkAccessOptionsEnabled ... - KnownPublicNetworkAccessOptionsEnabled KnownPublicNetworkAccessOptions = "Enabled" -) - -// PossibleKnownPublicNetworkAccessOptionsValues returns an array of possible values for the KnownPublicNetworkAccessOptions const type. -func PossibleKnownPublicNetworkAccessOptionsValues() []KnownPublicNetworkAccessOptions { - return []KnownPublicNetworkAccessOptions{KnownPublicNetworkAccessOptionsDisabled, KnownPublicNetworkAccessOptionsEnabled} -} - -// KnownSyslogDataSourceFacilityNames enumerates the values for known syslog data source facility names. -type KnownSyslogDataSourceFacilityNames string - -const ( - // KnownSyslogDataSourceFacilityNamesAsterisk ... - KnownSyslogDataSourceFacilityNamesAsterisk KnownSyslogDataSourceFacilityNames = "*" - // KnownSyslogDataSourceFacilityNamesAuth ... - KnownSyslogDataSourceFacilityNamesAuth KnownSyslogDataSourceFacilityNames = "auth" - // KnownSyslogDataSourceFacilityNamesAuthpriv ... - KnownSyslogDataSourceFacilityNamesAuthpriv KnownSyslogDataSourceFacilityNames = "authpriv" - // KnownSyslogDataSourceFacilityNamesCron ... - KnownSyslogDataSourceFacilityNamesCron KnownSyslogDataSourceFacilityNames = "cron" - // KnownSyslogDataSourceFacilityNamesDaemon ... - KnownSyslogDataSourceFacilityNamesDaemon KnownSyslogDataSourceFacilityNames = "daemon" - // KnownSyslogDataSourceFacilityNamesKern ... - KnownSyslogDataSourceFacilityNamesKern KnownSyslogDataSourceFacilityNames = "kern" - // KnownSyslogDataSourceFacilityNamesLocal0 ... - KnownSyslogDataSourceFacilityNamesLocal0 KnownSyslogDataSourceFacilityNames = "local0" - // KnownSyslogDataSourceFacilityNamesLocal1 ... - KnownSyslogDataSourceFacilityNamesLocal1 KnownSyslogDataSourceFacilityNames = "local1" - // KnownSyslogDataSourceFacilityNamesLocal2 ... - KnownSyslogDataSourceFacilityNamesLocal2 KnownSyslogDataSourceFacilityNames = "local2" - // KnownSyslogDataSourceFacilityNamesLocal3 ... - KnownSyslogDataSourceFacilityNamesLocal3 KnownSyslogDataSourceFacilityNames = "local3" - // KnownSyslogDataSourceFacilityNamesLocal4 ... - KnownSyslogDataSourceFacilityNamesLocal4 KnownSyslogDataSourceFacilityNames = "local4" - // KnownSyslogDataSourceFacilityNamesLocal5 ... - KnownSyslogDataSourceFacilityNamesLocal5 KnownSyslogDataSourceFacilityNames = "local5" - // KnownSyslogDataSourceFacilityNamesLocal6 ... - KnownSyslogDataSourceFacilityNamesLocal6 KnownSyslogDataSourceFacilityNames = "local6" - // KnownSyslogDataSourceFacilityNamesLocal7 ... - KnownSyslogDataSourceFacilityNamesLocal7 KnownSyslogDataSourceFacilityNames = "local7" - // KnownSyslogDataSourceFacilityNamesLpr ... - KnownSyslogDataSourceFacilityNamesLpr KnownSyslogDataSourceFacilityNames = "lpr" - // KnownSyslogDataSourceFacilityNamesMail ... - KnownSyslogDataSourceFacilityNamesMail KnownSyslogDataSourceFacilityNames = "mail" - // KnownSyslogDataSourceFacilityNamesMark ... - KnownSyslogDataSourceFacilityNamesMark KnownSyslogDataSourceFacilityNames = "mark" - // KnownSyslogDataSourceFacilityNamesNews ... - KnownSyslogDataSourceFacilityNamesNews KnownSyslogDataSourceFacilityNames = "news" - // KnownSyslogDataSourceFacilityNamesSyslog ... - KnownSyslogDataSourceFacilityNamesSyslog KnownSyslogDataSourceFacilityNames = "syslog" - // KnownSyslogDataSourceFacilityNamesUser ... - KnownSyslogDataSourceFacilityNamesUser KnownSyslogDataSourceFacilityNames = "user" - // KnownSyslogDataSourceFacilityNamesUucp ... - KnownSyslogDataSourceFacilityNamesUucp KnownSyslogDataSourceFacilityNames = "uucp" -) - -// PossibleKnownSyslogDataSourceFacilityNamesValues returns an array of possible values for the KnownSyslogDataSourceFacilityNames const type. -func PossibleKnownSyslogDataSourceFacilityNamesValues() []KnownSyslogDataSourceFacilityNames { - return []KnownSyslogDataSourceFacilityNames{KnownSyslogDataSourceFacilityNamesAsterisk, KnownSyslogDataSourceFacilityNamesAuth, KnownSyslogDataSourceFacilityNamesAuthpriv, KnownSyslogDataSourceFacilityNamesCron, KnownSyslogDataSourceFacilityNamesDaemon, KnownSyslogDataSourceFacilityNamesKern, KnownSyslogDataSourceFacilityNamesLocal0, KnownSyslogDataSourceFacilityNamesLocal1, KnownSyslogDataSourceFacilityNamesLocal2, KnownSyslogDataSourceFacilityNamesLocal3, KnownSyslogDataSourceFacilityNamesLocal4, KnownSyslogDataSourceFacilityNamesLocal5, KnownSyslogDataSourceFacilityNamesLocal6, KnownSyslogDataSourceFacilityNamesLocal7, KnownSyslogDataSourceFacilityNamesLpr, KnownSyslogDataSourceFacilityNamesMail, KnownSyslogDataSourceFacilityNamesMark, KnownSyslogDataSourceFacilityNamesNews, KnownSyslogDataSourceFacilityNamesSyslog, KnownSyslogDataSourceFacilityNamesUser, KnownSyslogDataSourceFacilityNamesUucp} -} - -// KnownSyslogDataSourceLogLevels enumerates the values for known syslog data source log levels. -type KnownSyslogDataSourceLogLevels string - -const ( - // KnownSyslogDataSourceLogLevelsAlert ... - KnownSyslogDataSourceLogLevelsAlert KnownSyslogDataSourceLogLevels = "Alert" - // KnownSyslogDataSourceLogLevelsAsterisk ... - KnownSyslogDataSourceLogLevelsAsterisk KnownSyslogDataSourceLogLevels = "*" - // KnownSyslogDataSourceLogLevelsCritical ... - KnownSyslogDataSourceLogLevelsCritical KnownSyslogDataSourceLogLevels = "Critical" - // KnownSyslogDataSourceLogLevelsDebug ... - KnownSyslogDataSourceLogLevelsDebug KnownSyslogDataSourceLogLevels = "Debug" - // KnownSyslogDataSourceLogLevelsEmergency ... - KnownSyslogDataSourceLogLevelsEmergency KnownSyslogDataSourceLogLevels = "Emergency" - // KnownSyslogDataSourceLogLevelsError ... - KnownSyslogDataSourceLogLevelsError KnownSyslogDataSourceLogLevels = "Error" - // KnownSyslogDataSourceLogLevelsInfo ... - KnownSyslogDataSourceLogLevelsInfo KnownSyslogDataSourceLogLevels = "Info" - // KnownSyslogDataSourceLogLevelsNotice ... - KnownSyslogDataSourceLogLevelsNotice KnownSyslogDataSourceLogLevels = "Notice" - // KnownSyslogDataSourceLogLevelsWarning ... - KnownSyslogDataSourceLogLevelsWarning KnownSyslogDataSourceLogLevels = "Warning" -) - -// PossibleKnownSyslogDataSourceLogLevelsValues returns an array of possible values for the KnownSyslogDataSourceLogLevels const type. -func PossibleKnownSyslogDataSourceLogLevelsValues() []KnownSyslogDataSourceLogLevels { - return []KnownSyslogDataSourceLogLevels{KnownSyslogDataSourceLogLevelsAlert, KnownSyslogDataSourceLogLevelsAsterisk, KnownSyslogDataSourceLogLevelsCritical, KnownSyslogDataSourceLogLevelsDebug, KnownSyslogDataSourceLogLevelsEmergency, KnownSyslogDataSourceLogLevelsError, KnownSyslogDataSourceLogLevelsInfo, KnownSyslogDataSourceLogLevelsNotice, KnownSyslogDataSourceLogLevelsWarning} -} - -// KnownSyslogDataSourceStreams enumerates the values for known syslog data source streams. -type KnownSyslogDataSourceStreams string - -const ( - // KnownSyslogDataSourceStreamsMicrosoftSyslog ... - KnownSyslogDataSourceStreamsMicrosoftSyslog KnownSyslogDataSourceStreams = "Microsoft-Syslog" -) - -// PossibleKnownSyslogDataSourceStreamsValues returns an array of possible values for the KnownSyslogDataSourceStreams const type. -func PossibleKnownSyslogDataSourceStreamsValues() []KnownSyslogDataSourceStreams { - return []KnownSyslogDataSourceStreams{KnownSyslogDataSourceStreamsMicrosoftSyslog} -} - -// KnownWindowsEventLogDataSourceStreams enumerates the values for known windows event log data source streams. -type KnownWindowsEventLogDataSourceStreams string - -const ( - // KnownWindowsEventLogDataSourceStreamsMicrosoftEvent ... - KnownWindowsEventLogDataSourceStreamsMicrosoftEvent KnownWindowsEventLogDataSourceStreams = "Microsoft-Event" - // KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent ... - KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent KnownWindowsEventLogDataSourceStreams = "Microsoft-WindowsEvent" -) - -// PossibleKnownWindowsEventLogDataSourceStreamsValues returns an array of possible values for the KnownWindowsEventLogDataSourceStreams const type. -func PossibleKnownWindowsEventLogDataSourceStreamsValues() []KnownWindowsEventLogDataSourceStreams { - return []KnownWindowsEventLogDataSourceStreams{KnownWindowsEventLogDataSourceStreamsMicrosoftEvent, KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent} -} - -// MetricClass enumerates the values for metric class. -type MetricClass string - -const ( - // MetricClassAvailability ... - MetricClassAvailability MetricClass = "Availability" - // MetricClassErrors ... - MetricClassErrors MetricClass = "Errors" - // MetricClassLatency ... - MetricClassLatency MetricClass = "Latency" - // MetricClassSaturation ... - MetricClassSaturation MetricClass = "Saturation" - // MetricClassTransactions ... - MetricClassTransactions MetricClass = "Transactions" -) - -// PossibleMetricClassValues returns an array of possible values for the MetricClass const type. -func PossibleMetricClassValues() []MetricClass { - return []MetricClass{MetricClassAvailability, MetricClassErrors, MetricClassLatency, MetricClassSaturation, MetricClassTransactions} -} - -// MetricStatisticType enumerates the values for metric statistic type. -type MetricStatisticType string - -const ( - // MetricStatisticTypeAverage ... - MetricStatisticTypeAverage MetricStatisticType = "Average" - // MetricStatisticTypeMax ... - MetricStatisticTypeMax MetricStatisticType = "Max" - // MetricStatisticTypeMin ... - MetricStatisticTypeMin MetricStatisticType = "Min" - // MetricStatisticTypeSum ... - MetricStatisticTypeSum MetricStatisticType = "Sum" -) - -// PossibleMetricStatisticTypeValues returns an array of possible values for the MetricStatisticType const type. -func PossibleMetricStatisticTypeValues() []MetricStatisticType { - return []MetricStatisticType{MetricStatisticTypeAverage, MetricStatisticTypeMax, MetricStatisticTypeMin, MetricStatisticTypeSum} -} - -// MetricTriggerType enumerates the values for metric trigger type. -type MetricTriggerType string - -const ( - // MetricTriggerTypeConsecutive ... - MetricTriggerTypeConsecutive MetricTriggerType = "Consecutive" - // MetricTriggerTypeTotal ... - MetricTriggerTypeTotal MetricTriggerType = "Total" -) - -// PossibleMetricTriggerTypeValues returns an array of possible values for the MetricTriggerType const type. -func PossibleMetricTriggerTypeValues() []MetricTriggerType { - return []MetricTriggerType{MetricTriggerTypeConsecutive, MetricTriggerTypeTotal} -} - -// MetricUnit enumerates the values for metric unit. -type MetricUnit string - -const ( - // MetricUnitBitsPerSecond ... - MetricUnitBitsPerSecond MetricUnit = "BitsPerSecond" - // MetricUnitBytes ... - MetricUnitBytes MetricUnit = "Bytes" - // MetricUnitByteSeconds ... - MetricUnitByteSeconds MetricUnit = "ByteSeconds" - // MetricUnitBytesPerSecond ... - MetricUnitBytesPerSecond MetricUnit = "BytesPerSecond" - // MetricUnitCores ... - MetricUnitCores MetricUnit = "Cores" - // MetricUnitCount ... - MetricUnitCount MetricUnit = "Count" - // MetricUnitCountPerSecond ... - MetricUnitCountPerSecond MetricUnit = "CountPerSecond" - // MetricUnitMilliCores ... - MetricUnitMilliCores MetricUnit = "MilliCores" - // MetricUnitMilliSeconds ... - MetricUnitMilliSeconds MetricUnit = "MilliSeconds" - // MetricUnitNanoCores ... - MetricUnitNanoCores MetricUnit = "NanoCores" - // MetricUnitPercent ... - MetricUnitPercent MetricUnit = "Percent" - // MetricUnitSeconds ... - MetricUnitSeconds MetricUnit = "Seconds" - // MetricUnitUnspecified ... - MetricUnitUnspecified MetricUnit = "Unspecified" -) - -// PossibleMetricUnitValues returns an array of possible values for the MetricUnit const type. -func PossibleMetricUnitValues() []MetricUnit { - return []MetricUnit{MetricUnitBitsPerSecond, MetricUnitBytes, MetricUnitByteSeconds, MetricUnitBytesPerSecond, MetricUnitCores, MetricUnitCount, MetricUnitCountPerSecond, MetricUnitMilliCores, MetricUnitMilliSeconds, MetricUnitNanoCores, MetricUnitPercent, MetricUnitSeconds, MetricUnitUnspecified} -} - -// NamespaceClassification enumerates the values for namespace classification. -type NamespaceClassification string - -const ( - // NamespaceClassificationCustom ... - NamespaceClassificationCustom NamespaceClassification = "Custom" - // NamespaceClassificationPlatform ... - NamespaceClassificationPlatform NamespaceClassification = "Platform" - // NamespaceClassificationQos ... - NamespaceClassificationQos NamespaceClassification = "Qos" -) - -// PossibleNamespaceClassificationValues returns an array of possible values for the NamespaceClassification const type. -func PossibleNamespaceClassificationValues() []NamespaceClassification { - return []NamespaceClassification{NamespaceClassificationCustom, NamespaceClassificationPlatform, NamespaceClassificationQos} -} - -// OdataType enumerates the values for odata type. -type OdataType string - -const ( - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource" - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource" - // OdataTypeRuleDataSource ... - OdataTypeRuleDataSource OdataType = "RuleDataSource" -) - -// PossibleOdataTypeValues returns an array of possible values for the OdataType const type. -func PossibleOdataTypeValues() []OdataType { - return []OdataType{OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource, OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource, OdataTypeRuleDataSource} -} - -// OdataTypeBasicAction enumerates the values for odata type basic action. -type OdataTypeBasicAction string - -const ( - // OdataTypeBasicActionOdataTypeAction ... - OdataTypeBasicActionOdataTypeAction OdataTypeBasicAction = "Action" - // OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction ... - OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction OdataTypeBasicAction = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction" - // OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction ... - OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction OdataTypeBasicAction = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction" -) - -// PossibleOdataTypeBasicActionValues returns an array of possible values for the OdataTypeBasicAction const type. -func PossibleOdataTypeBasicActionValues() []OdataTypeBasicAction { - return []OdataTypeBasicAction{OdataTypeBasicActionOdataTypeAction, OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction, OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction} -} - -// OdataTypeBasicMetricAlertCriteria enumerates the values for odata type basic metric alert criteria. -type OdataTypeBasicMetricAlertCriteria string - -const ( - // OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria ... - OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria OdataTypeBasicMetricAlertCriteria = "MetricAlertCriteria" - // OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria ... - OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria OdataTypeBasicMetricAlertCriteria = "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria" - // OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria ... - OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria OdataTypeBasicMetricAlertCriteria = "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria" - // OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria ... - OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria OdataTypeBasicMetricAlertCriteria = "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria" -) - -// PossibleOdataTypeBasicMetricAlertCriteriaValues returns an array of possible values for the OdataTypeBasicMetricAlertCriteria const type. -func PossibleOdataTypeBasicMetricAlertCriteriaValues() []OdataTypeBasicMetricAlertCriteria { - return []OdataTypeBasicMetricAlertCriteria{OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria, OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria, OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria, OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria} -} - -// OdataTypeBasicRuleAction enumerates the values for odata type basic rule action. -type OdataTypeBasicRuleAction string - -const ( - // OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction ... - OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleEmailAction" - // OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction ... - OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction" - // OdataTypeBasicRuleActionOdataTypeRuleAction ... - OdataTypeBasicRuleActionOdataTypeRuleAction OdataTypeBasicRuleAction = "RuleAction" -) - -// PossibleOdataTypeBasicRuleActionValues returns an array of possible values for the OdataTypeBasicRuleAction const type. -func PossibleOdataTypeBasicRuleActionValues() []OdataTypeBasicRuleAction { - return []OdataTypeBasicRuleAction{OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction, OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction, OdataTypeBasicRuleActionOdataTypeRuleAction} -} - -// OdataTypeBasicRuleCondition enumerates the values for odata type basic rule condition. -type OdataTypeBasicRuleCondition string - -const ( - // OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition ... - OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition" - // OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition ... - OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition" - // OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition ... - OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition" - // OdataTypeBasicRuleConditionOdataTypeRuleCondition ... - OdataTypeBasicRuleConditionOdataTypeRuleCondition OdataTypeBasicRuleCondition = "RuleCondition" -) - -// PossibleOdataTypeBasicRuleConditionValues returns an array of possible values for the OdataTypeBasicRuleCondition const type. -func PossibleOdataTypeBasicRuleConditionValues() []OdataTypeBasicRuleCondition { - return []OdataTypeBasicRuleCondition{OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition, OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition, OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition, OdataTypeBasicRuleConditionOdataTypeRuleCondition} -} - -// OnboardingStatus enumerates the values for onboarding status. -type OnboardingStatus string - -const ( - // OnboardingStatusNotOnboarded ... - OnboardingStatusNotOnboarded OnboardingStatus = "notOnboarded" - // OnboardingStatusOnboarded ... - OnboardingStatusOnboarded OnboardingStatus = "onboarded" - // OnboardingStatusUnknown ... - OnboardingStatusUnknown OnboardingStatus = "unknown" -) - -// PossibleOnboardingStatusValues returns an array of possible values for the OnboardingStatus const type. -func PossibleOnboardingStatusValues() []OnboardingStatus { - return []OnboardingStatus{OnboardingStatusNotOnboarded, OnboardingStatusOnboarded, OnboardingStatusUnknown} -} - -// Operator enumerates the values for operator. -type Operator string - -const ( - // OperatorEquals ... - OperatorEquals Operator = "Equals" - // OperatorGreaterThan ... - OperatorGreaterThan Operator = "GreaterThan" - // OperatorGreaterThanOrEqual ... - OperatorGreaterThanOrEqual Operator = "GreaterThanOrEqual" - // OperatorLessThan ... - OperatorLessThan Operator = "LessThan" - // OperatorLessThanOrEqual ... - OperatorLessThanOrEqual Operator = "LessThanOrEqual" - // OperatorNotEquals ... - OperatorNotEquals Operator = "NotEquals" -) - -// PossibleOperatorValues returns an array of possible values for the Operator const type. -func PossibleOperatorValues() []Operator { - return []Operator{OperatorEquals, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorLessThan, OperatorLessThanOrEqual, OperatorNotEquals} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateCanceled ... - ProvisioningStateCanceled ProvisioningState = "Canceled" - // ProvisioningStateDeploying ... - ProvisioningStateDeploying ProvisioningState = "Deploying" - // ProvisioningStateFailed ... - ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateSucceeded ... - ProvisioningStateSucceeded ProvisioningState = "Succeeded" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateCanceled, ProvisioningStateDeploying, ProvisioningStateFailed, ProvisioningStateSucceeded} -} - -// QueryType enumerates the values for query type. -type QueryType string - -const ( - // QueryTypeResultCount ... - QueryTypeResultCount QueryType = "ResultCount" -) - -// PossibleQueryTypeValues returns an array of possible values for the QueryType const type. -func PossibleQueryTypeValues() []QueryType { - return []QueryType{QueryTypeResultCount} -} - -// ReceiverStatus enumerates the values for receiver status. -type ReceiverStatus string - -const ( - // ReceiverStatusDisabled ... - ReceiverStatusDisabled ReceiverStatus = "Disabled" - // ReceiverStatusEnabled ... - ReceiverStatusEnabled ReceiverStatus = "Enabled" - // ReceiverStatusNotSpecified ... - ReceiverStatusNotSpecified ReceiverStatus = "NotSpecified" -) - -// PossibleReceiverStatusValues returns an array of possible values for the ReceiverStatus const type. -func PossibleReceiverStatusValues() []ReceiverStatus { - return []ReceiverStatus{ReceiverStatusDisabled, ReceiverStatusEnabled, ReceiverStatusNotSpecified} -} - -// RecurrenceFrequency enumerates the values for recurrence frequency. -type RecurrenceFrequency string - -const ( - // RecurrenceFrequencyDay ... - RecurrenceFrequencyDay RecurrenceFrequency = "Day" - // RecurrenceFrequencyHour ... - RecurrenceFrequencyHour RecurrenceFrequency = "Hour" - // RecurrenceFrequencyMinute ... - RecurrenceFrequencyMinute RecurrenceFrequency = "Minute" - // RecurrenceFrequencyMonth ... - RecurrenceFrequencyMonth RecurrenceFrequency = "Month" - // RecurrenceFrequencyNone ... - RecurrenceFrequencyNone RecurrenceFrequency = "None" - // RecurrenceFrequencySecond ... - RecurrenceFrequencySecond RecurrenceFrequency = "Second" - // RecurrenceFrequencyWeek ... - RecurrenceFrequencyWeek RecurrenceFrequency = "Week" - // RecurrenceFrequencyYear ... - RecurrenceFrequencyYear RecurrenceFrequency = "Year" -) - -// PossibleRecurrenceFrequencyValues returns an array of possible values for the RecurrenceFrequency const type. -func PossibleRecurrenceFrequencyValues() []RecurrenceFrequency { - return []RecurrenceFrequency{RecurrenceFrequencyDay, RecurrenceFrequencyHour, RecurrenceFrequencyMinute, RecurrenceFrequencyMonth, RecurrenceFrequencyNone, RecurrenceFrequencySecond, RecurrenceFrequencyWeek, RecurrenceFrequencyYear} -} - -// ResultType enumerates the values for result type. -type ResultType string - -const ( - // ResultTypeData ... - ResultTypeData ResultType = "Data" - // ResultTypeMetadata ... - ResultTypeMetadata ResultType = "Metadata" -) - -// PossibleResultTypeValues returns an array of possible values for the ResultType const type. -func PossibleResultTypeValues() []ResultType { - return []ResultType{ResultTypeData, ResultTypeMetadata} -} - -// ScaleDirection enumerates the values for scale direction. -type ScaleDirection string - -const ( - // ScaleDirectionDecrease ... - ScaleDirectionDecrease ScaleDirection = "Decrease" - // ScaleDirectionIncrease ... - ScaleDirectionIncrease ScaleDirection = "Increase" - // ScaleDirectionNone ... - ScaleDirectionNone ScaleDirection = "None" -) - -// PossibleScaleDirectionValues returns an array of possible values for the ScaleDirection const type. -func PossibleScaleDirectionValues() []ScaleDirection { - return []ScaleDirection{ScaleDirectionDecrease, ScaleDirectionIncrease, ScaleDirectionNone} -} - -// ScaleRuleMetricDimensionOperationType enumerates the values for scale rule metric dimension operation type. -type ScaleRuleMetricDimensionOperationType string - -const ( - // ScaleRuleMetricDimensionOperationTypeEquals ... - ScaleRuleMetricDimensionOperationTypeEquals ScaleRuleMetricDimensionOperationType = "Equals" - // ScaleRuleMetricDimensionOperationTypeNotEquals ... - ScaleRuleMetricDimensionOperationTypeNotEquals ScaleRuleMetricDimensionOperationType = "NotEquals" -) - -// PossibleScaleRuleMetricDimensionOperationTypeValues returns an array of possible values for the ScaleRuleMetricDimensionOperationType const type. -func PossibleScaleRuleMetricDimensionOperationTypeValues() []ScaleRuleMetricDimensionOperationType { - return []ScaleRuleMetricDimensionOperationType{ScaleRuleMetricDimensionOperationTypeEquals, ScaleRuleMetricDimensionOperationTypeNotEquals} -} - -// ScaleType enumerates the values for scale type. -type ScaleType string - -const ( - // ScaleTypeChangeCount ... - ScaleTypeChangeCount ScaleType = "ChangeCount" - // ScaleTypeExactCount ... - ScaleTypeExactCount ScaleType = "ExactCount" - // ScaleTypePercentChangeCount ... - ScaleTypePercentChangeCount ScaleType = "PercentChangeCount" -) - -// PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. -func PossibleScaleTypeValues() []ScaleType { - return []ScaleType{ScaleTypeChangeCount, ScaleTypeExactCount, ScaleTypePercentChangeCount} -} - -// TimeAggregationOperator enumerates the values for time aggregation operator. -type TimeAggregationOperator string - -const ( - // TimeAggregationOperatorAverage ... - TimeAggregationOperatorAverage TimeAggregationOperator = "Average" - // TimeAggregationOperatorLast ... - TimeAggregationOperatorLast TimeAggregationOperator = "Last" - // TimeAggregationOperatorMaximum ... - TimeAggregationOperatorMaximum TimeAggregationOperator = "Maximum" - // TimeAggregationOperatorMinimum ... - TimeAggregationOperatorMinimum TimeAggregationOperator = "Minimum" - // TimeAggregationOperatorTotal ... - TimeAggregationOperatorTotal TimeAggregationOperator = "Total" -) - -// PossibleTimeAggregationOperatorValues returns an array of possible values for the TimeAggregationOperator const type. -func PossibleTimeAggregationOperatorValues() []TimeAggregationOperator { - return []TimeAggregationOperator{TimeAggregationOperatorAverage, TimeAggregationOperatorLast, TimeAggregationOperatorMaximum, TimeAggregationOperatorMinimum, TimeAggregationOperatorTotal} -} - -// TimeAggregationType enumerates the values for time aggregation type. -type TimeAggregationType string - -const ( - // TimeAggregationTypeAverage ... - TimeAggregationTypeAverage TimeAggregationType = "Average" - // TimeAggregationTypeCount ... - TimeAggregationTypeCount TimeAggregationType = "Count" - // TimeAggregationTypeLast ... - TimeAggregationTypeLast TimeAggregationType = "Last" - // TimeAggregationTypeMaximum ... - TimeAggregationTypeMaximum TimeAggregationType = "Maximum" - // TimeAggregationTypeMinimum ... - TimeAggregationTypeMinimum TimeAggregationType = "Minimum" - // TimeAggregationTypeTotal ... - TimeAggregationTypeTotal TimeAggregationType = "Total" -) - -// PossibleTimeAggregationTypeValues returns an array of possible values for the TimeAggregationType const type. -func PossibleTimeAggregationTypeValues() []TimeAggregationType { - return []TimeAggregationType{TimeAggregationTypeAverage, TimeAggregationTypeCount, TimeAggregationTypeLast, TimeAggregationTypeMaximum, TimeAggregationTypeMinimum, TimeAggregationTypeTotal} -} diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/insightsapi/interfaces.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/insightsapi/interfaces.go deleted file mode 100644 index 88f2dd9222b8..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/insightsapi/interfaces.go +++ /dev/null @@ -1,291 +0,0 @@ -package insightsapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 ( - "context" - "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-04-01-preview/insights" - "github.com/Azure/go-autorest/autorest" -) - -// AutoscaleSettingsClientAPI contains the set of methods on the AutoscaleSettingsClient type. -type AutoscaleSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters insights.AutoscaleSettingResource) (result insights.AutoscaleSettingResource, err error) - Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result insights.AutoscaleSettingResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.AutoscaleSettingResourceCollectionPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result insights.AutoscaleSettingResourceCollectionIterator, err error) - ListBySubscription(ctx context.Context) (result insights.AutoscaleSettingResourceCollectionPage, err error) - ListBySubscriptionComplete(ctx context.Context) (result insights.AutoscaleSettingResourceCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource insights.AutoscaleSettingResourcePatch) (result insights.AutoscaleSettingResource, err error) -} - -var _ AutoscaleSettingsClientAPI = (*insights.AutoscaleSettingsClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result insights.OperationListResult, err error) -} - -var _ OperationsClientAPI = (*insights.OperationsClient)(nil) - -// AlertRuleIncidentsClientAPI contains the set of methods on the AlertRuleIncidentsClient type. -type AlertRuleIncidentsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result insights.Incident, err error) - ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result insights.IncidentListResult, err error) -} - -var _ AlertRuleIncidentsClientAPI = (*insights.AlertRuleIncidentsClient)(nil) - -// AlertRulesClientAPI contains the set of methods on the AlertRulesClient type. -type AlertRulesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.AlertRuleResource) (result insights.AlertRuleResource, err error) - Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, ruleName string) (result insights.AlertRuleResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.AlertRuleResourceCollection, err error) - ListBySubscription(ctx context.Context) (result insights.AlertRuleResourceCollection, err error) - Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource insights.AlertRuleResourcePatch) (result insights.AlertRuleResource, err error) -} - -var _ AlertRulesClientAPI = (*insights.AlertRulesClient)(nil) - -// LogProfilesClientAPI contains the set of methods on the LogProfilesClient type. -type LogProfilesClientAPI interface { - CreateOrUpdate(ctx context.Context, logProfileName string, parameters insights.LogProfileResource) (result insights.LogProfileResource, err error) - Delete(ctx context.Context, logProfileName string) (result autorest.Response, err error) - Get(ctx context.Context, logProfileName string) (result insights.LogProfileResource, err error) - List(ctx context.Context) (result insights.LogProfileCollection, err error) - Update(ctx context.Context, logProfileName string, logProfilesResource insights.LogProfileResourcePatch) (result insights.LogProfileResource, err error) -} - -var _ LogProfilesClientAPI = (*insights.LogProfilesClient)(nil) - -// DiagnosticSettingsClientAPI contains the set of methods on the DiagnosticSettingsClient type. -type DiagnosticSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceURI string, parameters insights.DiagnosticSettingsResource, name string) (result insights.DiagnosticSettingsResource, err error) - Delete(ctx context.Context, resourceURI string, name string) (result autorest.Response, err error) - Get(ctx context.Context, resourceURI string, name string) (result insights.DiagnosticSettingsResource, err error) - List(ctx context.Context, resourceURI string) (result insights.DiagnosticSettingsResourceCollection, err error) -} - -var _ DiagnosticSettingsClientAPI = (*insights.DiagnosticSettingsClient)(nil) - -// DiagnosticSettingsCategoryClientAPI contains the set of methods on the DiagnosticSettingsCategoryClient type. -type DiagnosticSettingsCategoryClientAPI interface { - Get(ctx context.Context, resourceURI string, name string) (result insights.DiagnosticSettingsCategoryResource, err error) - List(ctx context.Context, resourceURI string) (result insights.DiagnosticSettingsCategoryResourceCollection, err error) -} - -var _ DiagnosticSettingsCategoryClientAPI = (*insights.DiagnosticSettingsCategoryClient)(nil) - -// ActionGroupsClientAPI contains the set of methods on the ActionGroupsClient type. -type ActionGroupsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup insights.ActionGroupResource) (result insights.ActionGroupResource, err error) - Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) - EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest insights.EnableRequest) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result insights.ActionGroupResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.ActionGroupList, err error) - ListBySubscriptionID(ctx context.Context) (result insights.ActionGroupList, err error) - Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch insights.ActionGroupPatchBody) (result insights.ActionGroupResource, err error) -} - -var _ ActionGroupsClientAPI = (*insights.ActionGroupsClient)(nil) - -// ActivityLogsClientAPI contains the set of methods on the ActivityLogsClient type. -type ActivityLogsClientAPI interface { - List(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionPage, err error) - ListComplete(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionIterator, err error) -} - -var _ ActivityLogsClientAPI = (*insights.ActivityLogsClient)(nil) - -// EventCategoriesClientAPI contains the set of methods on the EventCategoriesClient type. -type EventCategoriesClientAPI interface { - List(ctx context.Context) (result insights.EventCategoryCollection, err error) -} - -var _ EventCategoriesClientAPI = (*insights.EventCategoriesClient)(nil) - -// TenantActivityLogsClientAPI contains the set of methods on the TenantActivityLogsClient type. -type TenantActivityLogsClientAPI interface { - List(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionPage, err error) - ListComplete(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionIterator, err error) -} - -var _ TenantActivityLogsClientAPI = (*insights.TenantActivityLogsClient)(nil) - -// MetricDefinitionsClientAPI contains the set of methods on the MetricDefinitionsClient type. -type MetricDefinitionsClientAPI interface { - List(ctx context.Context, resourceURI string, metricnamespace string) (result insights.MetricDefinitionCollection, err error) -} - -var _ MetricDefinitionsClientAPI = (*insights.MetricDefinitionsClient)(nil) - -// MetricsClientAPI contains the set of methods on the MetricsClient type. -type MetricsClientAPI interface { - List(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType insights.ResultType, metricnamespace string) (result insights.Response, err error) -} - -var _ MetricsClientAPI = (*insights.MetricsClient)(nil) - -// BaselinesClientAPI contains the set of methods on the BaselinesClient type. -type BaselinesClientAPI interface { - List(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType insights.ResultType) (result insights.MetricBaselinesResponse, err error) -} - -var _ BaselinesClientAPI = (*insights.BaselinesClient)(nil) - -// MetricAlertsClientAPI contains the set of methods on the MetricAlertsClient type. -type MetricAlertsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.MetricAlertResource) (result insights.MetricAlertResource, err error) - Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, ruleName string) (result insights.MetricAlertResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.MetricAlertResourceCollection, err error) - ListBySubscription(ctx context.Context) (result insights.MetricAlertResourceCollection, err error) - Update(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.MetricAlertResourcePatch) (result insights.MetricAlertResource, err error) -} - -var _ MetricAlertsClientAPI = (*insights.MetricAlertsClient)(nil) - -// MetricAlertsStatusClientAPI contains the set of methods on the MetricAlertsStatusClient type. -type MetricAlertsStatusClientAPI interface { - List(ctx context.Context, resourceGroupName string, ruleName string) (result insights.MetricAlertStatusCollection, err error) - ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (result insights.MetricAlertStatusCollection, err error) -} - -var _ MetricAlertsStatusClientAPI = (*insights.MetricAlertsStatusClient)(nil) - -// ScheduledQueryRulesClientAPI contains the set of methods on the ScheduledQueryRulesClient type. -type ScheduledQueryRulesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.LogSearchRuleResource) (result insights.LogSearchRuleResource, err error) - Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, ruleName string) (result insights.LogSearchRuleResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result insights.LogSearchRuleResourceCollection, err error) - ListBySubscription(ctx context.Context, filter string) (result insights.LogSearchRuleResourceCollection, err error) - Update(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.LogSearchRuleResourcePatch) (result insights.LogSearchRuleResource, err error) -} - -var _ ScheduledQueryRulesClientAPI = (*insights.ScheduledQueryRulesClient)(nil) - -// MetricNamespacesClientAPI contains the set of methods on the MetricNamespacesClient type. -type MetricNamespacesClientAPI interface { - List(ctx context.Context, resourceURI string, startTime string) (result insights.MetricNamespaceCollection, err error) -} - -var _ MetricNamespacesClientAPI = (*insights.MetricNamespacesClient)(nil) - -// VMInsightsClientAPI contains the set of methods on the VMInsightsClient type. -type VMInsightsClientAPI interface { - GetOnboardingStatus(ctx context.Context, resourceURI string) (result insights.VMInsightsOnboardingStatus, err error) -} - -var _ VMInsightsClientAPI = (*insights.VMInsightsClient)(nil) - -// PrivateLinkScopesClientAPI contains the set of methods on the PrivateLinkScopesClient type. -type PrivateLinkScopesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, azureMonitorPrivateLinkScopePayload insights.AzureMonitorPrivateLinkScope) (result insights.AzureMonitorPrivateLinkScope, err error) - Delete(ctx context.Context, resourceGroupName string, scopeName string) (result insights.PrivateLinkScopesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, scopeName string) (result insights.AzureMonitorPrivateLinkScope, err error) - List(ctx context.Context) (result insights.AzureMonitorPrivateLinkScopeListResultPage, err error) - ListComplete(ctx context.Context) (result insights.AzureMonitorPrivateLinkScopeListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.AzureMonitorPrivateLinkScopeListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result insights.AzureMonitorPrivateLinkScopeListResultIterator, err error) - UpdateTags(ctx context.Context, resourceGroupName string, scopeName string, privateLinkScopeTags insights.TagsResource) (result insights.AzureMonitorPrivateLinkScope, err error) -} - -var _ PrivateLinkScopesClientAPI = (*insights.PrivateLinkScopesClient)(nil) - -// PrivateLinkScopeOperationStatusClientAPI contains the set of methods on the PrivateLinkScopeOperationStatusClient type. -type PrivateLinkScopeOperationStatusClientAPI interface { - Get(ctx context.Context, asyncOperationID string, resourceGroupName string) (result insights.OperationStatus, err error) -} - -var _ PrivateLinkScopeOperationStatusClientAPI = (*insights.PrivateLinkScopeOperationStatusClient)(nil) - -// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. -type PrivateLinkResourcesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, scopeName string, groupName string) (result insights.PrivateLinkResource, err error) - ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result insights.PrivateLinkResourceListResultPage, err error) - ListByPrivateLinkScopeComplete(ctx context.Context, resourceGroupName string, scopeName string) (result insights.PrivateLinkResourceListResultIterator, err error) -} - -var _ PrivateLinkResourcesClientAPI = (*insights.PrivateLinkResourcesClient)(nil) - -// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. -type PrivateEndpointConnectionsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters insights.PrivateEndpointConnection) (result insights.PrivateEndpointConnectionsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (result insights.PrivateEndpointConnectionsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (result insights.PrivateEndpointConnection, err error) - ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result insights.PrivateEndpointConnectionListResultPage, err error) - ListByPrivateLinkScopeComplete(ctx context.Context, resourceGroupName string, scopeName string) (result insights.PrivateEndpointConnectionListResultIterator, err error) -} - -var _ PrivateEndpointConnectionsClientAPI = (*insights.PrivateEndpointConnectionsClient)(nil) - -// PrivateLinkScopedResourcesClientAPI contains the set of methods on the PrivateLinkScopedResourcesClient type. -type PrivateLinkScopedResourcesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, name string, parameters insights.ScopedResource) (result insights.PrivateLinkScopedResourcesCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, scopeName string, name string) (result insights.PrivateLinkScopedResourcesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, scopeName string, name string) (result insights.ScopedResource, err error) - ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result insights.ScopedResourceListResultPage, err error) - ListByPrivateLinkScopeComplete(ctx context.Context, resourceGroupName string, scopeName string) (result insights.ScopedResourceListResultIterator, err error) -} - -var _ PrivateLinkScopedResourcesClientAPI = (*insights.PrivateLinkScopedResourcesClient)(nil) - -// ActivityLogAlertsClientAPI contains the set of methods on the ActivityLogAlertsClient type. -type ActivityLogAlertsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert insights.ActivityLogAlertResource) (result insights.ActivityLogAlertResource, err error) - Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result insights.ActivityLogAlertResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.ActivityLogAlertList, err error) - ListBySubscriptionID(ctx context.Context) (result insights.ActivityLogAlertList, err error) - Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch insights.ActivityLogAlertPatchBody) (result insights.ActivityLogAlertResource, err error) -} - -var _ ActivityLogAlertsClientAPI = (*insights.ActivityLogAlertsClient)(nil) - -// DataCollectionEndpointsClientAPI contains the set of methods on the DataCollectionEndpointsClient type. -type DataCollectionEndpointsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body *insights.DataCollectionEndpointResource) (result insights.DataCollectionEndpointResource, err error) - Delete(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string) (result insights.DataCollectionEndpointResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.DataCollectionEndpointResourceListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result insights.DataCollectionEndpointResourceListResultIterator, err error) - ListBySubscription(ctx context.Context) (result insights.DataCollectionEndpointResourceListResultPage, err error) - ListBySubscriptionComplete(ctx context.Context) (result insights.DataCollectionEndpointResourceListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body *insights.ResourceForUpdate) (result insights.DataCollectionEndpointResource, err error) -} - -var _ DataCollectionEndpointsClientAPI = (*insights.DataCollectionEndpointsClient)(nil) - -// DataCollectionRuleAssociationsClientAPI contains the set of methods on the DataCollectionRuleAssociationsClient type. -type DataCollectionRuleAssociationsClientAPI interface { - Create(ctx context.Context, resourceURI string, associationName string, body *insights.DataCollectionRuleAssociationProxyOnlyResource) (result insights.DataCollectionRuleAssociationProxyOnlyResource, err error) - Delete(ctx context.Context, resourceURI string, associationName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceURI string, associationName string) (result insights.DataCollectionRuleAssociationProxyOnlyResource, err error) - ListByResource(ctx context.Context, resourceURI string) (result insights.DataCollectionRuleAssociationProxyOnlyResourceListResultPage, err error) - ListByResourceComplete(ctx context.Context, resourceURI string) (result insights.DataCollectionRuleAssociationProxyOnlyResourceListResultIterator, err error) - ListByRule(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result insights.DataCollectionRuleAssociationProxyOnlyResourceListResultPage, err error) - ListByRuleComplete(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result insights.DataCollectionRuleAssociationProxyOnlyResourceListResultIterator, err error) -} - -var _ DataCollectionRuleAssociationsClientAPI = (*insights.DataCollectionRuleAssociationsClient)(nil) - -// DataCollectionRulesClientAPI contains the set of methods on the DataCollectionRulesClient type. -type DataCollectionRulesClientAPI interface { - Create(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body *insights.DataCollectionRuleResource) (result insights.DataCollectionRuleResource, err error) - Delete(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result insights.DataCollectionRuleResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.DataCollectionRuleResourceListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result insights.DataCollectionRuleResourceListResultIterator, err error) - ListBySubscription(ctx context.Context) (result insights.DataCollectionRuleResourceListResultPage, err error) - ListBySubscriptionComplete(ctx context.Context) (result insights.DataCollectionRuleResourceListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body *insights.ResourceForUpdate) (result insights.DataCollectionRuleResource, err error) -} - -var _ DataCollectionRulesClientAPI = (*insights.DataCollectionRulesClient)(nil) diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/metricdefinitions.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/metricdefinitions.go deleted file mode 100644 index 34383acfb3e7..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/metricdefinitions.go +++ /dev/null @@ -1,116 +0,0 @@ -package insights - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// MetricDefinitionsClient is the monitor Management Client -type MetricDefinitionsClient struct { - BaseClient -} - -// NewMetricDefinitionsClient creates an instance of the MetricDefinitionsClient client. -func NewMetricDefinitionsClient(subscriptionID string) MetricDefinitionsClient { - return NewMetricDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricDefinitionsClientWithBaseURI creates an instance of the MetricDefinitionsClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewMetricDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) MetricDefinitionsClient { - return MetricDefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists the metric definitions for the resource. -// Parameters: -// resourceURI - the identifier of the resource. -// metricnamespace - metric namespace to query metric definitions for. -func (client MetricDefinitionsClient) List(ctx context.Context, resourceURI string, metricnamespace string) (result MetricDefinitionCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricDefinitionsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceURI, - Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.MetricDefinitionsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceURI, metricnamespace) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricDefinitionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricDefinitionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricDefinitionsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricDefinitionsClient) ListPreparer(ctx context.Context, resourceURI string, metricnamespace string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2018-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(metricnamespace) > 0 { - queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metricDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client MetricDefinitionsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client MetricDefinitionsClient) ListResponder(resp *http.Response) (result MetricDefinitionCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/metricnamespaces.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/metricnamespaces.go deleted file mode 100644 index a1a70c21f9d6..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/metricnamespaces.go +++ /dev/null @@ -1,116 +0,0 @@ -package insights - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// MetricNamespacesClient is the monitor Management Client -type MetricNamespacesClient struct { - BaseClient -} - -// NewMetricNamespacesClient creates an instance of the MetricNamespacesClient client. -func NewMetricNamespacesClient(subscriptionID string) MetricNamespacesClient { - return NewMetricNamespacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricNamespacesClientWithBaseURI creates an instance of the MetricNamespacesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewMetricNamespacesClientWithBaseURI(baseURI string, subscriptionID string) MetricNamespacesClient { - return MetricNamespacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists the metric namespaces for the resource. -// Parameters: -// resourceURI - the identifier of the resource. -// startTime - the ISO 8601 conform Date start time from which to query for metric namespaces. -func (client MetricNamespacesClient) List(ctx context.Context, resourceURI string, startTime string) (result MetricNamespaceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricNamespacesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceURI, - Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.MetricNamespacesClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceURI, startTime) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricNamespacesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricNamespacesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricNamespacesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricNamespacesClient) ListPreparer(ctx context.Context, resourceURI string, startTime string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(startTime) > 0 { - queryParameters["startTime"] = autorest.Encode("query", startTime) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricNamespaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client MetricNamespacesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client MetricNamespacesClient) ListResponder(resp *http.Response) (result MetricNamespaceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/models.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/models.go deleted file mode 100644 index d82b7cbdb8ef..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/models.go +++ /dev/null @@ -1,8744 +0,0 @@ -package insights - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-04-01-preview/insights" - -// BasicAction action descriptor. -type BasicAction interface { - AsAlertingAction() (*AlertingAction, bool) - AsLogToMetricAction() (*LogToMetricAction, bool) - AsAction() (*Action, bool) -} - -// Action action descriptor. -type Action struct { - // OdataType - Possible values include: 'OdataTypeBasicActionOdataTypeAction', 'OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' - OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` -} - -func unmarshalBasicAction(body []byte) (BasicAction, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction): - var aa AlertingAction - err := json.Unmarshal(body, &aa) - return aa, err - case string(OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction): - var ltma LogToMetricAction - err := json.Unmarshal(body, <ma) - return ltma, err - default: - var a Action - err := json.Unmarshal(body, &a) - return a, err - } -} -func unmarshalBasicActionArray(body []byte) ([]BasicAction, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - aArray := make([]BasicAction, len(rawMessages)) - - for index, rawMessage := range rawMessages { - a, err := unmarshalBasicAction(*rawMessage) - if err != nil { - return nil, err - } - aArray[index] = a - } - return aArray, nil -} - -// MarshalJSON is the custom marshaler for Action. -func (a Action) MarshalJSON() ([]byte, error) { - a.OdataType = OdataTypeBasicActionOdataTypeAction - objectMap := make(map[string]interface{}) - if a.OdataType != "" { - objectMap["odata.type"] = a.OdataType - } - return json.Marshal(objectMap) -} - -// AsAlertingAction is the BasicAction implementation for Action. -func (a Action) AsAlertingAction() (*AlertingAction, bool) { - return nil, false -} - -// AsLogToMetricAction is the BasicAction implementation for Action. -func (a Action) AsLogToMetricAction() (*LogToMetricAction, bool) { - return nil, false -} - -// AsAction is the BasicAction implementation for Action. -func (a Action) AsAction() (*Action, bool) { - return &a, true -} - -// AsBasicAction is the BasicAction implementation for Action. -func (a Action) AsBasicAction() (BasicAction, bool) { - return &a, true -} - -// ActionGroup an Azure action group. -type ActionGroup struct { - // GroupShortName - The short name of the action group. This will be used in SMS messages. - GroupShortName *string `json:"groupShortName,omitempty"` - // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications. - Enabled *bool `json:"enabled,omitempty"` - // EmailReceivers - The list of email receivers that are part of this action group. - EmailReceivers *[]EmailReceiver `json:"emailReceivers,omitempty"` - // SmsReceivers - The list of SMS receivers that are part of this action group. - SmsReceivers *[]SmsReceiver `json:"smsReceivers,omitempty"` - // WebhookReceivers - The list of webhook receivers that are part of this action group. - WebhookReceivers *[]WebhookReceiver `json:"webhookReceivers,omitempty"` - // ItsmReceivers - The list of ITSM receivers that are part of this action group. - ItsmReceivers *[]ItsmReceiver `json:"itsmReceivers,omitempty"` - // AzureAppPushReceivers - The list of AzureAppPush receivers that are part of this action group. - AzureAppPushReceivers *[]AzureAppPushReceiver `json:"azureAppPushReceivers,omitempty"` - // AutomationRunbookReceivers - The list of AutomationRunbook receivers that are part of this action group. - AutomationRunbookReceivers *[]AutomationRunbookReceiver `json:"automationRunbookReceivers,omitempty"` - // VoiceReceivers - The list of voice receivers that are part of this action group. - VoiceReceivers *[]VoiceReceiver `json:"voiceReceivers,omitempty"` - // LogicAppReceivers - The list of logic app receivers that are part of this action group. - LogicAppReceivers *[]LogicAppReceiver `json:"logicAppReceivers,omitempty"` - // AzureFunctionReceivers - The list of azure function receivers that are part of this action group. - AzureFunctionReceivers *[]AzureFunctionReceiver `json:"azureFunctionReceivers,omitempty"` - // ArmRoleReceivers - 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. - ArmRoleReceivers *[]ArmRoleReceiver `json:"armRoleReceivers,omitempty"` -} - -// ActionGroupList a list of action groups. -type ActionGroupList struct { - autorest.Response `json:"-"` - // Value - The list of action groups. - Value *[]ActionGroupResource `json:"value,omitempty"` - // NextLink - Provides the link to retrieve the next set of elements. - NextLink *string `json:"nextLink,omitempty"` -} - -// ActionGroupPatch an Azure action group for patch operations. -type ActionGroupPatch struct { - // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated. - Enabled *bool `json:"enabled,omitempty"` -} - -// ActionGroupPatchBody an action group object for the body of patch operations. -type ActionGroupPatchBody struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // ActionGroupPatch - The action group settings for an update operation. - *ActionGroupPatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ActionGroupPatchBody. -func (agpb ActionGroupPatchBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agpb.Tags != nil { - objectMap["tags"] = agpb.Tags - } - if agpb.ActionGroupPatch != nil { - objectMap["properties"] = agpb.ActionGroupPatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActionGroupPatchBody struct. -func (agpb *ActionGroupPatchBody) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - agpb.Tags = tags - } - case "properties": - if v != nil { - var actionGroupPatch ActionGroupPatch - err = json.Unmarshal(*v, &actionGroupPatch) - if err != nil { - return err - } - agpb.ActionGroupPatch = &actionGroupPatch - } - } - } - - return nil -} - -// ActionGroupResource an action group resource. -type ActionGroupResource struct { - autorest.Response `json:"-"` - // ActionGroup - The action groups properties of the resource. - *ActionGroup `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type - Type *string `json:"type,omitempty"` - // Kind - READ-ONLY; Azure resource kind - Kind *string `json:"kind,omitempty"` - // Identity - READ-ONLY; Azure resource identity - Identity *string `json:"identity,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ActionGroupResource. -func (agr ActionGroupResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agr.ActionGroup != nil { - objectMap["properties"] = agr.ActionGroup - } - if agr.Location != nil { - objectMap["location"] = agr.Location - } - if agr.Tags != nil { - objectMap["tags"] = agr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActionGroupResource struct. -func (agr *ActionGroupResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var actionGroup ActionGroup - err = json.Unmarshal(*v, &actionGroup) - if err != nil { - return err - } - agr.ActionGroup = &actionGroup - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agr.Type = &typeVar - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - agr.Kind = &kind - } - case "identity": - if v != nil { - var identity string - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - agr.Identity = &identity - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - agr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - agr.Tags = tags - } - } - } - - return nil -} - -// ActivityLogAlert an Azure activity log alert. -type ActivityLogAlert struct { - // Scopes - 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. - Scopes *[]string `json:"scopes,omitempty"` - // 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. - Enabled *bool `json:"enabled,omitempty"` - // Condition - The condition that will cause this alert to activate. - Condition *ActivityLogAlertAllOfCondition `json:"condition,omitempty"` - // Actions - The actions that will activate when the condition is met. - Actions *ActivityLogAlertActionList `json:"actions,omitempty"` - // Description - A description of this activity log alert. - Description *string `json:"description,omitempty"` -} - -// ActivityLogAlertActionGroup a pointer to an Azure Action Group. -type ActivityLogAlertActionGroup struct { - // ActionGroupID - The resourceId of the action group. This cannot be null or empty. - ActionGroupID *string `json:"actionGroupId,omitempty"` - // WebhookProperties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. - WebhookProperties map[string]*string `json:"webhookProperties"` -} - -// MarshalJSON is the custom marshaler for ActivityLogAlertActionGroup. -func (alaag ActivityLogAlertActionGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if alaag.ActionGroupID != nil { - objectMap["actionGroupId"] = alaag.ActionGroupID - } - if alaag.WebhookProperties != nil { - objectMap["webhookProperties"] = alaag.WebhookProperties - } - return json.Marshal(objectMap) -} - -// ActivityLogAlertActionList a list of activity log alert actions. -type ActivityLogAlertActionList struct { - // ActionGroups - The list of activity log alerts. - ActionGroups *[]ActivityLogAlertActionGroup `json:"actionGroups,omitempty"` -} - -// ActivityLogAlertAllOfCondition an Activity Log alert condition that is met when all its member -// conditions are met. -type ActivityLogAlertAllOfCondition struct { - // AllOf - The list of activity log alert conditions. - AllOf *[]ActivityLogAlertLeafCondition `json:"allOf,omitempty"` -} - -// ActivityLogAlertLeafCondition an Activity Log alert condition that is met by comparing an activity log -// field and value. -type ActivityLogAlertLeafCondition struct { - // Field - 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.'. - Field *string `json:"field,omitempty"` - // Equals - The field value will be compared to this value (case-insensitive) to determine if the condition is met. - Equals *string `json:"equals,omitempty"` -} - -// ActivityLogAlertList a list of activity log alerts. -type ActivityLogAlertList struct { - autorest.Response `json:"-"` - // Value - The list of activity log alerts. - Value *[]ActivityLogAlertResource `json:"value,omitempty"` - // NextLink - Provides the link to retrieve the next set of elements. - NextLink *string `json:"nextLink,omitempty"` -} - -// ActivityLogAlertPatch an Azure activity log alert for patch operations. -type ActivityLogAlertPatch struct { - // 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. - Enabled *bool `json:"enabled,omitempty"` -} - -// ActivityLogAlertPatchBody an activity log alert object for the body of patch operations. -type ActivityLogAlertPatchBody struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // ActivityLogAlertPatch - The activity log alert settings for an update operation. - *ActivityLogAlertPatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ActivityLogAlertPatchBody. -func (alapb ActivityLogAlertPatchBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if alapb.Tags != nil { - objectMap["tags"] = alapb.Tags - } - if alapb.ActivityLogAlertPatch != nil { - objectMap["properties"] = alapb.ActivityLogAlertPatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertPatchBody struct. -func (alapb *ActivityLogAlertPatchBody) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - alapb.Tags = tags - } - case "properties": - if v != nil { - var activityLogAlertPatch ActivityLogAlertPatch - err = json.Unmarshal(*v, &activityLogAlertPatch) - if err != nil { - return err - } - alapb.ActivityLogAlertPatch = &activityLogAlertPatch - } - } - } - - return nil -} - -// ActivityLogAlertResource an activity log alert resource. -type ActivityLogAlertResource struct { - autorest.Response `json:"-"` - // ActivityLogAlert - The activity log alert properties of the resource. - *ActivityLogAlert `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. - Kind *string `json:"kind,omitempty"` - // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for ActivityLogAlertResource. -func (alar ActivityLogAlertResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if alar.ActivityLogAlert != nil { - objectMap["properties"] = alar.ActivityLogAlert - } - if alar.Location != nil { - objectMap["location"] = alar.Location - } - if alar.Tags != nil { - objectMap["tags"] = alar.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertResource struct. -func (alar *ActivityLogAlertResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var activityLogAlert ActivityLogAlert - err = json.Unmarshal(*v, &activityLogAlert) - if err != nil { - return err - } - alar.ActivityLogAlert = &activityLogAlert - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - alar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - alar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - alar.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - alar.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - alar.Tags = tags - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - alar.Kind = &kind - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - alar.Etag = &etag - } - } - } - - return nil -} - -// AlertingAction specify action need to be taken when rule type is Alert -type AlertingAction struct { - // Severity - Severity of the alert. Possible values include: 'AlertSeverityZero', 'AlertSeverityOne', 'AlertSeverityTwo', 'AlertSeverityThree', 'AlertSeverityFour' - Severity AlertSeverity `json:"severity,omitempty"` - // AznsAction - Azure action group reference. - AznsAction *AzNsActionGroup `json:"aznsAction,omitempty"` - // ThrottlingInMin - time (in minutes) for which Alerts should be throttled or suppressed. - ThrottlingInMin *int32 `json:"throttlingInMin,omitempty"` - // Trigger - The trigger condition that results in the alert rule being. - Trigger *TriggerCondition `json:"trigger,omitempty"` - // OdataType - Possible values include: 'OdataTypeBasicActionOdataTypeAction', 'OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' - OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertingAction. -func (aa AlertingAction) MarshalJSON() ([]byte, error) { - aa.OdataType = OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction - objectMap := make(map[string]interface{}) - if aa.Severity != "" { - objectMap["severity"] = aa.Severity - } - if aa.AznsAction != nil { - objectMap["aznsAction"] = aa.AznsAction - } - if aa.ThrottlingInMin != nil { - objectMap["throttlingInMin"] = aa.ThrottlingInMin - } - if aa.Trigger != nil { - objectMap["trigger"] = aa.Trigger - } - if aa.OdataType != "" { - objectMap["odata.type"] = aa.OdataType - } - return json.Marshal(objectMap) -} - -// AsAlertingAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsAlertingAction() (*AlertingAction, bool) { - return &aa, true -} - -// AsLogToMetricAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsLogToMetricAction() (*LogToMetricAction, bool) { - return nil, false -} - -// AsAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsAction() (*Action, bool) { - return nil, false -} - -// AsBasicAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsBasicAction() (BasicAction, bool) { - return &aa, true -} - -// AlertRule an alert rule. -type AlertRule struct { - // Name - the name of the alert rule. - Name *string `json:"name,omitempty"` - // Description - the description of the alert rule that will be included in the alert email. - Description *string `json:"description,omitempty"` - // ProvisioningState - the provisioning state. - ProvisioningState *string `json:"provisioningState,omitempty"` - // IsEnabled - the flag that indicates whether the alert rule is enabled. - IsEnabled *bool `json:"isEnabled,omitempty"` - // Condition - the condition that results in the alert rule being activated. - Condition BasicRuleCondition `json:"condition,omitempty"` - // Action - action that is performed when the alert rule becomes active, and when an alert condition is resolved. - Action BasicRuleAction `json:"action,omitempty"` - // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions *[]BasicRuleAction `json:"actions,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertRule. -func (ar AlertRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ar.Name != nil { - objectMap["name"] = ar.Name - } - if ar.Description != nil { - objectMap["description"] = ar.Description - } - if ar.ProvisioningState != nil { - objectMap["provisioningState"] = ar.ProvisioningState - } - if ar.IsEnabled != nil { - objectMap["isEnabled"] = ar.IsEnabled - } - objectMap["condition"] = ar.Condition - objectMap["action"] = ar.Action - if ar.Actions != nil { - objectMap["actions"] = ar.Actions - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRule struct. -func (ar *AlertRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ar.Name = &name - } - case "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - ar.Description = &description - } - case "provisioningState": - if v != nil { - var provisioningState string - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - ar.ProvisioningState = &provisioningState - } - case "isEnabled": - if v != nil { - var isEnabled bool - err = json.Unmarshal(*v, &isEnabled) - if err != nil { - return err - } - ar.IsEnabled = &isEnabled - } - case "condition": - if v != nil { - condition, err := unmarshalBasicRuleCondition(*v) - if err != nil { - return err - } - ar.Condition = condition - } - case "action": - if v != nil { - action, err := unmarshalBasicRuleAction(*v) - if err != nil { - return err - } - ar.Action = action - } - case "actions": - if v != nil { - actions, err := unmarshalBasicRuleActionArray(*v) - if err != nil { - return err - } - ar.Actions = &actions - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - ar.LastUpdatedTime = &lastUpdatedTime - } - } - } - - return nil -} - -// AlertRuleResource the alert rule resource. -type AlertRuleResource struct { - autorest.Response `json:"-"` - // AlertRule - The alert rule properties of the resource. - *AlertRule `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. - Kind *string `json:"kind,omitempty"` - // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertRuleResource. -func (arr AlertRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arr.AlertRule != nil { - objectMap["properties"] = arr.AlertRule - } - if arr.Location != nil { - objectMap["location"] = arr.Location - } - if arr.Tags != nil { - objectMap["tags"] = arr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRuleResource struct. -func (arr *AlertRuleResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var alertRule AlertRule - err = json.Unmarshal(*v, &alertRule) - if err != nil { - return err - } - arr.AlertRule = &alertRule - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - arr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - arr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - arr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - arr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - arr.Tags = tags - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - arr.Kind = &kind - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - arr.Etag = &etag - } - } - } - - return nil -} - -// AlertRuleResourceCollection represents a collection of alert rule resources. -type AlertRuleResourceCollection struct { - autorest.Response `json:"-"` - // Value - the values for the alert rule resources. - Value *[]AlertRuleResource `json:"value,omitempty"` -} - -// AlertRuleResourcePatch the alert rule object for patch operations. -type AlertRuleResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // AlertRule - The properties of an alert rule. - *AlertRule `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertRuleResourcePatch. -func (arrp AlertRuleResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arrp.Tags != nil { - objectMap["tags"] = arrp.Tags - } - if arrp.AlertRule != nil { - objectMap["properties"] = arrp.AlertRule - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRuleResourcePatch struct. -func (arrp *AlertRuleResourcePatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - arrp.Tags = tags - } - case "properties": - if v != nil { - var alertRule AlertRule - err = json.Unmarshal(*v, &alertRule) - if err != nil { - return err - } - arrp.AlertRule = &alertRule - } - } - } - - return nil -} - -// ArmRoleReceiver an arm role receiver. -type ArmRoleReceiver struct { - // Name - The name of the arm role receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // RoleID - The arm role id. - RoleID *string `json:"roleId,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` -} - -// AutomationRunbookReceiver the Azure Automation Runbook notification receiver. -type AutomationRunbookReceiver struct { - // AutomationAccountID - The Azure automation account Id which holds this runbook and authenticate to Azure resource. - AutomationAccountID *string `json:"automationAccountId,omitempty"` - // RunbookName - The name for this runbook. - RunbookName *string `json:"runbookName,omitempty"` - // WebhookResourceID - The resource id for webhook linked to this runbook. - WebhookResourceID *string `json:"webhookResourceId,omitempty"` - // IsGlobalRunbook - Indicates whether this instance is global runbook. - IsGlobalRunbook *bool `json:"isGlobalRunbook,omitempty"` - // Name - Indicates name of the webhook. - Name *string `json:"name,omitempty"` - // ServiceURI - The URI where webhooks should be sent. - ServiceURI *string `json:"serviceUri,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` -} - -// AutoscaleNotification autoscale notification. -type AutoscaleNotification struct { - // Operation - the operation associated with the notification and its value must be "scale" - Operation *string `json:"operation,omitempty"` - // Email - the email notification. - Email *EmailNotification `json:"email,omitempty"` - // Webhooks - the collection of webhook notifications. - Webhooks *[]WebhookNotification `json:"webhooks,omitempty"` -} - -// AutoscaleProfile autoscale profile. -type AutoscaleProfile struct { - // Name - the name of the profile. - Name *string `json:"name,omitempty"` - // Capacity - the number of instances that can be used during this profile. - Capacity *ScaleCapacity `json:"capacity,omitempty"` - // Rules - the collection of rules that provide the triggers and parameters for the scaling action. A maximum of 10 rules can be specified. - Rules *[]ScaleRule `json:"rules,omitempty"` - // FixedDate - the specific date-time for the profile. This element is not used if the Recurrence element is used. - FixedDate *TimeWindow `json:"fixedDate,omitempty"` - // Recurrence - the repeating times at which this profile begins. This element is not used if the FixedDate element is used. - Recurrence *Recurrence `json:"recurrence,omitempty"` -} - -// AutoscaleSetting a setting that contains all of the configuration for the automatic scaling of a -// resource. -type AutoscaleSetting struct { - // Profiles - the collection of automatic scaling profiles that specify different scaling parameters for different time periods. A maximum of 20 profiles can be specified. - Profiles *[]AutoscaleProfile `json:"profiles,omitempty"` - // Notifications - the collection of notifications. - Notifications *[]AutoscaleNotification `json:"notifications,omitempty"` - // Enabled - the enabled flag. Specifies whether automatic scaling is enabled for the resource. The default value is 'true'. - Enabled *bool `json:"enabled,omitempty"` - // Name - the name of the autoscale setting. - Name *string `json:"name,omitempty"` - // TargetResourceURI - the resource identifier of the resource that the autoscale setting should be added to. - TargetResourceURI *string `json:"targetResourceUri,omitempty"` -} - -// AutoscaleSettingResource the autoscale setting resource. -type AutoscaleSettingResource struct { - autorest.Response `json:"-"` - // AutoscaleSetting - The autoscale setting of the resource. - *AutoscaleSetting `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. - Kind *string `json:"kind,omitempty"` - // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for AutoscaleSettingResource. -func (asr AutoscaleSettingResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asr.AutoscaleSetting != nil { - objectMap["properties"] = asr.AutoscaleSetting - } - if asr.Location != nil { - objectMap["location"] = asr.Location - } - if asr.Tags != nil { - objectMap["tags"] = asr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResource struct. -func (asr *AutoscaleSettingResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var autoscaleSetting AutoscaleSetting - err = json.Unmarshal(*v, &autoscaleSetting) - if err != nil { - return err - } - asr.AutoscaleSetting = &autoscaleSetting - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - asr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - asr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - asr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - asr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - asr.Tags = tags - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - asr.Kind = &kind - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - asr.Etag = &etag - } - } - } - - return nil -} - -// AutoscaleSettingResourceCollection represents a collection of autoscale setting resources. -type AutoscaleSettingResourceCollection struct { - autorest.Response `json:"-"` - // Value - the values for the autoscale setting resources. - Value *[]AutoscaleSettingResource `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// AutoscaleSettingResourceCollectionIterator provides access to a complete listing of -// AutoscaleSettingResource values. -type AutoscaleSettingResourceCollectionIterator struct { - i int - page AutoscaleSettingResourceCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AutoscaleSettingResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AutoscaleSettingResourceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AutoscaleSettingResourceCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AutoscaleSettingResourceCollectionIterator) Response() AutoscaleSettingResourceCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AutoscaleSettingResourceCollectionIterator) Value() AutoscaleSettingResource { - if !iter.page.NotDone() { - return AutoscaleSettingResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AutoscaleSettingResourceCollectionIterator type. -func NewAutoscaleSettingResourceCollectionIterator(page AutoscaleSettingResourceCollectionPage) AutoscaleSettingResourceCollectionIterator { - return AutoscaleSettingResourceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (asrc AutoscaleSettingResourceCollection) IsEmpty() bool { - return asrc.Value == nil || len(*asrc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (asrc AutoscaleSettingResourceCollection) hasNextLink() bool { - return asrc.NextLink != nil && len(*asrc.NextLink) != 0 -} - -// autoscaleSettingResourceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (asrc AutoscaleSettingResourceCollection) autoscaleSettingResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !asrc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(asrc.NextLink))) -} - -// AutoscaleSettingResourceCollectionPage contains a page of AutoscaleSettingResource values. -type AutoscaleSettingResourceCollectionPage struct { - fn func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error) - asrc AutoscaleSettingResourceCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AutoscaleSettingResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.asrc) - if err != nil { - return err - } - page.asrc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AutoscaleSettingResourceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AutoscaleSettingResourceCollectionPage) NotDone() bool { - return !page.asrc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AutoscaleSettingResourceCollectionPage) Response() AutoscaleSettingResourceCollection { - return page.asrc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AutoscaleSettingResourceCollectionPage) Values() []AutoscaleSettingResource { - if page.asrc.IsEmpty() { - return nil - } - return *page.asrc.Value -} - -// Creates a new instance of the AutoscaleSettingResourceCollectionPage type. -func NewAutoscaleSettingResourceCollectionPage(cur AutoscaleSettingResourceCollection, getNextPage func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error)) AutoscaleSettingResourceCollectionPage { - return AutoscaleSettingResourceCollectionPage{ - fn: getNextPage, - asrc: cur, - } -} - -// AutoscaleSettingResourcePatch the autoscale setting object for patch operations. -type AutoscaleSettingResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // AutoscaleSetting - The autoscale setting properties of the update operation. - *AutoscaleSetting `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AutoscaleSettingResourcePatch. -func (asrp AutoscaleSettingResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asrp.Tags != nil { - objectMap["tags"] = asrp.Tags - } - if asrp.AutoscaleSetting != nil { - objectMap["properties"] = asrp.AutoscaleSetting - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResourcePatch struct. -func (asrp *AutoscaleSettingResourcePatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - asrp.Tags = tags - } - case "properties": - if v != nil { - var autoscaleSetting AutoscaleSetting - err = json.Unmarshal(*v, &autoscaleSetting) - if err != nil { - return err - } - asrp.AutoscaleSetting = &autoscaleSetting - } - } - } - - return nil -} - -// AzNsActionGroup azure action group -type AzNsActionGroup struct { - // ActionGroup - Azure Action Group reference. - ActionGroup *[]string `json:"actionGroup,omitempty"` - // EmailSubject - Custom subject override for all email ids in Azure action group - EmailSubject *string `json:"emailSubject,omitempty"` - // CustomWebhookPayload - Custom payload to be sent for all webhook URI in Azure action group - CustomWebhookPayload *string `json:"customWebhookPayload,omitempty"` -} - -// AzureAppPushReceiver the Azure mobile App push notification receiver. -type AzureAppPushReceiver struct { - // Name - The name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // EmailAddress - The email address registered for the Azure mobile app. - EmailAddress *string `json:"emailAddress,omitempty"` -} - -// AzureFunctionReceiver an azure function receiver. -type AzureFunctionReceiver struct { - // Name - The name of the azure function receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // FunctionAppResourceID - The azure resource id of the function app. - FunctionAppResourceID *string `json:"functionAppResourceId,omitempty"` - // FunctionName - The function name in the function app. - FunctionName *string `json:"functionName,omitempty"` - // HTTPTriggerURL - The http trigger url where http request sent to. - HTTPTriggerURL *string `json:"httpTriggerUrl,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` -} - -// AzureMonitorMetricsDestination azure Monitor Metrics destination. -type AzureMonitorMetricsDestination struct { - // Name - A friendly name for the destination. - // This name should be unique across all destinations (regardless of type) within the data collection rule. - Name *string `json:"name,omitempty"` -} - -// AzureMonitorPrivateLinkScope an Azure Monitor PrivateLinkScope definition. -type AzureMonitorPrivateLinkScope struct { - autorest.Response `json:"-"` - // AzureMonitorPrivateLinkScopeProperties - Properties that define a Azure Monitor PrivateLinkScope resource. - *AzureMonitorPrivateLinkScopeProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for AzureMonitorPrivateLinkScope. -func (ampls AzureMonitorPrivateLinkScope) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ampls.AzureMonitorPrivateLinkScopeProperties != nil { - objectMap["properties"] = ampls.AzureMonitorPrivateLinkScopeProperties - } - if ampls.Location != nil { - objectMap["location"] = ampls.Location - } - if ampls.Tags != nil { - objectMap["tags"] = ampls.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AzureMonitorPrivateLinkScope struct. -func (ampls *AzureMonitorPrivateLinkScope) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var azureMonitorPrivateLinkScopeProperties AzureMonitorPrivateLinkScopeProperties - err = json.Unmarshal(*v, &azureMonitorPrivateLinkScopeProperties) - if err != nil { - return err - } - ampls.AzureMonitorPrivateLinkScopeProperties = &azureMonitorPrivateLinkScopeProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ampls.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ampls.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ampls.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ampls.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ampls.Tags = tags - } - } - } - - return nil -} - -// AzureMonitorPrivateLinkScopeListResult describes the list of Azure Monitor PrivateLinkScope resources. -type AzureMonitorPrivateLinkScopeListResult struct { - autorest.Response `json:"-"` - // Value - List of Azure Monitor PrivateLinkScope definitions. - Value *[]AzureMonitorPrivateLinkScope `json:"value,omitempty"` - // NextLink - The URI to get the next set of Azure Monitor PrivateLinkScope definitions if too many PrivateLinkScopes where returned in the result set. - NextLink *string `json:"nextLink,omitempty"` -} - -// AzureMonitorPrivateLinkScopeListResultIterator provides access to a complete listing of -// AzureMonitorPrivateLinkScope values. -type AzureMonitorPrivateLinkScopeListResultIterator struct { - i int - page AzureMonitorPrivateLinkScopeListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AzureMonitorPrivateLinkScopeListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AzureMonitorPrivateLinkScopeListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AzureMonitorPrivateLinkScopeListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AzureMonitorPrivateLinkScopeListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AzureMonitorPrivateLinkScopeListResultIterator) Response() AzureMonitorPrivateLinkScopeListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AzureMonitorPrivateLinkScopeListResultIterator) Value() AzureMonitorPrivateLinkScope { - if !iter.page.NotDone() { - return AzureMonitorPrivateLinkScope{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AzureMonitorPrivateLinkScopeListResultIterator type. -func NewAzureMonitorPrivateLinkScopeListResultIterator(page AzureMonitorPrivateLinkScopeListResultPage) AzureMonitorPrivateLinkScopeListResultIterator { - return AzureMonitorPrivateLinkScopeListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (amplslr AzureMonitorPrivateLinkScopeListResult) IsEmpty() bool { - return amplslr.Value == nil || len(*amplslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (amplslr AzureMonitorPrivateLinkScopeListResult) hasNextLink() bool { - return amplslr.NextLink != nil && len(*amplslr.NextLink) != 0 -} - -// azureMonitorPrivateLinkScopeListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (amplslr AzureMonitorPrivateLinkScopeListResult) azureMonitorPrivateLinkScopeListResultPreparer(ctx context.Context) (*http.Request, error) { - if !amplslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(amplslr.NextLink))) -} - -// AzureMonitorPrivateLinkScopeListResultPage contains a page of AzureMonitorPrivateLinkScope values. -type AzureMonitorPrivateLinkScopeListResultPage struct { - fn func(context.Context, AzureMonitorPrivateLinkScopeListResult) (AzureMonitorPrivateLinkScopeListResult, error) - amplslr AzureMonitorPrivateLinkScopeListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AzureMonitorPrivateLinkScopeListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AzureMonitorPrivateLinkScopeListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.amplslr) - if err != nil { - return err - } - page.amplslr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AzureMonitorPrivateLinkScopeListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AzureMonitorPrivateLinkScopeListResultPage) NotDone() bool { - return !page.amplslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AzureMonitorPrivateLinkScopeListResultPage) Response() AzureMonitorPrivateLinkScopeListResult { - return page.amplslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AzureMonitorPrivateLinkScopeListResultPage) Values() []AzureMonitorPrivateLinkScope { - if page.amplslr.IsEmpty() { - return nil - } - return *page.amplslr.Value -} - -// Creates a new instance of the AzureMonitorPrivateLinkScopeListResultPage type. -func NewAzureMonitorPrivateLinkScopeListResultPage(cur AzureMonitorPrivateLinkScopeListResult, getNextPage func(context.Context, AzureMonitorPrivateLinkScopeListResult) (AzureMonitorPrivateLinkScopeListResult, error)) AzureMonitorPrivateLinkScopeListResultPage { - return AzureMonitorPrivateLinkScopeListResultPage{ - fn: getNextPage, - amplslr: cur, - } -} - -// AzureMonitorPrivateLinkScopeProperties properties that define a Azure Monitor PrivateLinkScope resource. -type AzureMonitorPrivateLinkScopeProperties struct { - // ProvisioningState - READ-ONLY; Current state of this PrivateLinkScope: whether or not is has been provisioned within the resource group it is defined. Users cannot change this value but are able to read from it. Values will include Provisioning ,Succeeded, Canceled and Failed. - ProvisioningState *string `json:"provisioningState,omitempty"` - // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections. - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureMonitorPrivateLinkScopeProperties. -func (amplsp AzureMonitorPrivateLinkScopeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AzureResource an azure resource object -type AzureResource struct { - // ID - READ-ONLY; Azure resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type - Type *string `json:"type,omitempty"` - // Kind - READ-ONLY; Azure resource kind - Kind *string `json:"kind,omitempty"` - // Identity - READ-ONLY; Azure resource identity - Identity *string `json:"identity,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for AzureResource. -func (ar AzureResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ar.Location != nil { - objectMap["location"] = ar.Location - } - if ar.Tags != nil { - objectMap["tags"] = ar.Tags - } - return json.Marshal(objectMap) -} - -// BaselineMetadata represents a baseline metadata value. -type BaselineMetadata struct { - // Name - Name of the baseline metadata. - Name *string `json:"name,omitempty"` - // Value - Value of the baseline metadata. - Value *string `json:"value,omitempty"` -} - -// ConfigurationAccessEndpointSpec definition of the endpoint used for accessing configuration. -type ConfigurationAccessEndpointSpec struct { - // Endpoint - READ-ONLY; The endpoint. This property is READ-ONLY. - Endpoint *string `json:"endpoint,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConfigurationAccessEndpointSpec. -func (caes ConfigurationAccessEndpointSpec) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Criteria specifies the criteria for converting log to metric. -type Criteria struct { - // MetricName - Name of the metric - MetricName *string `json:"metricName,omitempty"` - // Dimensions - List of Dimensions for creating metric - Dimensions *[]Dimension `json:"dimensions,omitempty"` -} - -// DataCollectionEndpoint definition of data collection endpoint. -type DataCollectionEndpoint struct { - // Description - Description of the data collection endpoint. - Description *string `json:"description,omitempty"` - // ImmutableID - The immutable ID of this data collection endpoint resource. This property is READ-ONLY. - ImmutableID *string `json:"immutableId,omitempty"` - // ConfigurationAccess - The endpoint used by agents to access their configuration. - ConfigurationAccess *DataCollectionEndpointConfigurationAccess `json:"configurationAccess,omitempty"` - // LogsIngestion - The endpoint used by clients to ingest logs. - LogsIngestion *DataCollectionEndpointLogsIngestion `json:"logsIngestion,omitempty"` - // NetworkAcls - Network access control rules for the endpoints. - NetworkAcls *DataCollectionEndpointNetworkAcls `json:"networkAcls,omitempty"` - // ProvisioningState - READ-ONLY; The resource provisioning state. This property is READ-ONLY. Possible values include: 'KnownDataCollectionEndpointProvisioningStateCreating', 'KnownDataCollectionEndpointProvisioningStateUpdating', 'KnownDataCollectionEndpointProvisioningStateDeleting', 'KnownDataCollectionEndpointProvisioningStateSucceeded', 'KnownDataCollectionEndpointProvisioningStateFailed' - ProvisioningState KnownDataCollectionEndpointProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataCollectionEndpoint. -func (dce DataCollectionEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dce.Description != nil { - objectMap["description"] = dce.Description - } - if dce.ImmutableID != nil { - objectMap["immutableId"] = dce.ImmutableID - } - if dce.ConfigurationAccess != nil { - objectMap["configurationAccess"] = dce.ConfigurationAccess - } - if dce.LogsIngestion != nil { - objectMap["logsIngestion"] = dce.LogsIngestion - } - if dce.NetworkAcls != nil { - objectMap["networkAcls"] = dce.NetworkAcls - } - return json.Marshal(objectMap) -} - -// DataCollectionEndpointConfigurationAccess the endpoint used by agents to access their configuration. -type DataCollectionEndpointConfigurationAccess struct { - // Endpoint - READ-ONLY; The endpoint. This property is READ-ONLY. - Endpoint *string `json:"endpoint,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataCollectionEndpointConfigurationAccess. -func (dceA DataCollectionEndpointConfigurationAccess) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DataCollectionEndpointLogsIngestion the endpoint used by clients to ingest logs. -type DataCollectionEndpointLogsIngestion struct { - // Endpoint - READ-ONLY; The endpoint. This property is READ-ONLY. - Endpoint *string `json:"endpoint,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataCollectionEndpointLogsIngestion. -func (dceI DataCollectionEndpointLogsIngestion) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DataCollectionEndpointNetworkAcls network access control rules for the endpoints. -type DataCollectionEndpointNetworkAcls struct { - // PublicNetworkAccess - The configuration to set whether network access from public internet to the endpoints are allowed. Possible values include: 'KnownPublicNetworkAccessOptionsEnabled', 'KnownPublicNetworkAccessOptionsDisabled' - PublicNetworkAccess KnownPublicNetworkAccessOptions `json:"publicNetworkAccess,omitempty"` -} - -// DataCollectionEndpointResource definition of ARM tracked top level resource. -type DataCollectionEndpointResource struct { - autorest.Response `json:"-"` - // DataCollectionEndpointResourceProperties - Resource properties. - *DataCollectionEndpointResourceProperties `json:"properties,omitempty"` - // Location - The geo-location where the resource lives. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Kind - The kind of the resource. Possible values include: 'KnownDataCollectionEndpointResourceKindLinux', 'KnownDataCollectionEndpointResourceKindWindows' - Kind KnownDataCollectionEndpointResourceKind `json:"kind,omitempty"` - // ID - READ-ONLY; Fully qualified ID of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; Resource entity tag (ETag). - Etag *string `json:"etag,omitempty"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *DataCollectionEndpointResourceSystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataCollectionEndpointResource. -func (dcer DataCollectionEndpointResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcer.DataCollectionEndpointResourceProperties != nil { - objectMap["properties"] = dcer.DataCollectionEndpointResourceProperties - } - if dcer.Location != nil { - objectMap["location"] = dcer.Location - } - if dcer.Tags != nil { - objectMap["tags"] = dcer.Tags - } - if dcer.Kind != "" { - objectMap["kind"] = dcer.Kind - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DataCollectionEndpointResource struct. -func (dcer *DataCollectionEndpointResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var dataCollectionEndpointResourceProperties DataCollectionEndpointResourceProperties - err = json.Unmarshal(*v, &dataCollectionEndpointResourceProperties) - if err != nil { - return err - } - dcer.DataCollectionEndpointResourceProperties = &dataCollectionEndpointResourceProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dcer.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dcer.Tags = tags - } - case "kind": - if v != nil { - var kind KnownDataCollectionEndpointResourceKind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dcer.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dcer.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dcer.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dcer.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - dcer.Etag = &etag - } - case "systemData": - if v != nil { - var systemData DataCollectionEndpointResourceSystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - dcer.SystemData = &systemData - } - } - } - - return nil -} - -// DataCollectionEndpointResourceListResult a pageable list of resources. -type DataCollectionEndpointResourceListResult struct { - autorest.Response `json:"-"` - // Value - A list of resources. - Value *[]DataCollectionEndpointResource `json:"value,omitempty"` - // NextLink - The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// DataCollectionEndpointResourceListResultIterator provides access to a complete listing of -// DataCollectionEndpointResource values. -type DataCollectionEndpointResourceListResultIterator struct { - i int - page DataCollectionEndpointResourceListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *DataCollectionEndpointResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointResourceListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *DataCollectionEndpointResourceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DataCollectionEndpointResourceListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter DataCollectionEndpointResourceListResultIterator) Response() DataCollectionEndpointResourceListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter DataCollectionEndpointResourceListResultIterator) Value() DataCollectionEndpointResource { - if !iter.page.NotDone() { - return DataCollectionEndpointResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DataCollectionEndpointResourceListResultIterator type. -func NewDataCollectionEndpointResourceListResultIterator(page DataCollectionEndpointResourceListResultPage) DataCollectionEndpointResourceListResultIterator { - return DataCollectionEndpointResourceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dcerlr DataCollectionEndpointResourceListResult) IsEmpty() bool { - return dcerlr.Value == nil || len(*dcerlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dcerlr DataCollectionEndpointResourceListResult) hasNextLink() bool { - return dcerlr.NextLink != nil && len(*dcerlr.NextLink) != 0 -} - -// dataCollectionEndpointResourceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dcerlr DataCollectionEndpointResourceListResult) dataCollectionEndpointResourceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dcerlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dcerlr.NextLink))) -} - -// DataCollectionEndpointResourceListResultPage contains a page of DataCollectionEndpointResource values. -type DataCollectionEndpointResourceListResultPage struct { - fn func(context.Context, DataCollectionEndpointResourceListResult) (DataCollectionEndpointResourceListResult, error) - dcerlr DataCollectionEndpointResourceListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *DataCollectionEndpointResourceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointResourceListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.dcerlr) - if err != nil { - return err - } - page.dcerlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *DataCollectionEndpointResourceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DataCollectionEndpointResourceListResultPage) NotDone() bool { - return !page.dcerlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DataCollectionEndpointResourceListResultPage) Response() DataCollectionEndpointResourceListResult { - return page.dcerlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DataCollectionEndpointResourceListResultPage) Values() []DataCollectionEndpointResource { - if page.dcerlr.IsEmpty() { - return nil - } - return *page.dcerlr.Value -} - -// Creates a new instance of the DataCollectionEndpointResourceListResultPage type. -func NewDataCollectionEndpointResourceListResultPage(cur DataCollectionEndpointResourceListResult, getNextPage func(context.Context, DataCollectionEndpointResourceListResult) (DataCollectionEndpointResourceListResult, error)) DataCollectionEndpointResourceListResultPage { - return DataCollectionEndpointResourceListResultPage{ - fn: getNextPage, - dcerlr: cur, - } -} - -// DataCollectionEndpointResourceProperties resource properties. -type DataCollectionEndpointResourceProperties struct { - // Description - Description of the data collection endpoint. - Description *string `json:"description,omitempty"` - // ImmutableID - The immutable ID of this data collection endpoint resource. This property is READ-ONLY. - ImmutableID *string `json:"immutableId,omitempty"` - // ConfigurationAccess - The endpoint used by agents to access their configuration. - ConfigurationAccess *DataCollectionEndpointConfigurationAccess `json:"configurationAccess,omitempty"` - // LogsIngestion - The endpoint used by clients to ingest logs. - LogsIngestion *DataCollectionEndpointLogsIngestion `json:"logsIngestion,omitempty"` - // NetworkAcls - Network access control rules for the endpoints. - NetworkAcls *DataCollectionEndpointNetworkAcls `json:"networkAcls,omitempty"` - // ProvisioningState - READ-ONLY; The resource provisioning state. This property is READ-ONLY. Possible values include: 'KnownDataCollectionEndpointProvisioningStateCreating', 'KnownDataCollectionEndpointProvisioningStateUpdating', 'KnownDataCollectionEndpointProvisioningStateDeleting', 'KnownDataCollectionEndpointProvisioningStateSucceeded', 'KnownDataCollectionEndpointProvisioningStateFailed' - ProvisioningState KnownDataCollectionEndpointProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataCollectionEndpointResourceProperties. -func (dcer DataCollectionEndpointResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcer.Description != nil { - objectMap["description"] = dcer.Description - } - if dcer.ImmutableID != nil { - objectMap["immutableId"] = dcer.ImmutableID - } - if dcer.ConfigurationAccess != nil { - objectMap["configurationAccess"] = dcer.ConfigurationAccess - } - if dcer.LogsIngestion != nil { - objectMap["logsIngestion"] = dcer.LogsIngestion - } - if dcer.NetworkAcls != nil { - objectMap["networkAcls"] = dcer.NetworkAcls - } - return json.Marshal(objectMap) -} - -// DataCollectionEndpointResourceSystemData metadata pertaining to creation and last modification of the -// resource. -type DataCollectionEndpointResourceSystemData struct { - // CreatedBy - The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - CreatedByType CreatedByType `json:"createdByType,omitempty"` - // CreatedAt - The timestamp of resource creation (UTC). - CreatedAt *date.Time `json:"createdAt,omitempty"` - // LastModifiedBy - The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The timestamp of resource last modification (UTC) - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// DataCollectionRule definition of what monitoring data to collect and where that data should be sent. -type DataCollectionRule struct { - // Description - Description of the data collection rule. - Description *string `json:"description,omitempty"` - // ImmutableID - READ-ONLY; The immutable ID of this data collection rule. This property is READ-ONLY. - ImmutableID *string `json:"immutableId,omitempty"` - // DataSources - The specification of data sources. - // This property is optional and can be omitted if the rule is meant to be used via direct calls to the provisioned endpoint. - DataSources *DataCollectionRuleDataSources `json:"dataSources,omitempty"` - // Destinations - The specification of destinations. - Destinations *DataCollectionRuleDestinations `json:"destinations,omitempty"` - // DataFlows - The specification of data flows. - DataFlows *[]DataFlow `json:"dataFlows,omitempty"` - // ProvisioningState - READ-ONLY; The resource provisioning state. Possible values include: 'KnownDataCollectionRuleProvisioningStateCreating', 'KnownDataCollectionRuleProvisioningStateUpdating', 'KnownDataCollectionRuleProvisioningStateDeleting', 'KnownDataCollectionRuleProvisioningStateSucceeded', 'KnownDataCollectionRuleProvisioningStateFailed' - ProvisioningState KnownDataCollectionRuleProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataCollectionRule. -func (dcr DataCollectionRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcr.Description != nil { - objectMap["description"] = dcr.Description - } - if dcr.DataSources != nil { - objectMap["dataSources"] = dcr.DataSources - } - if dcr.Destinations != nil { - objectMap["destinations"] = dcr.Destinations - } - if dcr.DataFlows != nil { - objectMap["dataFlows"] = dcr.DataFlows - } - return json.Marshal(objectMap) -} - -// DataCollectionRuleAssociation definition of association of a data collection rule with a monitored Azure -// resource. -type DataCollectionRuleAssociation struct { - // Description - Description of the association. - Description *string `json:"description,omitempty"` - // DataCollectionRuleID - The resource ID of the data collection rule that is to be associated. - DataCollectionRuleID *string `json:"dataCollectionRuleId,omitempty"` - // DataCollectionEndpointID - The resource ID of the data collection endpoint that is to be associated. - DataCollectionEndpointID *string `json:"dataCollectionEndpointId,omitempty"` - // ProvisioningState - READ-ONLY; The resource provisioning state. Possible values include: 'KnownDataCollectionRuleAssociationProvisioningStateCreating', 'KnownDataCollectionRuleAssociationProvisioningStateUpdating', 'KnownDataCollectionRuleAssociationProvisioningStateDeleting', 'KnownDataCollectionRuleAssociationProvisioningStateSucceeded', 'KnownDataCollectionRuleAssociationProvisioningStateFailed' - ProvisioningState KnownDataCollectionRuleAssociationProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataCollectionRuleAssociation. -func (dcra DataCollectionRuleAssociation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcra.Description != nil { - objectMap["description"] = dcra.Description - } - if dcra.DataCollectionRuleID != nil { - objectMap["dataCollectionRuleId"] = dcra.DataCollectionRuleID - } - if dcra.DataCollectionEndpointID != nil { - objectMap["dataCollectionEndpointId"] = dcra.DataCollectionEndpointID - } - return json.Marshal(objectMap) -} - -// DataCollectionRuleAssociationProxyOnlyResource definition of generic ARM proxy resource. -type DataCollectionRuleAssociationProxyOnlyResource struct { - autorest.Response `json:"-"` - // DataCollectionRuleAssociationProxyOnlyResourceProperties - Resource properties. - *DataCollectionRuleAssociationProxyOnlyResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified ID of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; Resource entity tag (ETag). - Etag *string `json:"etag,omitempty"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *DataCollectionRuleAssociationProxyOnlyResourceSystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataCollectionRuleAssociationProxyOnlyResource. -func (dcrapor DataCollectionRuleAssociationProxyOnlyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcrapor.DataCollectionRuleAssociationProxyOnlyResourceProperties != nil { - objectMap["properties"] = dcrapor.DataCollectionRuleAssociationProxyOnlyResourceProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DataCollectionRuleAssociationProxyOnlyResource struct. -func (dcrapor *DataCollectionRuleAssociationProxyOnlyResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var dataCollectionRuleAssociationProxyOnlyResourceProperties DataCollectionRuleAssociationProxyOnlyResourceProperties - err = json.Unmarshal(*v, &dataCollectionRuleAssociationProxyOnlyResourceProperties) - if err != nil { - return err - } - dcrapor.DataCollectionRuleAssociationProxyOnlyResourceProperties = &dataCollectionRuleAssociationProxyOnlyResourceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dcrapor.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dcrapor.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dcrapor.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - dcrapor.Etag = &etag - } - case "systemData": - if v != nil { - var systemData DataCollectionRuleAssociationProxyOnlyResourceSystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - dcrapor.SystemData = &systemData - } - } - } - - return nil -} - -// DataCollectionRuleAssociationProxyOnlyResourceListResult a pageable list of resources. -type DataCollectionRuleAssociationProxyOnlyResourceListResult struct { - autorest.Response `json:"-"` - // Value - A list of resources. - Value *[]DataCollectionRuleAssociationProxyOnlyResource `json:"value,omitempty"` - // NextLink - The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// DataCollectionRuleAssociationProxyOnlyResourceListResultIterator provides access to a complete listing -// of DataCollectionRuleAssociationProxyOnlyResource values. -type DataCollectionRuleAssociationProxyOnlyResourceListResultIterator struct { - i int - page DataCollectionRuleAssociationProxyOnlyResourceListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *DataCollectionRuleAssociationProxyOnlyResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationProxyOnlyResourceListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *DataCollectionRuleAssociationProxyOnlyResourceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DataCollectionRuleAssociationProxyOnlyResourceListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter DataCollectionRuleAssociationProxyOnlyResourceListResultIterator) Response() DataCollectionRuleAssociationProxyOnlyResourceListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter DataCollectionRuleAssociationProxyOnlyResourceListResultIterator) Value() DataCollectionRuleAssociationProxyOnlyResource { - if !iter.page.NotDone() { - return DataCollectionRuleAssociationProxyOnlyResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DataCollectionRuleAssociationProxyOnlyResourceListResultIterator type. -func NewDataCollectionRuleAssociationProxyOnlyResourceListResultIterator(page DataCollectionRuleAssociationProxyOnlyResourceListResultPage) DataCollectionRuleAssociationProxyOnlyResourceListResultIterator { - return DataCollectionRuleAssociationProxyOnlyResourceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dcraporlr DataCollectionRuleAssociationProxyOnlyResourceListResult) IsEmpty() bool { - return dcraporlr.Value == nil || len(*dcraporlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dcraporlr DataCollectionRuleAssociationProxyOnlyResourceListResult) hasNextLink() bool { - return dcraporlr.NextLink != nil && len(*dcraporlr.NextLink) != 0 -} - -// dataCollectionRuleAssociationProxyOnlyResourceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dcraporlr DataCollectionRuleAssociationProxyOnlyResourceListResult) dataCollectionRuleAssociationProxyOnlyResourceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dcraporlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dcraporlr.NextLink))) -} - -// DataCollectionRuleAssociationProxyOnlyResourceListResultPage contains a page of -// DataCollectionRuleAssociationProxyOnlyResource values. -type DataCollectionRuleAssociationProxyOnlyResourceListResultPage struct { - fn func(context.Context, DataCollectionRuleAssociationProxyOnlyResourceListResult) (DataCollectionRuleAssociationProxyOnlyResourceListResult, error) - dcraporlr DataCollectionRuleAssociationProxyOnlyResourceListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *DataCollectionRuleAssociationProxyOnlyResourceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationProxyOnlyResourceListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.dcraporlr) - if err != nil { - return err - } - page.dcraporlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *DataCollectionRuleAssociationProxyOnlyResourceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DataCollectionRuleAssociationProxyOnlyResourceListResultPage) NotDone() bool { - return !page.dcraporlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DataCollectionRuleAssociationProxyOnlyResourceListResultPage) Response() DataCollectionRuleAssociationProxyOnlyResourceListResult { - return page.dcraporlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DataCollectionRuleAssociationProxyOnlyResourceListResultPage) Values() []DataCollectionRuleAssociationProxyOnlyResource { - if page.dcraporlr.IsEmpty() { - return nil - } - return *page.dcraporlr.Value -} - -// Creates a new instance of the DataCollectionRuleAssociationProxyOnlyResourceListResultPage type. -func NewDataCollectionRuleAssociationProxyOnlyResourceListResultPage(cur DataCollectionRuleAssociationProxyOnlyResourceListResult, getNextPage func(context.Context, DataCollectionRuleAssociationProxyOnlyResourceListResult) (DataCollectionRuleAssociationProxyOnlyResourceListResult, error)) DataCollectionRuleAssociationProxyOnlyResourceListResultPage { - return DataCollectionRuleAssociationProxyOnlyResourceListResultPage{ - fn: getNextPage, - dcraporlr: cur, - } -} - -// DataCollectionRuleAssociationProxyOnlyResourceProperties resource properties. -type DataCollectionRuleAssociationProxyOnlyResourceProperties struct { - // Description - Description of the association. - Description *string `json:"description,omitempty"` - // DataCollectionRuleID - The resource ID of the data collection rule that is to be associated. - DataCollectionRuleID *string `json:"dataCollectionRuleId,omitempty"` - // DataCollectionEndpointID - The resource ID of the data collection endpoint that is to be associated. - DataCollectionEndpointID *string `json:"dataCollectionEndpointId,omitempty"` - // ProvisioningState - READ-ONLY; The resource provisioning state. Possible values include: 'KnownDataCollectionRuleAssociationProvisioningStateCreating', 'KnownDataCollectionRuleAssociationProvisioningStateUpdating', 'KnownDataCollectionRuleAssociationProvisioningStateDeleting', 'KnownDataCollectionRuleAssociationProvisioningStateSucceeded', 'KnownDataCollectionRuleAssociationProvisioningStateFailed' - ProvisioningState KnownDataCollectionRuleAssociationProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataCollectionRuleAssociationProxyOnlyResourceProperties. -func (dcrapor DataCollectionRuleAssociationProxyOnlyResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcrapor.Description != nil { - objectMap["description"] = dcrapor.Description - } - if dcrapor.DataCollectionRuleID != nil { - objectMap["dataCollectionRuleId"] = dcrapor.DataCollectionRuleID - } - if dcrapor.DataCollectionEndpointID != nil { - objectMap["dataCollectionEndpointId"] = dcrapor.DataCollectionEndpointID - } - return json.Marshal(objectMap) -} - -// DataCollectionRuleAssociationProxyOnlyResourceSystemData metadata pertaining to creation and last -// modification of the resource. -type DataCollectionRuleAssociationProxyOnlyResourceSystemData struct { - // CreatedBy - The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - CreatedByType CreatedByType `json:"createdByType,omitempty"` - // CreatedAt - The timestamp of resource creation (UTC). - CreatedAt *date.Time `json:"createdAt,omitempty"` - // LastModifiedBy - The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The timestamp of resource last modification (UTC) - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// DataCollectionRuleDataSources the specification of data sources. -// This property is optional and can be omitted if the rule is meant to be used via direct calls to the -// provisioned endpoint. -type DataCollectionRuleDataSources struct { - // PerformanceCounters - The list of performance counter data source configurations. - PerformanceCounters *[]PerfCounterDataSource `json:"performanceCounters,omitempty"` - // WindowsEventLogs - The list of Windows Event Log data source configurations. - WindowsEventLogs *[]WindowsEventLogDataSource `json:"windowsEventLogs,omitempty"` - // Syslog - The list of Syslog data source configurations. - Syslog *[]SyslogDataSource `json:"syslog,omitempty"` - // Extensions - The list of Azure VM extension data source configurations. - Extensions *[]ExtensionDataSource `json:"extensions,omitempty"` -} - -// DataCollectionRuleDestinations the specification of destinations. -type DataCollectionRuleDestinations struct { - // LogAnalytics - List of Log Analytics destinations. - LogAnalytics *[]LogAnalyticsDestination `json:"logAnalytics,omitempty"` - // AzureMonitorMetrics - Azure Monitor Metrics destination. - AzureMonitorMetrics *DestinationsSpecAzureMonitorMetrics `json:"azureMonitorMetrics,omitempty"` -} - -// DataCollectionRuleResource definition of ARM tracked top level resource. -type DataCollectionRuleResource struct { - autorest.Response `json:"-"` - // DataCollectionRuleResourceProperties - Resource properties. - *DataCollectionRuleResourceProperties `json:"properties,omitempty"` - // Location - The geo-location where the resource lives. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Kind - The kind of the resource. Possible values include: 'KnownDataCollectionRuleResourceKindLinux', 'KnownDataCollectionRuleResourceKindWindows' - Kind KnownDataCollectionRuleResourceKind `json:"kind,omitempty"` - // ID - READ-ONLY; Fully qualified ID of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; Resource entity tag (ETag). - Etag *string `json:"etag,omitempty"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *DataCollectionRuleResourceSystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataCollectionRuleResource. -func (dcrr DataCollectionRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcrr.DataCollectionRuleResourceProperties != nil { - objectMap["properties"] = dcrr.DataCollectionRuleResourceProperties - } - if dcrr.Location != nil { - objectMap["location"] = dcrr.Location - } - if dcrr.Tags != nil { - objectMap["tags"] = dcrr.Tags - } - if dcrr.Kind != "" { - objectMap["kind"] = dcrr.Kind - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DataCollectionRuleResource struct. -func (dcrr *DataCollectionRuleResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var dataCollectionRuleResourceProperties DataCollectionRuleResourceProperties - err = json.Unmarshal(*v, &dataCollectionRuleResourceProperties) - if err != nil { - return err - } - dcrr.DataCollectionRuleResourceProperties = &dataCollectionRuleResourceProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dcrr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dcrr.Tags = tags - } - case "kind": - if v != nil { - var kind KnownDataCollectionRuleResourceKind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dcrr.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dcrr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dcrr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dcrr.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - dcrr.Etag = &etag - } - case "systemData": - if v != nil { - var systemData DataCollectionRuleResourceSystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - dcrr.SystemData = &systemData - } - } - } - - return nil -} - -// DataCollectionRuleResourceListResult a pageable list of resources. -type DataCollectionRuleResourceListResult struct { - autorest.Response `json:"-"` - // Value - A list of resources. - Value *[]DataCollectionRuleResource `json:"value,omitempty"` - // NextLink - The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// DataCollectionRuleResourceListResultIterator provides access to a complete listing of -// DataCollectionRuleResource values. -type DataCollectionRuleResourceListResultIterator struct { - i int - page DataCollectionRuleResourceListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *DataCollectionRuleResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleResourceListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *DataCollectionRuleResourceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DataCollectionRuleResourceListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter DataCollectionRuleResourceListResultIterator) Response() DataCollectionRuleResourceListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter DataCollectionRuleResourceListResultIterator) Value() DataCollectionRuleResource { - if !iter.page.NotDone() { - return DataCollectionRuleResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DataCollectionRuleResourceListResultIterator type. -func NewDataCollectionRuleResourceListResultIterator(page DataCollectionRuleResourceListResultPage) DataCollectionRuleResourceListResultIterator { - return DataCollectionRuleResourceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dcrrlr DataCollectionRuleResourceListResult) IsEmpty() bool { - return dcrrlr.Value == nil || len(*dcrrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dcrrlr DataCollectionRuleResourceListResult) hasNextLink() bool { - return dcrrlr.NextLink != nil && len(*dcrrlr.NextLink) != 0 -} - -// dataCollectionRuleResourceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dcrrlr DataCollectionRuleResourceListResult) dataCollectionRuleResourceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dcrrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dcrrlr.NextLink))) -} - -// DataCollectionRuleResourceListResultPage contains a page of DataCollectionRuleResource values. -type DataCollectionRuleResourceListResultPage struct { - fn func(context.Context, DataCollectionRuleResourceListResult) (DataCollectionRuleResourceListResult, error) - dcrrlr DataCollectionRuleResourceListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *DataCollectionRuleResourceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleResourceListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.dcrrlr) - if err != nil { - return err - } - page.dcrrlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *DataCollectionRuleResourceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DataCollectionRuleResourceListResultPage) NotDone() bool { - return !page.dcrrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DataCollectionRuleResourceListResultPage) Response() DataCollectionRuleResourceListResult { - return page.dcrrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DataCollectionRuleResourceListResultPage) Values() []DataCollectionRuleResource { - if page.dcrrlr.IsEmpty() { - return nil - } - return *page.dcrrlr.Value -} - -// Creates a new instance of the DataCollectionRuleResourceListResultPage type. -func NewDataCollectionRuleResourceListResultPage(cur DataCollectionRuleResourceListResult, getNextPage func(context.Context, DataCollectionRuleResourceListResult) (DataCollectionRuleResourceListResult, error)) DataCollectionRuleResourceListResultPage { - return DataCollectionRuleResourceListResultPage{ - fn: getNextPage, - dcrrlr: cur, - } -} - -// DataCollectionRuleResourceProperties resource properties. -type DataCollectionRuleResourceProperties struct { - // Description - Description of the data collection rule. - Description *string `json:"description,omitempty"` - // ImmutableID - READ-ONLY; The immutable ID of this data collection rule. This property is READ-ONLY. - ImmutableID *string `json:"immutableId,omitempty"` - // DataSources - The specification of data sources. - // This property is optional and can be omitted if the rule is meant to be used via direct calls to the provisioned endpoint. - DataSources *DataCollectionRuleDataSources `json:"dataSources,omitempty"` - // Destinations - The specification of destinations. - Destinations *DataCollectionRuleDestinations `json:"destinations,omitempty"` - // DataFlows - The specification of data flows. - DataFlows *[]DataFlow `json:"dataFlows,omitempty"` - // ProvisioningState - READ-ONLY; The resource provisioning state. Possible values include: 'KnownDataCollectionRuleProvisioningStateCreating', 'KnownDataCollectionRuleProvisioningStateUpdating', 'KnownDataCollectionRuleProvisioningStateDeleting', 'KnownDataCollectionRuleProvisioningStateSucceeded', 'KnownDataCollectionRuleProvisioningStateFailed' - ProvisioningState KnownDataCollectionRuleProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataCollectionRuleResourceProperties. -func (dcrr DataCollectionRuleResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcrr.Description != nil { - objectMap["description"] = dcrr.Description - } - if dcrr.DataSources != nil { - objectMap["dataSources"] = dcrr.DataSources - } - if dcrr.Destinations != nil { - objectMap["destinations"] = dcrr.Destinations - } - if dcrr.DataFlows != nil { - objectMap["dataFlows"] = dcrr.DataFlows - } - return json.Marshal(objectMap) -} - -// DataCollectionRuleResourceSystemData metadata pertaining to creation and last modification of the -// resource. -type DataCollectionRuleResourceSystemData struct { - // CreatedBy - The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - CreatedByType CreatedByType `json:"createdByType,omitempty"` - // CreatedAt - The timestamp of resource creation (UTC). - CreatedAt *date.Time `json:"createdAt,omitempty"` - // LastModifiedBy - The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The timestamp of resource last modification (UTC) - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// DataContainer information about a container with data for a given resource. -type DataContainer struct { - // Workspace - Log Analytics workspace information. - Workspace *WorkspaceInfo `json:"workspace,omitempty"` -} - -// DataFlow definition of which streams are sent to which destinations. -type DataFlow struct { - // Streams - List of streams for this data flow. - Streams *[]KnownDataFlowStreams `json:"streams,omitempty"` - // Destinations - List of destinations for this data flow. - Destinations *[]string `json:"destinations,omitempty"` -} - -// DataSourcesSpec specification of data sources that will be collected. -type DataSourcesSpec struct { - // PerformanceCounters - The list of performance counter data source configurations. - PerformanceCounters *[]PerfCounterDataSource `json:"performanceCounters,omitempty"` - // WindowsEventLogs - The list of Windows Event Log data source configurations. - WindowsEventLogs *[]WindowsEventLogDataSource `json:"windowsEventLogs,omitempty"` - // Syslog - The list of Syslog data source configurations. - Syslog *[]SyslogDataSource `json:"syslog,omitempty"` - // Extensions - The list of Azure VM extension data source configurations. - Extensions *[]ExtensionDataSource `json:"extensions,omitempty"` -} - -// DestinationsSpec specification of destinations that can be used in data flows. -type DestinationsSpec struct { - // LogAnalytics - List of Log Analytics destinations. - LogAnalytics *[]LogAnalyticsDestination `json:"logAnalytics,omitempty"` - // AzureMonitorMetrics - Azure Monitor Metrics destination. - AzureMonitorMetrics *DestinationsSpecAzureMonitorMetrics `json:"azureMonitorMetrics,omitempty"` -} - -// DestinationsSpecAzureMonitorMetrics azure Monitor Metrics destination. -type DestinationsSpecAzureMonitorMetrics struct { - // Name - A friendly name for the destination. - // This name should be unique across all destinations (regardless of type) within the data collection rule. - Name *string `json:"name,omitempty"` -} - -// DiagnosticSettings the diagnostic settings. -type DiagnosticSettings struct { - // StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs. - StorageAccountID *string `json:"storageAccountId,omitempty"` - // ServiceBusRuleID - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. - ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` - // EventHubAuthorizationRuleID - The resource Id for the event hub authorization rule. - EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"` - // EventHubName - The name of the event hub. If none is specified, the default event hub will be selected. - EventHubName *string `json:"eventHubName,omitempty"` - // Metrics - The list of metric settings. - Metrics *[]MetricSettings `json:"metrics,omitempty"` - // Logs - The list of logs settings. - Logs *[]LogSettings `json:"logs,omitempty"` - // WorkspaceID - The full ARM resource ID of the 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 - WorkspaceID *string `json:"workspaceId,omitempty"` - // LogAnalyticsDestinationType - A string indicating whether the export to Log Analytics should use the default destination type, i.e. AzureDiagnostics, or use a destination type constructed as follows: _. Possible values are: Dedicated and null (null is default.) - LogAnalyticsDestinationType *string `json:"logAnalyticsDestinationType,omitempty"` -} - -// DiagnosticSettingsCategory the diagnostic settings Category. -type DiagnosticSettingsCategory struct { - // CategoryType - The type of the diagnostic settings category. Possible values include: 'CategoryTypeMetrics', 'CategoryTypeLogs' - CategoryType CategoryType `json:"categoryType,omitempty"` -} - -// DiagnosticSettingsCategoryResource the diagnostic settings category resource. -type DiagnosticSettingsCategoryResource struct { - autorest.Response `json:"-"` - // DiagnosticSettingsCategory - The properties of a Diagnostic Settings Category. - *DiagnosticSettingsCategory `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DiagnosticSettingsCategoryResource. -func (dscr DiagnosticSettingsCategoryResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dscr.DiagnosticSettingsCategory != nil { - objectMap["properties"] = dscr.DiagnosticSettingsCategory - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsCategoryResource struct. -func (dscr *DiagnosticSettingsCategoryResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var diagnosticSettingsCategory DiagnosticSettingsCategory - err = json.Unmarshal(*v, &diagnosticSettingsCategory) - if err != nil { - return err - } - dscr.DiagnosticSettingsCategory = &diagnosticSettingsCategory - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dscr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dscr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dscr.Type = &typeVar - } - } - } - - return nil -} - -// DiagnosticSettingsCategoryResourceCollection represents a collection of diagnostic setting category -// resources. -type DiagnosticSettingsCategoryResourceCollection struct { - autorest.Response `json:"-"` - // Value - The collection of diagnostic settings category resources. - Value *[]DiagnosticSettingsCategoryResource `json:"value,omitempty"` -} - -// DiagnosticSettingsResource the diagnostic setting resource. -type DiagnosticSettingsResource struct { - autorest.Response `json:"-"` - // DiagnosticSettings - Properties of a Diagnostic Settings Resource. - *DiagnosticSettings `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DiagnosticSettingsResource. -func (dsr DiagnosticSettingsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dsr.DiagnosticSettings != nil { - objectMap["properties"] = dsr.DiagnosticSettings - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsResource struct. -func (dsr *DiagnosticSettingsResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var diagnosticSettings DiagnosticSettings - err = json.Unmarshal(*v, &diagnosticSettings) - if err != nil { - return err - } - dsr.DiagnosticSettings = &diagnosticSettings - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dsr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dsr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dsr.Type = &typeVar - } - } - } - - return nil -} - -// DiagnosticSettingsResourceCollection represents a collection of alert rule resources. -type DiagnosticSettingsResourceCollection struct { - autorest.Response `json:"-"` - // Value - The collection of diagnostic settings resources;. - Value *[]DiagnosticSettingsResource `json:"value,omitempty"` -} - -// Dimension specifies the criteria for converting log to metric. -type Dimension struct { - // Name - Name of the dimension - Name *string `json:"name,omitempty"` - // Operator - Operator for dimension values - Operator *string `json:"operator,omitempty"` - // Values - List of dimension values - Values *[]string `json:"values,omitempty"` -} - -// DynamicMetricCriteria criterion for dynamic threshold. -type DynamicMetricCriteria struct { - // Operator - The operator used to compare the metric value against the threshold. Possible values include: 'DynamicThresholdOperatorGreaterThan', 'DynamicThresholdOperatorLessThan', 'DynamicThresholdOperatorGreaterOrLessThan' - Operator DynamicThresholdOperator `json:"operator,omitempty"` - // AlertSensitivity - The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern. Possible values include: 'DynamicThresholdSensitivityLow', 'DynamicThresholdSensitivityMedium', 'DynamicThresholdSensitivityHigh' - AlertSensitivity DynamicThresholdSensitivity `json:"alertSensitivity,omitempty"` - // FailingPeriods - The minimum number of violations required within the selected lookback time window required to raise an alert. - FailingPeriods *DynamicThresholdFailingPeriods `json:"failingPeriods,omitempty"` - // IgnoreDataBefore - Use this option to set the date from which to start learning the metric historical data and calculate the dynamic thresholds (in ISO8601 format) - IgnoreDataBefore *date.Time `json:"ignoreDataBefore,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Name - Name of the criteria. - Name *string `json:"name,omitempty"` - // MetricName - Name of the metric. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - Namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' - TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` - // Dimensions - List of dimension conditions. - Dimensions *[]MetricDimension `json:"dimensions,omitempty"` - // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` - // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' - CriterionType CriterionType `json:"criterionType,omitempty"` -} - -// MarshalJSON is the custom marshaler for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) MarshalJSON() ([]byte, error) { - dmc.CriterionType = CriterionTypeDynamicThresholdCriterion - objectMap := make(map[string]interface{}) - if dmc.Operator != "" { - objectMap["operator"] = dmc.Operator - } - if dmc.AlertSensitivity != "" { - objectMap["alertSensitivity"] = dmc.AlertSensitivity - } - if dmc.FailingPeriods != nil { - objectMap["failingPeriods"] = dmc.FailingPeriods - } - if dmc.IgnoreDataBefore != nil { - objectMap["ignoreDataBefore"] = dmc.IgnoreDataBefore - } - if dmc.Name != nil { - objectMap["name"] = dmc.Name - } - if dmc.MetricName != nil { - objectMap["metricName"] = dmc.MetricName - } - if dmc.MetricNamespace != nil { - objectMap["metricNamespace"] = dmc.MetricNamespace - } - if dmc.TimeAggregation != "" { - objectMap["timeAggregation"] = dmc.TimeAggregation - } - if dmc.Dimensions != nil { - objectMap["dimensions"] = dmc.Dimensions - } - if dmc.SkipMetricValidation != nil { - objectMap["skipMetricValidation"] = dmc.SkipMetricValidation - } - if dmc.CriterionType != "" { - objectMap["criterionType"] = dmc.CriterionType - } - for k, v := range dmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { - return nil, false -} - -// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { - return &dmc, true -} - -// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { - return nil, false -} - -// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { - return &dmc, true -} - -// UnmarshalJSON is the custom unmarshaler for DynamicMetricCriteria struct. -func (dmc *DynamicMetricCriteria) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "operator": - if v != nil { - var operator DynamicThresholdOperator - err = json.Unmarshal(*v, &operator) - if err != nil { - return err - } - dmc.Operator = operator - } - case "alertSensitivity": - if v != nil { - var alertSensitivity DynamicThresholdSensitivity - err = json.Unmarshal(*v, &alertSensitivity) - if err != nil { - return err - } - dmc.AlertSensitivity = alertSensitivity - } - case "failingPeriods": - if v != nil { - var failingPeriods DynamicThresholdFailingPeriods - err = json.Unmarshal(*v, &failingPeriods) - if err != nil { - return err - } - dmc.FailingPeriods = &failingPeriods - } - case "ignoreDataBefore": - if v != nil { - var ignoreDataBefore date.Time - err = json.Unmarshal(*v, &ignoreDataBefore) - if err != nil { - return err - } - dmc.IgnoreDataBefore = &ignoreDataBefore - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if dmc.AdditionalProperties == nil { - dmc.AdditionalProperties = make(map[string]interface{}) - } - dmc.AdditionalProperties[k] = additionalProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dmc.Name = &name - } - case "metricName": - if v != nil { - var metricName string - err = json.Unmarshal(*v, &metricName) - if err != nil { - return err - } - dmc.MetricName = &metricName - } - case "metricNamespace": - if v != nil { - var metricNamespace string - err = json.Unmarshal(*v, &metricNamespace) - if err != nil { - return err - } - dmc.MetricNamespace = &metricNamespace - } - case "timeAggregation": - if v != nil { - var timeAggregation AggregationTypeEnum - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - dmc.TimeAggregation = timeAggregation - } - case "dimensions": - if v != nil { - var dimensions []MetricDimension - err = json.Unmarshal(*v, &dimensions) - if err != nil { - return err - } - dmc.Dimensions = &dimensions - } - case "skipMetricValidation": - if v != nil { - var skipMetricValidation bool - err = json.Unmarshal(*v, &skipMetricValidation) - if err != nil { - return err - } - dmc.SkipMetricValidation = &skipMetricValidation - } - case "criterionType": - if v != nil { - var criterionType CriterionType - err = json.Unmarshal(*v, &criterionType) - if err != nil { - return err - } - dmc.CriterionType = criterionType - } - } - } - - return nil -} - -// DynamicThresholdFailingPeriods the minimum number of violations required within the selected lookback -// time window required to raise an alert. -type DynamicThresholdFailingPeriods struct { - // NumberOfEvaluationPeriods - 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. - NumberOfEvaluationPeriods *float64 `json:"numberOfEvaluationPeriods,omitempty"` - // MinFailingPeriodsToAlert - The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. - MinFailingPeriodsToAlert *float64 `json:"minFailingPeriodsToAlert,omitempty"` -} - -// EmailNotification email notification of an autoscale event. -type EmailNotification struct { - // SendToSubscriptionAdministrator - a value indicating whether to send email to subscription administrator. - SendToSubscriptionAdministrator *bool `json:"sendToSubscriptionAdministrator,omitempty"` - // SendToSubscriptionCoAdministrators - a value indicating whether to send email to subscription co-administrators. - SendToSubscriptionCoAdministrators *bool `json:"sendToSubscriptionCoAdministrators,omitempty"` - // CustomEmails - the custom e-mails list. This value can be null or empty, in which case this attribute will be ignored. - CustomEmails *[]string `json:"customEmails,omitempty"` -} - -// EmailReceiver an email receiver. -type EmailReceiver struct { - // Name - The name of the email receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // EmailAddress - The email address of this receiver. - EmailAddress *string `json:"emailAddress,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` - // Status - READ-ONLY; The receiver status of the e-mail. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled' - Status ReceiverStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for EmailReceiver. -func (er EmailReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if er.Name != nil { - objectMap["name"] = er.Name - } - if er.EmailAddress != nil { - objectMap["emailAddress"] = er.EmailAddress - } - if er.UseCommonAlertSchema != nil { - objectMap["useCommonAlertSchema"] = er.UseCommonAlertSchema - } - return json.Marshal(objectMap) -} - -// EnableRequest describes a receiver that should be resubscribed. -type EnableRequest struct { - // ReceiverName - The name of the receiver to resubscribe. - ReceiverName *string `json:"receiverName,omitempty"` -} - -// Error error details. -type Error struct { - // Code - Error code identifying the specific error. - Code *string `json:"code,omitempty"` - // Message - Error message in the caller's locale. - Message *string `json:"message,omitempty"` -} - -// ErrorAdditionalInfo the resource management error additional info. -type ErrorAdditionalInfo struct { - // Type - READ-ONLY; The additional info type. - Type *string `json:"type,omitempty"` - // Info - READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. -func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorContract describes the format of Error response. -type ErrorContract struct { - // Error - The error details. - Error *ErrorResponse `json:"error,omitempty"` -} - -// ErrorDetail the error detail. -type ErrorDetail struct { - // Code - READ-ONLY; The error code. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; The error message. - Message *string `json:"message,omitempty"` - // Target - READ-ONLY; The error target. - Target *string `json:"target,omitempty"` - // Details - READ-ONLY; The error details. - Details *[]ErrorDetail `json:"details,omitempty"` - // AdditionalInfo - READ-ONLY; The error additional info. - AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorDetail. -func (ed ErrorDetail) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorResponse describes the format of Error response. -type ErrorResponse struct { - // Code - Error code - Code *string `json:"code,omitempty"` - // Message - Error message indicating why the operation failed. - Message *string `json:"message,omitempty"` -} - -// ErrorResponseCommon the resource management error response. -type ErrorResponseCommon struct { - // Details - READ-ONLY; The error details. - Details *[]ErrorResponseCommon `json:"details,omitempty"` - // AdditionalInfo - READ-ONLY; The error additional info. - AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` - // Code - Error code - Code *string `json:"code,omitempty"` - // Message - Error message indicating why the operation failed. - Message *string `json:"message,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorResponseCommon. -func (erc ErrorResponseCommon) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erc.Code != nil { - objectMap["code"] = erc.Code - } - if erc.Message != nil { - objectMap["message"] = erc.Message - } - return json.Marshal(objectMap) -} - -// ErrorResponseCommonV2 common error response for all Azure Resource Manager APIs to return error details -// for failed operations. (This also follows the OData error response format.). -type ErrorResponseCommonV2 struct { - // Error - The error object. - Error *ErrorDetail `json:"error,omitempty"` -} - -// EventCategoryCollection a collection of event categories. Currently possible values are: Administrative, -// Security, ServiceHealth, Alert, Recommendation, Policy. -type EventCategoryCollection struct { - autorest.Response `json:"-"` - // Value - the list that includes the Azure event categories. - Value *[]LocalizableString `json:"value,omitempty"` -} - -// EventData the Azure event log entries are of type EventData -type EventData struct { - // Authorization - READ-ONLY; The sender authorization information. - Authorization *SenderAuthorization `json:"authorization,omitempty"` - // Claims - READ-ONLY; key value pairs to identify ARM permissions. - Claims map[string]*string `json:"claims"` - // Caller - READ-ONLY; the email address of the user who has performed the operation, the UPN claim or SPN claim based on availability. - Caller *string `json:"caller,omitempty"` - // Description - READ-ONLY; the description of the event. - Description *string `json:"description,omitempty"` - // ID - READ-ONLY; the Id of this event as required by ARM for RBAC. It contains the EventDataID and a timestamp information. - ID *string `json:"id,omitempty"` - // EventDataID - READ-ONLY; the event data Id. This is a unique identifier for an event. - EventDataID *string `json:"eventDataId,omitempty"` - // CorrelationID - READ-ONLY; 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. - CorrelationID *string `json:"correlationId,omitempty"` - // EventName - READ-ONLY; the event name. This value should not be confused with OperationName. For practical purposes, OperationName might be more appealing to end users. - EventName *LocalizableString `json:"eventName,omitempty"` - // Category - READ-ONLY; the event category. - Category *LocalizableString `json:"category,omitempty"` - // HTTPRequest - READ-ONLY; 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). - HTTPRequest *HTTPRequestInfo `json:"httpRequest,omitempty"` - // Level - READ-ONLY; the event level. Possible values include: 'EventLevelCritical', 'EventLevelError', 'EventLevelWarning', 'EventLevelInformational', 'EventLevelVerbose' - Level EventLevel `json:"level,omitempty"` - // ResourceGroupName - READ-ONLY; the resource group name of the impacted resource. - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - // ResourceProviderName - READ-ONLY; the resource provider name of the impacted resource. - ResourceProviderName *LocalizableString `json:"resourceProviderName,omitempty"` - // ResourceID - READ-ONLY; the resource uri that uniquely identifies the resource that caused this event. - ResourceID *string `json:"resourceId,omitempty"` - // ResourceType - READ-ONLY; the resource type - ResourceType *LocalizableString `json:"resourceType,omitempty"` - // OperationID - READ-ONLY; It is usually a GUID shared among the events corresponding to single operation. This value should not be confused with EventName. - OperationID *string `json:"operationId,omitempty"` - // OperationName - READ-ONLY; the operation name. - OperationName *LocalizableString `json:"operationName,omitempty"` - // Properties - READ-ONLY; the set of pairs (usually a Dictionary) that includes details about the event. - Properties map[string]*string `json:"properties"` - // Status - READ-ONLY; a string describing the status of the operation. Some typical values are: Started, In progress, Succeeded, Failed, Resolved. - Status *LocalizableString `json:"status,omitempty"` - // SubStatus - READ-ONLY; 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) - SubStatus *LocalizableString `json:"subStatus,omitempty"` - // EventTimestamp - READ-ONLY; the timestamp of when the event was generated by the Azure service processing the request corresponding the event. It in ISO 8601 format. - EventTimestamp *date.Time `json:"eventTimestamp,omitempty"` - // SubmissionTimestamp - READ-ONLY; 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. - SubmissionTimestamp *date.Time `json:"submissionTimestamp,omitempty"` - // SubscriptionID - READ-ONLY; the Azure subscription Id usually a GUID. - SubscriptionID *string `json:"subscriptionId,omitempty"` - // TenantID - READ-ONLY; the Azure tenant Id - TenantID *string `json:"tenantId,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventData. -func (ed EventData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// EventDataCollection represents collection of events. -type EventDataCollection struct { - autorest.Response `json:"-"` - // Value - this list that includes the Azure audit logs. - Value *[]EventData `json:"value,omitempty"` - // NextLink - Provides the link to retrieve the next set of events. - NextLink *string `json:"nextLink,omitempty"` -} - -// EventDataCollectionIterator provides access to a complete listing of EventData values. -type EventDataCollectionIterator struct { - i int - page EventDataCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *EventDataCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *EventDataCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EventDataCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter EventDataCollectionIterator) Response() EventDataCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter EventDataCollectionIterator) Value() EventData { - if !iter.page.NotDone() { - return EventData{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EventDataCollectionIterator type. -func NewEventDataCollectionIterator(page EventDataCollectionPage) EventDataCollectionIterator { - return EventDataCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (edc EventDataCollection) IsEmpty() bool { - return edc.Value == nil || len(*edc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (edc EventDataCollection) hasNextLink() bool { - return edc.NextLink != nil && len(*edc.NextLink) != 0 -} - -// eventDataCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (edc EventDataCollection) eventDataCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !edc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(edc.NextLink))) -} - -// EventDataCollectionPage contains a page of EventData values. -type EventDataCollectionPage struct { - fn func(context.Context, EventDataCollection) (EventDataCollection, error) - edc EventDataCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *EventDataCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.edc) - if err != nil { - return err - } - page.edc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *EventDataCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EventDataCollectionPage) NotDone() bool { - return !page.edc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EventDataCollectionPage) Response() EventDataCollection { - return page.edc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EventDataCollectionPage) Values() []EventData { - if page.edc.IsEmpty() { - return nil - } - return *page.edc.Value -} - -// Creates a new instance of the EventDataCollectionPage type. -func NewEventDataCollectionPage(cur EventDataCollection, getNextPage func(context.Context, EventDataCollection) (EventDataCollection, error)) EventDataCollectionPage { - return EventDataCollectionPage{ - fn: getNextPage, - edc: cur, - } -} - -// ExtensionDataSource definition of which data will be collected from a separate VM extension that -// integrates with the Azure Monitor Agent. -// Collected from either Windows and Linux machines, depending on which extension is defined. -type ExtensionDataSource struct { - // Streams - List of streams that this data source will be sent to. - // A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. - Streams *[]KnownExtensionDataSourceStreams `json:"streams,omitempty"` - // ExtensionName - The name of the VM extension. - ExtensionName *string `json:"extensionName,omitempty"` - // ExtensionSettings - The extension settings. The format is specific for particular extension. - ExtensionSettings interface{} `json:"extensionSettings,omitempty"` - // InputDataSources - The list of data sources this extension needs data from. - InputDataSources *[]string `json:"inputDataSources,omitempty"` - // Name - A friendly name for the data source. - // This name should be unique across all data sources (regardless of type) within the data collection rule. - Name *string `json:"name,omitempty"` -} - -// HTTPRequestInfo the Http request info. -type HTTPRequestInfo struct { - // ClientRequestID - the client request id. - ClientRequestID *string `json:"clientRequestId,omitempty"` - // ClientIPAddress - the client Ip Address - ClientIPAddress *string `json:"clientIpAddress,omitempty"` - // Method - the Http request method. - Method *string `json:"method,omitempty"` - // URI - the Uri. - URI *string `json:"uri,omitempty"` -} - -// Incident an alert incident indicates the activation status of an alert rule. -type Incident struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; Incident name. - Name *string `json:"name,omitempty"` - // RuleName - READ-ONLY; Rule name that is associated with the incident. - RuleName *string `json:"ruleName,omitempty"` - // IsActive - READ-ONLY; A boolean to indicate whether the incident is active or resolved. - IsActive *bool `json:"isActive,omitempty"` - // ActivatedTime - READ-ONLY; The time at which the incident was activated in ISO8601 format. - ActivatedTime *date.Time `json:"activatedTime,omitempty"` - // ResolvedTime - READ-ONLY; The time at which the incident was resolved in ISO8601 format. If null, it means the incident is still active. - ResolvedTime *date.Time `json:"resolvedTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for Incident. -func (i Incident) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// IncidentListResult the List incidents operation response. -type IncidentListResult struct { - autorest.Response `json:"-"` - // Value - the incident collection. - Value *[]Incident `json:"value,omitempty"` -} - -// ItsmReceiver an Itsm receiver. -type ItsmReceiver struct { - // Name - The name of the Itsm receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // WorkspaceID - OMS LA instance identifier. - WorkspaceID *string `json:"workspaceId,omitempty"` - // ConnectionID - Unique identification of ITSM connection among multiple defined in above workspace. - ConnectionID *string `json:"connectionId,omitempty"` - // TicketConfiguration - JSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well. - TicketConfiguration *string `json:"ticketConfiguration,omitempty"` - // Region - Region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' - Region *string `json:"region,omitempty"` -} - -// LocalizableString the localizable string class. -type LocalizableString struct { - // Value - the invariant value. - Value *string `json:"value,omitempty"` - // LocalizedValue - the locale specific value. - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// LocationThresholdRuleCondition a rule condition based on a certain number of locations failing. -type LocationThresholdRuleCondition struct { - // WindowSize - 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. - WindowSize *string `json:"windowSize,omitempty"` - // FailedLocationCount - the number of locations that must fail to activate the alert. - FailedLocationCount *int32 `json:"failedLocationCount,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeBasicRuleConditionOdataTypeRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) MarshalJSON() ([]byte, error) { - ltrc.OdataType = OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition - objectMap := make(map[string]interface{}) - if ltrc.WindowSize != nil { - objectMap["windowSize"] = ltrc.WindowSize - } - if ltrc.FailedLocationCount != nil { - objectMap["failedLocationCount"] = ltrc.FailedLocationCount - } - objectMap["dataSource"] = ltrc.DataSource - if ltrc.OdataType != "" { - objectMap["odata.type"] = ltrc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return <rc, true -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return <rc, true -} - -// UnmarshalJSON is the custom unmarshaler for LocationThresholdRuleCondition struct. -func (ltrc *LocationThresholdRuleCondition) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - ltrc.WindowSize = &windowSize - } - case "failedLocationCount": - if v != nil { - var failedLocationCount int32 - err = json.Unmarshal(*v, &failedLocationCount) - if err != nil { - return err - } - ltrc.FailedLocationCount = &failedLocationCount - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - ltrc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - ltrc.OdataType = odataType - } - } - } - - return nil -} - -// LogAnalyticsDestination log Analytics destination. -type LogAnalyticsDestination struct { - // WorkspaceResourceID - The resource ID of the Log Analytics workspace. - WorkspaceResourceID *string `json:"workspaceResourceId,omitempty"` - // WorkspaceID - READ-ONLY; The Customer ID of the Log Analytics workspace. - WorkspaceID *string `json:"workspaceId,omitempty"` - // Name - A friendly name for the destination. - // This name should be unique across all destinations (regardless of type) within the data collection rule. - Name *string `json:"name,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogAnalyticsDestination. -func (lad LogAnalyticsDestination) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lad.WorkspaceResourceID != nil { - objectMap["workspaceResourceId"] = lad.WorkspaceResourceID - } - if lad.Name != nil { - objectMap["name"] = lad.Name - } - return json.Marshal(objectMap) -} - -// LogicAppReceiver a logic app receiver. -type LogicAppReceiver struct { - // Name - The name of the logic app receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // ResourceID - The azure resource id of the logic app receiver. - ResourceID *string `json:"resourceId,omitempty"` - // CallbackURL - The callback url where http request sent to. - CallbackURL *string `json:"callbackUrl,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` -} - -// LogMetricTrigger a log metrics trigger descriptor. -type LogMetricTrigger struct { - // ThresholdOperator - Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'ConditionalOperatorGreaterThanOrEqual', 'ConditionalOperatorLessThanOrEqual', 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' - ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` - // Threshold - The threshold of the metric trigger. - Threshold *float64 `json:"threshold,omitempty"` - // MetricTriggerType - Metric Trigger Type - 'Consecutive' or 'Total'. Possible values include: 'MetricTriggerTypeConsecutive', 'MetricTriggerTypeTotal' - MetricTriggerType MetricTriggerType `json:"metricTriggerType,omitempty"` - // MetricColumn - Evaluation of metric on a particular column - MetricColumn *string `json:"metricColumn,omitempty"` -} - -// LogProfileCollection represents a collection of log profiles. -type LogProfileCollection struct { - autorest.Response `json:"-"` - // Value - the values of the log profiles. - Value *[]LogProfileResource `json:"value,omitempty"` -} - -// LogProfileProperties the log profile properties. -type LogProfileProperties struct { - // StorageAccountID - the resource id of the storage account to which you would like to send the Activity Log. - StorageAccountID *string `json:"storageAccountId,omitempty"` - // ServiceBusRuleID - 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}'. - ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` - // Locations - 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. - Locations *[]string `json:"locations,omitempty"` - // Categories - the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.' - Categories *[]string `json:"categories,omitempty"` - // RetentionPolicy - the retention policy for the events in the log. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// LogProfileResource the log profile resource. -type LogProfileResource struct { - autorest.Response `json:"-"` - // LogProfileProperties - The log profile properties of the resource. - *LogProfileProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. - Kind *string `json:"kind,omitempty"` - // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogProfileResource. -func (lpr LogProfileResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lpr.LogProfileProperties != nil { - objectMap["properties"] = lpr.LogProfileProperties - } - if lpr.Location != nil { - objectMap["location"] = lpr.Location - } - if lpr.Tags != nil { - objectMap["tags"] = lpr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogProfileResource struct. -func (lpr *LogProfileResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var logProfileProperties LogProfileProperties - err = json.Unmarshal(*v, &logProfileProperties) - if err != nil { - return err - } - lpr.LogProfileProperties = &logProfileProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lpr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lpr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lpr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - lpr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - lpr.Tags = tags - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - lpr.Kind = &kind - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - lpr.Etag = &etag - } - } - } - - return nil -} - -// LogProfileResourcePatch the log profile resource for patch operations. -type LogProfileResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // LogProfileProperties - The log profile properties for an update operation. - *LogProfileProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogProfileResourcePatch. -func (lprp LogProfileResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lprp.Tags != nil { - objectMap["tags"] = lprp.Tags - } - if lprp.LogProfileProperties != nil { - objectMap["properties"] = lprp.LogProfileProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogProfileResourcePatch struct. -func (lprp *LogProfileResourcePatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - lprp.Tags = tags - } - case "properties": - if v != nil { - var logProfileProperties LogProfileProperties - err = json.Unmarshal(*v, &logProfileProperties) - if err != nil { - return err - } - lprp.LogProfileProperties = &logProfileProperties - } - } - } - - return nil -} - -// LogSearchRule log Search Rule Definition -type LogSearchRule struct { - // CreatedWithAPIVersion - READ-ONLY; The api-version used when creating this alert rule - CreatedWithAPIVersion *string `json:"createdWithApiVersion,omitempty"` - // IsLegacyLogAnalyticsRule - READ-ONLY; True if alert rule is legacy Log Analytic rule - IsLegacyLogAnalyticsRule *bool `json:"isLegacyLogAnalyticsRule,omitempty"` - // Description - The description of the Log Search rule. - Description *string `json:"description,omitempty"` - // DisplayName - The display name of the alert rule - DisplayName *string `json:"displayName,omitempty"` - // AutoMitigate - The flag that indicates whether the alert should be automatically resolved or not. The default is false. - AutoMitigate *bool `json:"autoMitigate,omitempty"` - // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'EnabledTrue', 'EnabledFalse' - Enabled Enabled `json:"enabled,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in IS08601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the scheduled query rule. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateDeploying', 'ProvisioningStateCanceled', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Source - Data Source against which rule will Query Data - Source *Source `json:"source,omitempty"` - // Schedule - Schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction - Schedule *Schedule `json:"schedule,omitempty"` - // Action - Action needs to be taken on rule execution. - Action BasicAction `json:"action,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogSearchRule. -func (lsr LogSearchRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lsr.Description != nil { - objectMap["description"] = lsr.Description - } - if lsr.DisplayName != nil { - objectMap["displayName"] = lsr.DisplayName - } - if lsr.AutoMitigate != nil { - objectMap["autoMitigate"] = lsr.AutoMitigate - } - if lsr.Enabled != "" { - objectMap["enabled"] = lsr.Enabled - } - if lsr.Source != nil { - objectMap["source"] = lsr.Source - } - if lsr.Schedule != nil { - objectMap["schedule"] = lsr.Schedule - } - objectMap["action"] = lsr.Action - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogSearchRule struct. -func (lsr *LogSearchRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "createdWithApiVersion": - if v != nil { - var createdWithAPIVersion string - err = json.Unmarshal(*v, &createdWithAPIVersion) - if err != nil { - return err - } - lsr.CreatedWithAPIVersion = &createdWithAPIVersion - } - case "isLegacyLogAnalyticsRule": - if v != nil { - var isLegacyLogAnalyticsRule bool - err = json.Unmarshal(*v, &isLegacyLogAnalyticsRule) - if err != nil { - return err - } - lsr.IsLegacyLogAnalyticsRule = &isLegacyLogAnalyticsRule - } - case "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - lsr.Description = &description - } - case "displayName": - if v != nil { - var displayName string - err = json.Unmarshal(*v, &displayName) - if err != nil { - return err - } - lsr.DisplayName = &displayName - } - case "autoMitigate": - if v != nil { - var autoMitigate bool - err = json.Unmarshal(*v, &autoMitigate) - if err != nil { - return err - } - lsr.AutoMitigate = &autoMitigate - } - case "enabled": - if v != nil { - var enabled Enabled - err = json.Unmarshal(*v, &enabled) - if err != nil { - return err - } - lsr.Enabled = enabled - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - lsr.LastUpdatedTime = &lastUpdatedTime - } - case "provisioningState": - if v != nil { - var provisioningState ProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - lsr.ProvisioningState = provisioningState - } - case "source": - if v != nil { - var source Source - err = json.Unmarshal(*v, &source) - if err != nil { - return err - } - lsr.Source = &source - } - case "schedule": - if v != nil { - var schedule Schedule - err = json.Unmarshal(*v, &schedule) - if err != nil { - return err - } - lsr.Schedule = &schedule - } - case "action": - if v != nil { - action, err := unmarshalBasicAction(*v) - if err != nil { - return err - } - lsr.Action = action - } - } - } - - return nil -} - -// LogSearchRulePatch log Search Rule Definition for Patching -type LogSearchRulePatch struct { - // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'EnabledTrue', 'EnabledFalse' - Enabled Enabled `json:"enabled,omitempty"` -} - -// LogSearchRuleResource the Log Search Rule resource. -type LogSearchRuleResource struct { - autorest.Response `json:"-"` - // LogSearchRule - The rule properties of the resource. - *LogSearchRule `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. - Kind *string `json:"kind,omitempty"` - // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogSearchRuleResource. -func (lsrr LogSearchRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lsrr.LogSearchRule != nil { - objectMap["properties"] = lsrr.LogSearchRule - } - if lsrr.Location != nil { - objectMap["location"] = lsrr.Location - } - if lsrr.Tags != nil { - objectMap["tags"] = lsrr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogSearchRuleResource struct. -func (lsrr *LogSearchRuleResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var logSearchRule LogSearchRule - err = json.Unmarshal(*v, &logSearchRule) - if err != nil { - return err - } - lsrr.LogSearchRule = &logSearchRule - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lsrr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lsrr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lsrr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - lsrr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - lsrr.Tags = tags - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - lsrr.Kind = &kind - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - lsrr.Etag = &etag - } - } - } - - return nil -} - -// LogSearchRuleResourceCollection represents a collection of Log Search rule resources. -type LogSearchRuleResourceCollection struct { - autorest.Response `json:"-"` - // Value - The values for the Log Search Rule resources. - Value *[]LogSearchRuleResource `json:"value,omitempty"` -} - -// LogSearchRuleResourcePatch the log search rule resource for patch operations. -type LogSearchRuleResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // LogSearchRulePatch - The log search rule properties of the resource. - *LogSearchRulePatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogSearchRuleResourcePatch. -func (lsrrp LogSearchRuleResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lsrrp.Tags != nil { - objectMap["tags"] = lsrrp.Tags - } - if lsrrp.LogSearchRulePatch != nil { - objectMap["properties"] = lsrrp.LogSearchRulePatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogSearchRuleResourcePatch struct. -func (lsrrp *LogSearchRuleResourcePatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - lsrrp.Tags = tags - } - case "properties": - if v != nil { - var logSearchRulePatch LogSearchRulePatch - err = json.Unmarshal(*v, &logSearchRulePatch) - if err != nil { - return err - } - lsrrp.LogSearchRulePatch = &logSearchRulePatch - } - } - } - - return nil -} - -// LogSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. -type LogSettings struct { - // 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. - Category *string `json:"category,omitempty"` - // Enabled - a value indicating whether this log is enabled. - Enabled *bool `json:"enabled,omitempty"` - // RetentionPolicy - the retention policy for this log. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// LogsIngestionEndpointSpec definition of the endpoint used for ingesting logs. -type LogsIngestionEndpointSpec struct { - // Endpoint - READ-ONLY; The endpoint. This property is READ-ONLY. - Endpoint *string `json:"endpoint,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogsIngestionEndpointSpec. -func (lies LogsIngestionEndpointSpec) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// LogToMetricAction specify action need to be taken when rule type is converting log to metric -type LogToMetricAction struct { - // Criteria - Criteria of Metric - Criteria *[]Criteria `json:"criteria,omitempty"` - // OdataType - Possible values include: 'OdataTypeBasicActionOdataTypeAction', 'OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' - OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogToMetricAction. -func (ltma LogToMetricAction) MarshalJSON() ([]byte, error) { - ltma.OdataType = OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction - objectMap := make(map[string]interface{}) - if ltma.Criteria != nil { - objectMap["criteria"] = ltma.Criteria - } - if ltma.OdataType != "" { - objectMap["odata.type"] = ltma.OdataType - } - return json.Marshal(objectMap) -} - -// AsAlertingAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsAlertingAction() (*AlertingAction, bool) { - return nil, false -} - -// AsLogToMetricAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsLogToMetricAction() (*LogToMetricAction, bool) { - return <ma, true -} - -// AsAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsAction() (*Action, bool) { - return nil, false -} - -// AsBasicAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsBasicAction() (BasicAction, bool) { - return <ma, true -} - -// ManagementEventAggregationCondition how the data that is collected should be combined over time. -type ManagementEventAggregationCondition struct { - // Operator - the condition operator. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' - Operator ConditionOperator `json:"operator,omitempty"` - // Threshold - The threshold value that activates the alert. - Threshold *float64 `json:"threshold,omitempty"` - // WindowSize - 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. - WindowSize *string `json:"windowSize,omitempty"` -} - -// ManagementEventRuleCondition a management event rule condition. -type ManagementEventRuleCondition struct { - // 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. - Aggregation *ManagementEventAggregationCondition `json:"aggregation,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeBasicRuleConditionOdataTypeRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) MarshalJSON() ([]byte, error) { - merc.OdataType = OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition - objectMap := make(map[string]interface{}) - if merc.Aggregation != nil { - objectMap["aggregation"] = merc.Aggregation - } - objectMap["dataSource"] = merc.DataSource - if merc.OdataType != "" { - objectMap["odata.type"] = merc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return &merc, true -} - -// AsRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &merc, true -} - -// UnmarshalJSON is the custom unmarshaler for ManagementEventRuleCondition struct. -func (merc *ManagementEventRuleCondition) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "aggregation": - if v != nil { - var aggregation ManagementEventAggregationCondition - err = json.Unmarshal(*v, &aggregation) - if err != nil { - return err - } - merc.Aggregation = &aggregation - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - merc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - merc.OdataType = odataType - } - } - } - - return nil -} - -// MetadataValue represents a metric metadata value. -type MetadataValue struct { - // Name - the name of the metadata. - Name *LocalizableString `json:"name,omitempty"` - // Value - the value of the metadata. - Value *string `json:"value,omitempty"` -} - -// Metric the result data of a query. -type Metric struct { - // ID - the metric Id. - ID *string `json:"id,omitempty"` - // Type - the resource type of the metric resource. - Type *string `json:"type,omitempty"` - // Name - the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString `json:"name,omitempty"` - // DisplayDescription - Detailed description of this metric. - DisplayDescription *string `json:"displayDescription,omitempty"` - // ErrorCode - 'Success' or the error details on query failures for this metric. - ErrorCode *string `json:"errorCode,omitempty"` - // ErrorMessage - Error message encountered querying this specific metric. - ErrorMessage *string `json:"errorMessage,omitempty"` - // Unit - The unit of the metric. Possible values include: 'MetricUnitCount', 'MetricUnitBytes', 'MetricUnitSeconds', 'MetricUnitCountPerSecond', 'MetricUnitBytesPerSecond', 'MetricUnitPercent', 'MetricUnitMilliSeconds', 'MetricUnitByteSeconds', 'MetricUnitUnspecified', 'MetricUnitCores', 'MetricUnitMilliCores', 'MetricUnitNanoCores', 'MetricUnitBitsPerSecond' - Unit MetricUnit `json:"unit,omitempty"` - // Timeseries - the time series returned when a data query is performed. - Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"` -} - -// MetricAlertAction an alert action. -type MetricAlertAction struct { - // ActionGroupID - the id of the action group to use. - ActionGroupID *string `json:"actionGroupId,omitempty"` - // WebHookProperties - This field allows specifying custom properties, which would be appended to the alert payload sent as input to the webhook. - WebHookProperties map[string]*string `json:"webHookProperties"` -} - -// MarshalJSON is the custom marshaler for MetricAlertAction. -func (maa MetricAlertAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if maa.ActionGroupID != nil { - objectMap["actionGroupId"] = maa.ActionGroupID - } - if maa.WebHookProperties != nil { - objectMap["webHookProperties"] = maa.WebHookProperties - } - return json.Marshal(objectMap) -} - -// BasicMetricAlertCriteria the rule criteria that defines the conditions of the alert rule. -type BasicMetricAlertCriteria interface { - AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) - AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) - AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) - AsMetricAlertCriteria() (*MetricAlertCriteria, bool) -} - -// MetricAlertCriteria the rule criteria that defines the conditions of the alert rule. -type MetricAlertCriteria struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -func unmarshalBasicMetricAlertCriteria(body []byte) (BasicMetricAlertCriteria, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria): - var masrmmc MetricAlertSingleResourceMultipleMetricCriteria - err := json.Unmarshal(body, &masrmmc) - return masrmmc, err - case string(OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria): - var wlac WebtestLocationAvailabilityCriteria - err := json.Unmarshal(body, &wlac) - return wlac, err - case string(OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria): - var mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria - err := json.Unmarshal(body, &mamrmmc) - return mamrmmc, err - default: - var mac MetricAlertCriteria - err := json.Unmarshal(body, &mac) - return mac, err - } -} -func unmarshalBasicMetricAlertCriteriaArray(body []byte) ([]BasicMetricAlertCriteria, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - macArray := make([]BasicMetricAlertCriteria, len(rawMessages)) - - for index, rawMessage := range rawMessages { - mac, err := unmarshalBasicMetricAlertCriteria(*rawMessage) - if err != nil { - return nil, err - } - macArray[index] = mac - } - return macArray, nil -} - -// MarshalJSON is the custom marshaler for MetricAlertCriteria. -func (mac MetricAlertCriteria) MarshalJSON() ([]byte, error) { - mac.OdataType = OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria - objectMap := make(map[string]interface{}) - if mac.OdataType != "" { - objectMap["odata.type"] = mac.OdataType - } - for k, v := range mac.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return nil, false -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return &mac, true -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &mac, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertCriteria struct. -func (mac *MetricAlertCriteria) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mac.AdditionalProperties == nil { - mac.AdditionalProperties = make(map[string]interface{}) - } - mac.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - mac.OdataType = odataType - } - } - } - - return nil -} - -// MetricAlertMultipleResourceMultipleMetricCriteria specifies the metric alert criteria for multiple -// resource that has multiple metric criteria. -type MetricAlertMultipleResourceMultipleMetricCriteria struct { - // AllOf - the list of multiple metric criteria for this 'all of' operation. - AllOf *[]BasicMultiMetricCriteria `json:"allOf,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { - mamrmmc.OdataType = OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria - objectMap := make(map[string]interface{}) - if mamrmmc.AllOf != nil { - objectMap["allOf"] = mamrmmc.AllOf - } - if mamrmmc.OdataType != "" { - objectMap["odata.type"] = mamrmmc.OdataType - } - for k, v := range mamrmmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return nil, false -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return &mamrmmc, true -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return nil, false -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &mamrmmc, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertMultipleResourceMultipleMetricCriteria struct. -func (mamrmmc *MetricAlertMultipleResourceMultipleMetricCriteria) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "allOf": - if v != nil { - allOf, err := unmarshalBasicMultiMetricCriteriaArray(*v) - if err != nil { - return err - } - mamrmmc.AllOf = &allOf - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mamrmmc.AdditionalProperties == nil { - mamrmmc.AdditionalProperties = make(map[string]interface{}) - } - mamrmmc.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - mamrmmc.OdataType = odataType - } - } - } - - return nil -} - -// MetricAlertProperties an alert rule. -type MetricAlertProperties struct { - // Description - the description of the metric alert that will be included in the alert email. - Description *string `json:"description,omitempty"` - // Severity - Alert severity {0, 1, 2, 3, 4} - Severity *int32 `json:"severity,omitempty"` - // Enabled - the flag that indicates whether the metric alert is enabled. - Enabled *bool `json:"enabled,omitempty"` - // Scopes - the list of resource id's that this metric alert is scoped to. - Scopes *[]string `json:"scopes,omitempty"` - // EvaluationFrequency - how often the metric alert is evaluated represented in ISO 8601 duration format. - EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. - WindowSize *string `json:"windowSize,omitempty"` - // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource. - TargetResourceType *string `json:"targetResourceType,omitempty"` - // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource. - TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` - // Criteria - defines the specific alert criteria information. - Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` - // AutoMitigate - the flag that indicates whether the alert should be auto resolved or not. The default is true. - AutoMitigate *bool `json:"autoMitigate,omitempty"` - // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions *[]MetricAlertAction `json:"actions,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` - // IsMigrated - READ-ONLY; the value indicating whether this alert rule is migrated. - IsMigrated *bool `json:"isMigrated,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertProperties. -func (mapVar MetricAlertProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mapVar.Description != nil { - objectMap["description"] = mapVar.Description - } - if mapVar.Severity != nil { - objectMap["severity"] = mapVar.Severity - } - if mapVar.Enabled != nil { - objectMap["enabled"] = mapVar.Enabled - } - if mapVar.Scopes != nil { - objectMap["scopes"] = mapVar.Scopes - } - if mapVar.EvaluationFrequency != nil { - objectMap["evaluationFrequency"] = mapVar.EvaluationFrequency - } - if mapVar.WindowSize != nil { - objectMap["windowSize"] = mapVar.WindowSize - } - if mapVar.TargetResourceType != nil { - objectMap["targetResourceType"] = mapVar.TargetResourceType - } - if mapVar.TargetResourceRegion != nil { - objectMap["targetResourceRegion"] = mapVar.TargetResourceRegion - } - objectMap["criteria"] = mapVar.Criteria - if mapVar.AutoMitigate != nil { - objectMap["autoMitigate"] = mapVar.AutoMitigate - } - if mapVar.Actions != nil { - objectMap["actions"] = mapVar.Actions - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertProperties struct. -func (mapVar *MetricAlertProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - mapVar.Description = &description - } - case "severity": - if v != nil { - var severity int32 - err = json.Unmarshal(*v, &severity) - if err != nil { - return err - } - mapVar.Severity = &severity - } - case "enabled": - if v != nil { - var enabled bool - err = json.Unmarshal(*v, &enabled) - if err != nil { - return err - } - mapVar.Enabled = &enabled - } - case "scopes": - if v != nil { - var scopes []string - err = json.Unmarshal(*v, &scopes) - if err != nil { - return err - } - mapVar.Scopes = &scopes - } - case "evaluationFrequency": - if v != nil { - var evaluationFrequency string - err = json.Unmarshal(*v, &evaluationFrequency) - if err != nil { - return err - } - mapVar.EvaluationFrequency = &evaluationFrequency - } - case "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - mapVar.WindowSize = &windowSize - } - case "targetResourceType": - if v != nil { - var targetResourceType string - err = json.Unmarshal(*v, &targetResourceType) - if err != nil { - return err - } - mapVar.TargetResourceType = &targetResourceType - } - case "targetResourceRegion": - if v != nil { - var targetResourceRegion string - err = json.Unmarshal(*v, &targetResourceRegion) - if err != nil { - return err - } - mapVar.TargetResourceRegion = &targetResourceRegion - } - case "criteria": - if v != nil { - criteria, err := unmarshalBasicMetricAlertCriteria(*v) - if err != nil { - return err - } - mapVar.Criteria = criteria - } - case "autoMitigate": - if v != nil { - var autoMitigate bool - err = json.Unmarshal(*v, &autoMitigate) - if err != nil { - return err - } - mapVar.AutoMitigate = &autoMitigate - } - case "actions": - if v != nil { - var actions []MetricAlertAction - err = json.Unmarshal(*v, &actions) - if err != nil { - return err - } - mapVar.Actions = &actions - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - mapVar.LastUpdatedTime = &lastUpdatedTime - } - case "isMigrated": - if v != nil { - var isMigrated bool - err = json.Unmarshal(*v, &isMigrated) - if err != nil { - return err - } - mapVar.IsMigrated = &isMigrated - } - } - } - - return nil -} - -// MetricAlertPropertiesPatch an alert rule properties for patch. -type MetricAlertPropertiesPatch struct { - // Description - the description of the metric alert that will be included in the alert email. - Description *string `json:"description,omitempty"` - // Severity - Alert severity {0, 1, 2, 3, 4} - Severity *int32 `json:"severity,omitempty"` - // Enabled - the flag that indicates whether the metric alert is enabled. - Enabled *bool `json:"enabled,omitempty"` - // Scopes - the list of resource id's that this metric alert is scoped to. - Scopes *[]string `json:"scopes,omitempty"` - // EvaluationFrequency - how often the metric alert is evaluated represented in ISO 8601 duration format. - EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. - WindowSize *string `json:"windowSize,omitempty"` - // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. - TargetResourceType *string `json:"targetResourceType,omitempty"` - // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. - TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` - // Criteria - defines the specific alert criteria information. - Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` - // AutoMitigate - the flag that indicates whether the alert should be auto resolved or not. The default is true. - AutoMitigate *bool `json:"autoMitigate,omitempty"` - // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions *[]MetricAlertAction `json:"actions,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` - // IsMigrated - READ-ONLY; the value indicating whether this alert rule is migrated. - IsMigrated *bool `json:"isMigrated,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertPropertiesPatch. -func (mapp MetricAlertPropertiesPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mapp.Description != nil { - objectMap["description"] = mapp.Description - } - if mapp.Severity != nil { - objectMap["severity"] = mapp.Severity - } - if mapp.Enabled != nil { - objectMap["enabled"] = mapp.Enabled - } - if mapp.Scopes != nil { - objectMap["scopes"] = mapp.Scopes - } - if mapp.EvaluationFrequency != nil { - objectMap["evaluationFrequency"] = mapp.EvaluationFrequency - } - if mapp.WindowSize != nil { - objectMap["windowSize"] = mapp.WindowSize - } - if mapp.TargetResourceType != nil { - objectMap["targetResourceType"] = mapp.TargetResourceType - } - if mapp.TargetResourceRegion != nil { - objectMap["targetResourceRegion"] = mapp.TargetResourceRegion - } - objectMap["criteria"] = mapp.Criteria - if mapp.AutoMitigate != nil { - objectMap["autoMitigate"] = mapp.AutoMitigate - } - if mapp.Actions != nil { - objectMap["actions"] = mapp.Actions - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertPropertiesPatch struct. -func (mapp *MetricAlertPropertiesPatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - mapp.Description = &description - } - case "severity": - if v != nil { - var severity int32 - err = json.Unmarshal(*v, &severity) - if err != nil { - return err - } - mapp.Severity = &severity - } - case "enabled": - if v != nil { - var enabled bool - err = json.Unmarshal(*v, &enabled) - if err != nil { - return err - } - mapp.Enabled = &enabled - } - case "scopes": - if v != nil { - var scopes []string - err = json.Unmarshal(*v, &scopes) - if err != nil { - return err - } - mapp.Scopes = &scopes - } - case "evaluationFrequency": - if v != nil { - var evaluationFrequency string - err = json.Unmarshal(*v, &evaluationFrequency) - if err != nil { - return err - } - mapp.EvaluationFrequency = &evaluationFrequency - } - case "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - mapp.WindowSize = &windowSize - } - case "targetResourceType": - if v != nil { - var targetResourceType string - err = json.Unmarshal(*v, &targetResourceType) - if err != nil { - return err - } - mapp.TargetResourceType = &targetResourceType - } - case "targetResourceRegion": - if v != nil { - var targetResourceRegion string - err = json.Unmarshal(*v, &targetResourceRegion) - if err != nil { - return err - } - mapp.TargetResourceRegion = &targetResourceRegion - } - case "criteria": - if v != nil { - criteria, err := unmarshalBasicMetricAlertCriteria(*v) - if err != nil { - return err - } - mapp.Criteria = criteria - } - case "autoMitigate": - if v != nil { - var autoMitigate bool - err = json.Unmarshal(*v, &autoMitigate) - if err != nil { - return err - } - mapp.AutoMitigate = &autoMitigate - } - case "actions": - if v != nil { - var actions []MetricAlertAction - err = json.Unmarshal(*v, &actions) - if err != nil { - return err - } - mapp.Actions = &actions - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - mapp.LastUpdatedTime = &lastUpdatedTime - } - case "isMigrated": - if v != nil { - var isMigrated bool - err = json.Unmarshal(*v, &isMigrated) - if err != nil { - return err - } - mapp.IsMigrated = &isMigrated - } - } - } - - return nil -} - -// MetricAlertResource the metric alert resource. -type MetricAlertResource struct { - autorest.Response `json:"-"` - // MetricAlertProperties - The alert rule properties of the resource. - *MetricAlertProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. - Kind *string `json:"kind,omitempty"` - // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertResource. -func (mar MetricAlertResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mar.MetricAlertProperties != nil { - objectMap["properties"] = mar.MetricAlertProperties - } - if mar.Location != nil { - objectMap["location"] = mar.Location - } - if mar.Tags != nil { - objectMap["tags"] = mar.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertResource struct. -func (mar *MetricAlertResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var metricAlertProperties MetricAlertProperties - err = json.Unmarshal(*v, &metricAlertProperties) - if err != nil { - return err - } - mar.MetricAlertProperties = &metricAlertProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mar.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mar.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mar.Tags = tags - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - mar.Kind = &kind - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - mar.Etag = &etag - } - } - } - - return nil -} - -// MetricAlertResourceCollection represents a collection of alert rule resources. -type MetricAlertResourceCollection struct { - autorest.Response `json:"-"` - // Value - the values for the alert rule resources. - Value *[]MetricAlertResource `json:"value,omitempty"` -} - -// MetricAlertResourcePatch the metric alert resource for patch operations. -type MetricAlertResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // MetricAlertPropertiesPatch - The alert rule properties of the resource. - *MetricAlertPropertiesPatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertResourcePatch. -func (marp MetricAlertResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if marp.Tags != nil { - objectMap["tags"] = marp.Tags - } - if marp.MetricAlertPropertiesPatch != nil { - objectMap["properties"] = marp.MetricAlertPropertiesPatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertResourcePatch struct. -func (marp *MetricAlertResourcePatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - marp.Tags = tags - } - case "properties": - if v != nil { - var metricAlertPropertiesPatch MetricAlertPropertiesPatch - err = json.Unmarshal(*v, &metricAlertPropertiesPatch) - if err != nil { - return err - } - marp.MetricAlertPropertiesPatch = &metricAlertPropertiesPatch - } - } - } - - return nil -} - -// MetricAlertSingleResourceMultipleMetricCriteria specifies the metric alert criteria for a single -// resource that has multiple metric criteria. -type MetricAlertSingleResourceMultipleMetricCriteria struct { - // AllOf - The list of metric criteria for this 'all of' operation. - AllOf *[]MetricCriteria `json:"allOf,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { - masrmmc.OdataType = OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria - objectMap := make(map[string]interface{}) - if masrmmc.AllOf != nil { - objectMap["allOf"] = masrmmc.AllOf - } - if masrmmc.OdataType != "" { - objectMap["odata.type"] = masrmmc.OdataType - } - for k, v := range masrmmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return &masrmmc, true -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return nil, false -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return nil, false -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &masrmmc, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertSingleResourceMultipleMetricCriteria struct. -func (masrmmc *MetricAlertSingleResourceMultipleMetricCriteria) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "allOf": - if v != nil { - var allOf []MetricCriteria - err = json.Unmarshal(*v, &allOf) - if err != nil { - return err - } - masrmmc.AllOf = &allOf - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if masrmmc.AdditionalProperties == nil { - masrmmc.AdditionalProperties = make(map[string]interface{}) - } - masrmmc.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - masrmmc.OdataType = odataType - } - } - } - - return nil -} - -// MetricAlertStatus an alert status. -type MetricAlertStatus struct { - // Name - The status name. - Name *string `json:"name,omitempty"` - // ID - The alert rule arm id. - ID *string `json:"id,omitempty"` - // Type - The extended resource type name. - Type *string `json:"type,omitempty"` - // Properties - The alert status properties of the metric alert status. - Properties *MetricAlertStatusProperties `json:"properties,omitempty"` -} - -// MetricAlertStatusCollection represents a collection of alert rule resources. -type MetricAlertStatusCollection struct { - autorest.Response `json:"-"` - // Value - the values for the alert rule resources. - Value *[]MetricAlertStatus `json:"value,omitempty"` -} - -// MetricAlertStatusProperties an alert status properties. -type MetricAlertStatusProperties struct { - // Dimensions - An object describing the type of the dimensions. - Dimensions map[string]*string `json:"dimensions"` - // Status - status value - Status *string `json:"status,omitempty"` - // Timestamp - UTC time when the status was checked. - Timestamp *date.Time `json:"timestamp,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertStatusProperties. -func (masp MetricAlertStatusProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if masp.Dimensions != nil { - objectMap["dimensions"] = masp.Dimensions - } - if masp.Status != nil { - objectMap["status"] = masp.Status - } - if masp.Timestamp != nil { - objectMap["timestamp"] = masp.Timestamp - } - return json.Marshal(objectMap) -} - -// MetricAvailability metric availability specifies the time grain (aggregation interval or frequency) and -// the retention period for that time grain. -type MetricAvailability struct { - // TimeGrain - the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. - TimeGrain *string `json:"timeGrain,omitempty"` - // Retention - the retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. - Retention *string `json:"retention,omitempty"` -} - -// MetricBaselinesProperties the response to a metric baselines query. -type MetricBaselinesProperties struct { - // 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. - Timespan *string `json:"timespan,omitempty"` - // 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. - Interval *string `json:"interval,omitempty"` - // Namespace - The namespace of the metrics been queried. - Namespace *string `json:"namespace,omitempty"` - // Baselines - The baseline for each time series that was queried. - Baselines *[]TimeSeriesBaseline `json:"baselines,omitempty"` -} - -// MetricBaselinesResponse a list of metric baselines. -type MetricBaselinesResponse struct { - autorest.Response `json:"-"` - // Value - The list of metric baselines. - Value *[]SingleMetricBaseline `json:"value,omitempty"` -} - -// MetricCriteria criterion to filter metrics. -type MetricCriteria struct { - // Operator - the criteria operator. Possible values include: 'OperatorEquals', 'OperatorNotEquals', 'OperatorGreaterThan', 'OperatorGreaterThanOrEqual', 'OperatorLessThan', 'OperatorLessThanOrEqual' - Operator Operator `json:"operator,omitempty"` - // Threshold - the criteria threshold value that activates the alert. - Threshold *float64 `json:"threshold,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Name - Name of the criteria. - Name *string `json:"name,omitempty"` - // MetricName - Name of the metric. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - Namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' - TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` - // Dimensions - List of dimension conditions. - Dimensions *[]MetricDimension `json:"dimensions,omitempty"` - // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` - // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' - CriterionType CriterionType `json:"criterionType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricCriteria. -func (mc MetricCriteria) MarshalJSON() ([]byte, error) { - mc.CriterionType = CriterionTypeStaticThresholdCriterion - objectMap := make(map[string]interface{}) - if mc.Operator != "" { - objectMap["operator"] = mc.Operator - } - if mc.Threshold != nil { - objectMap["threshold"] = mc.Threshold - } - if mc.Name != nil { - objectMap["name"] = mc.Name - } - if mc.MetricName != nil { - objectMap["metricName"] = mc.MetricName - } - if mc.MetricNamespace != nil { - objectMap["metricNamespace"] = mc.MetricNamespace - } - if mc.TimeAggregation != "" { - objectMap["timeAggregation"] = mc.TimeAggregation - } - if mc.Dimensions != nil { - objectMap["dimensions"] = mc.Dimensions - } - if mc.SkipMetricValidation != nil { - objectMap["skipMetricValidation"] = mc.SkipMetricValidation - } - if mc.CriterionType != "" { - objectMap["criterionType"] = mc.CriterionType - } - for k, v := range mc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { - return &mc, true -} - -// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { - return nil, false -} - -// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { - return nil, false -} - -// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { - return &mc, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricCriteria struct. -func (mc *MetricCriteria) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "operator": - if v != nil { - var operator Operator - err = json.Unmarshal(*v, &operator) - if err != nil { - return err - } - mc.Operator = operator - } - case "threshold": - if v != nil { - var threshold float64 - err = json.Unmarshal(*v, &threshold) - if err != nil { - return err - } - mc.Threshold = &threshold - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mc.AdditionalProperties == nil { - mc.AdditionalProperties = make(map[string]interface{}) - } - mc.AdditionalProperties[k] = additionalProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mc.Name = &name - } - case "metricName": - if v != nil { - var metricName string - err = json.Unmarshal(*v, &metricName) - if err != nil { - return err - } - mc.MetricName = &metricName - } - case "metricNamespace": - if v != nil { - var metricNamespace string - err = json.Unmarshal(*v, &metricNamespace) - if err != nil { - return err - } - mc.MetricNamespace = &metricNamespace - } - case "timeAggregation": - if v != nil { - var timeAggregation AggregationTypeEnum - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - mc.TimeAggregation = timeAggregation - } - case "dimensions": - if v != nil { - var dimensions []MetricDimension - err = json.Unmarshal(*v, &dimensions) - if err != nil { - return err - } - mc.Dimensions = &dimensions - } - case "skipMetricValidation": - if v != nil { - var skipMetricValidation bool - err = json.Unmarshal(*v, &skipMetricValidation) - if err != nil { - return err - } - mc.SkipMetricValidation = &skipMetricValidation - } - case "criterionType": - if v != nil { - var criterionType CriterionType - err = json.Unmarshal(*v, &criterionType) - if err != nil { - return err - } - mc.CriterionType = criterionType - } - } - } - - return nil -} - -// MetricDefinition metric definition class specifies the metadata for a metric. -type MetricDefinition struct { - // IsDimensionRequired - Flag to indicate whether the dimension is required. - IsDimensionRequired *bool `json:"isDimensionRequired,omitempty"` - // ResourceID - the resource identifier of the resource that emitted the metric. - ResourceID *string `json:"resourceId,omitempty"` - // Namespace - the namespace the metric belongs to. - Namespace *string `json:"namespace,omitempty"` - // Name - the name and the display name of the metric, i.e. it is a localizable string. - Name *LocalizableString `json:"name,omitempty"` - // DisplayDescription - Detailed description of this metric. - DisplayDescription *string `json:"displayDescription,omitempty"` - // Category - Custom category name for this metric. - Category *string `json:"category,omitempty"` - // MetricClass - The class of the metric. Possible values include: 'MetricClassAvailability', 'MetricClassTransactions', 'MetricClassErrors', 'MetricClassLatency', 'MetricClassSaturation' - MetricClass MetricClass `json:"metricClass,omitempty"` - // Unit - The unit of the metric. Possible values include: 'MetricUnitCount', 'MetricUnitBytes', 'MetricUnitSeconds', 'MetricUnitCountPerSecond', 'MetricUnitBytesPerSecond', 'MetricUnitPercent', 'MetricUnitMilliSeconds', 'MetricUnitByteSeconds', 'MetricUnitUnspecified', 'MetricUnitCores', 'MetricUnitMilliCores', 'MetricUnitNanoCores', 'MetricUnitBitsPerSecond' - Unit MetricUnit `json:"unit,omitempty"` - // PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'AggregationTypeNone', 'AggregationTypeAverage', 'AggregationTypeCount', 'AggregationTypeMinimum', 'AggregationTypeMaximum', 'AggregationTypeTotal' - PrimaryAggregationType AggregationType `json:"primaryAggregationType,omitempty"` - // SupportedAggregationTypes - the collection of what aggregation types are supported. - SupportedAggregationTypes *[]AggregationType `json:"supportedAggregationTypes,omitempty"` - // MetricAvailabilities - the collection of what aggregation intervals are available to be queried. - MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` - // ID - the resource identifier of the metric definition. - ID *string `json:"id,omitempty"` - // Dimensions - the name and the display name of the dimension, i.e. it is a localizable string. - Dimensions *[]LocalizableString `json:"dimensions,omitempty"` -} - -// MetricDefinitionCollection represents collection of metric definitions. -type MetricDefinitionCollection struct { - autorest.Response `json:"-"` - // Value - the values for the metric definitions. - Value *[]MetricDefinition `json:"value,omitempty"` -} - -// MetricDimension specifies a metric dimension. -type MetricDimension struct { - // Name - Name of the dimension. - Name *string `json:"name,omitempty"` - // Operator - the dimension operator. Only 'Include' and 'Exclude' are supported - Operator *string `json:"operator,omitempty"` - // Values - list of dimension values. - Values *[]string `json:"values,omitempty"` -} - -// MetricNamespace metric namespace class specifies the metadata for a metric namespace. -type MetricNamespace struct { - // ID - The ID of the metric namespace. - ID *string `json:"id,omitempty"` - // Type - The type of the namespace. - Type *string `json:"type,omitempty"` - // Name - The escaped name of the namespace. - Name *string `json:"name,omitempty"` - // Classification - Kind of namespace. Possible values include: 'NamespaceClassificationPlatform', 'NamespaceClassificationCustom', 'NamespaceClassificationQos' - Classification NamespaceClassification `json:"classification,omitempty"` - // Properties - Properties which include the fully qualified namespace name. - Properties *MetricNamespaceName `json:"properties,omitempty"` -} - -// MetricNamespaceCollection represents collection of metric namespaces. -type MetricNamespaceCollection struct { - autorest.Response `json:"-"` - // Value - The values for the metric namespaces. - Value *[]MetricNamespace `json:"value,omitempty"` -} - -// MetricNamespaceName the fully qualified metric namespace name. -type MetricNamespaceName struct { - // MetricNamespaceName - The metric namespace name. - MetricNamespaceName *string `json:"metricNamespaceName,omitempty"` -} - -// MetricSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. -type MetricSettings struct { - // TimeGrain - the timegrain of the metric in ISO8601 format. - TimeGrain *string `json:"timeGrain,omitempty"` - // 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. - Category *string `json:"category,omitempty"` - // Enabled - a value indicating whether this category is enabled. - Enabled *bool `json:"enabled,omitempty"` - // RetentionPolicy - the retention policy for this category. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// MetricSingleDimension the metric dimension name and value. -type MetricSingleDimension struct { - // Name - Name of the dimension. - Name *string `json:"name,omitempty"` - // Value - Value of the dimension. - Value *string `json:"value,omitempty"` -} - -// MetricTrigger the trigger that results in a scaling action. -type MetricTrigger struct { - // MetricName - the name of the metric that defines what the rule monitors. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - the namespace of the metric that defines what the rule monitors. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // MetricResourceURI - the resource identifier of the resource the rule monitors. - MetricResourceURI *string `json:"metricResourceUri,omitempty"` - // TimeGrain - 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. - TimeGrain *string `json:"timeGrain,omitempty"` - // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum' - Statistic MetricStatisticType `json:"statistic,omitempty"` - // TimeWindow - 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. - TimeWindow *string `json:"timeWindow,omitempty"` - // TimeAggregation - time aggregation type. How the data that is collected should be combined over time. The default value is Average. Possible values include: 'TimeAggregationTypeAverage', 'TimeAggregationTypeMinimum', 'TimeAggregationTypeMaximum', 'TimeAggregationTypeTotal', 'TimeAggregationTypeCount', 'TimeAggregationTypeLast' - TimeAggregation TimeAggregationType `json:"timeAggregation,omitempty"` - // Operator - the operator that is used to compare the metric data and the threshold. Possible values include: 'ComparisonOperationTypeEquals', 'ComparisonOperationTypeNotEquals', 'ComparisonOperationTypeGreaterThan', 'ComparisonOperationTypeGreaterThanOrEqual', 'ComparisonOperationTypeLessThan', 'ComparisonOperationTypeLessThanOrEqual' - Operator ComparisonOperationType `json:"operator,omitempty"` - // Threshold - the threshold of the metric that triggers the scale action. - Threshold *float64 `json:"threshold,omitempty"` - // Dimensions - List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. - Dimensions *[]ScaleRuleMetricDimension `json:"dimensions,omitempty"` - // DividePerInstance - a value indicating whether metric should divide per instance. - DividePerInstance *bool `json:"dividePerInstance,omitempty"` -} - -// MetricValue represents a metric value. -type MetricValue struct { - // TimeStamp - the timestamp for the metric value in ISO 8601 format. - TimeStamp *date.Time `json:"timeStamp,omitempty"` - // Average - the average value in the time range. - Average *float64 `json:"average,omitempty"` - // Minimum - the least value in the time range. - Minimum *float64 `json:"minimum,omitempty"` - // Maximum - the greatest value in the time range. - Maximum *float64 `json:"maximum,omitempty"` - // Total - the sum of all of the values in the time range. - Total *float64 `json:"total,omitempty"` - // Count - the number of samples in the time range. Can be used to determine the number of values that contributed to the average value. - Count *float64 `json:"count,omitempty"` -} - -// BasicMultiMetricCriteria the types of conditions for a multi resource alert. -type BasicMultiMetricCriteria interface { - AsMetricCriteria() (*MetricCriteria, bool) - AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) - AsMultiMetricCriteria() (*MultiMetricCriteria, bool) -} - -// MultiMetricCriteria the types of conditions for a multi resource alert. -type MultiMetricCriteria struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Name - Name of the criteria. - Name *string `json:"name,omitempty"` - // MetricName - Name of the metric. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - Namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' - TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` - // Dimensions - List of dimension conditions. - Dimensions *[]MetricDimension `json:"dimensions,omitempty"` - // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` - // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' - CriterionType CriterionType `json:"criterionType,omitempty"` -} - -func unmarshalBasicMultiMetricCriteria(body []byte) (BasicMultiMetricCriteria, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["criterionType"] { - case string(CriterionTypeStaticThresholdCriterion): - var mc MetricCriteria - err := json.Unmarshal(body, &mc) - return mc, err - case string(CriterionTypeDynamicThresholdCriterion): - var dmc DynamicMetricCriteria - err := json.Unmarshal(body, &dmc) - return dmc, err - default: - var mmc MultiMetricCriteria - err := json.Unmarshal(body, &mmc) - return mmc, err - } -} -func unmarshalBasicMultiMetricCriteriaArray(body []byte) ([]BasicMultiMetricCriteria, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - mmcArray := make([]BasicMultiMetricCriteria, len(rawMessages)) - - for index, rawMessage := range rawMessages { - mmc, err := unmarshalBasicMultiMetricCriteria(*rawMessage) - if err != nil { - return nil, err - } - mmcArray[index] = mmc - } - return mmcArray, nil -} - -// MarshalJSON is the custom marshaler for MultiMetricCriteria. -func (mmc MultiMetricCriteria) MarshalJSON() ([]byte, error) { - mmc.CriterionType = CriterionTypeMultiMetricCriteria - objectMap := make(map[string]interface{}) - if mmc.Name != nil { - objectMap["name"] = mmc.Name - } - if mmc.MetricName != nil { - objectMap["metricName"] = mmc.MetricName - } - if mmc.MetricNamespace != nil { - objectMap["metricNamespace"] = mmc.MetricNamespace - } - if mmc.TimeAggregation != "" { - objectMap["timeAggregation"] = mmc.TimeAggregation - } - if mmc.Dimensions != nil { - objectMap["dimensions"] = mmc.Dimensions - } - if mmc.SkipMetricValidation != nil { - objectMap["skipMetricValidation"] = mmc.SkipMetricValidation - } - if mmc.CriterionType != "" { - objectMap["criterionType"] = mmc.CriterionType - } - for k, v := range mmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { - return nil, false -} - -// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { - return nil, false -} - -// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { - return &mmc, true -} - -// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { - return &mmc, true -} - -// UnmarshalJSON is the custom unmarshaler for MultiMetricCriteria struct. -func (mmc *MultiMetricCriteria) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mmc.AdditionalProperties == nil { - mmc.AdditionalProperties = make(map[string]interface{}) - } - mmc.AdditionalProperties[k] = additionalProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mmc.Name = &name - } - case "metricName": - if v != nil { - var metricName string - err = json.Unmarshal(*v, &metricName) - if err != nil { - return err - } - mmc.MetricName = &metricName - } - case "metricNamespace": - if v != nil { - var metricNamespace string - err = json.Unmarshal(*v, &metricNamespace) - if err != nil { - return err - } - mmc.MetricNamespace = &metricNamespace - } - case "timeAggregation": - if v != nil { - var timeAggregation AggregationTypeEnum - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - mmc.TimeAggregation = timeAggregation - } - case "dimensions": - if v != nil { - var dimensions []MetricDimension - err = json.Unmarshal(*v, &dimensions) - if err != nil { - return err - } - mmc.Dimensions = &dimensions - } - case "skipMetricValidation": - if v != nil { - var skipMetricValidation bool - err = json.Unmarshal(*v, &skipMetricValidation) - if err != nil { - return err - } - mmc.SkipMetricValidation = &skipMetricValidation - } - case "criterionType": - if v != nil { - var criterionType CriterionType - err = json.Unmarshal(*v, &criterionType) - if err != nil { - return err - } - mmc.CriterionType = criterionType - } - } - } - - return nil -} - -// NetworkRuleSet definition of the network rules. -type NetworkRuleSet struct { - // PublicNetworkAccess - The configuration to set whether network access from public internet to the endpoints are allowed. Possible values include: 'KnownPublicNetworkAccessOptionsEnabled', 'KnownPublicNetworkAccessOptionsDisabled' - PublicNetworkAccess KnownPublicNetworkAccessOptions `json:"publicNetworkAccess,omitempty"` -} - -// Operation microsoft Insights API operation definition. -type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - Display metadata associated with the operation. - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay display metadata associated with the operation. -type OperationDisplay struct { - // Provider - Service provider: Microsoft.Insights - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed: AlertRules, Autoscale, etc. - Resource *string `json:"resource,omitempty"` - // Operation - Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty"` -} - -// OperationListResult 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. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - List of operations supported by the Microsoft.Insights provider. - Value *[]Operation `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationStatus the status of operation. -type OperationStatus struct { - autorest.Response `json:"-"` - // ID - The operation Id. - ID *string `json:"id,omitempty"` - // Name - The operation name. - Name *string `json:"name,omitempty"` - // StartTime - Start time of the job in standard ISO8601 format. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - End time of the job in standard ISO8601 format. - EndTime *date.Time `json:"endTime,omitempty"` - // Status - The status of the operation. - Status *string `json:"status,omitempty"` - // Error - The error detail of the operation if any. - Error *ErrorResponseCommon `json:"error,omitempty"` -} - -// PerfCounterDataSource definition of which performance counters will be collected and how they will be -// collected by this data collection rule. -// Collected from both Windows and Linux machines where the counter is present. -type PerfCounterDataSource struct { - // Streams - List of streams that this data source will be sent to. - // A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. - Streams *[]KnownPerfCounterDataSourceStreams `json:"streams,omitempty"` - // SamplingFrequencyInSeconds - The number of seconds between consecutive counter measurements (samples). - SamplingFrequencyInSeconds *int32 `json:"samplingFrequencyInSeconds,omitempty"` - // CounterSpecifiers - A list of specifier names of the performance counters you want to collect. - // Use a wildcard (*) to collect a counter for all instances. - // To get a list of performance counters on Windows, run the command 'typeperf'. - CounterSpecifiers *[]string `json:"counterSpecifiers,omitempty"` - // Name - A friendly name for the data source. - // This name should be unique across all data sources (regardless of type) within the data collection rule. - Name *string `json:"name,omitempty"` -} - -// PrivateEndpointConnection a private endpoint connection -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - Resource properties. - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnection. -func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pec.PrivateEndpointConnectionProperties != nil { - objectMap["properties"] = pec.PrivateEndpointConnectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. -func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateEndpointConnectionProperties PrivateEndpointConnectionProperties - err = json.Unmarshal(*v, &privateEndpointConnectionProperties) - if err != nil { - return err - } - pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pec.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pec.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pec.Type = &typeVar - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult a list of private endpoint connections. -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]PrivateEndpointConnection `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionListResult. -func (peclr PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateEndpointConnectionListResultIterator provides access to a complete listing of -// PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultIterator struct { - i int - page PrivateEndpointConnectionListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PrivateEndpointConnectionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateEndpointConnectionListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection { - if !iter.page.NotDone() { - return PrivateEndpointConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateEndpointConnectionListResultIterator type. -func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator { - return PrivateEndpointConnectionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool { - return peclr.Value == nil || len(*peclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (peclr PrivateEndpointConnectionListResult) hasNextLink() bool { - return peclr.NextLink != nil && len(*peclr.NextLink) != 0 -} - -// privateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !peclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(peclr.NextLink))) -} - -// PrivateEndpointConnectionListResultPage contains a page of PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultPage struct { - fn func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error) - peclr PrivateEndpointConnectionListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.peclr) - if err != nil { - return err - } - page.peclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PrivateEndpointConnectionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateEndpointConnectionListResultPage) NotDone() bool { - return !page.peclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult { - return page.peclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection { - if page.peclr.IsEmpty() { - return nil - } - return *page.peclr.Value -} - -// Creates a new instance of the PrivateEndpointConnectionListResultPage type. -func NewPrivateEndpointConnectionListResultPage(cur PrivateEndpointConnectionListResult, getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage { - return PrivateEndpointConnectionListResultPage{ - fn: getNextPage, - peclr: cur, - } -} - -// PrivateEndpointConnectionProperties properties of a private endpoint connection. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - Private endpoint which the connection belongs to. - PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - Connection state of the private endpoint connection. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - READ-ONLY; State of the private endpoint connection. - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties. -func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pecp.PrivateEndpoint != nil { - objectMap["privateEndpoint"] = pecp.PrivateEndpoint - } - if pecp.PrivateLinkServiceConnectionState != nil { - objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState - } - return json.Marshal(objectMap) -} - -// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type PrivateEndpointConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateEndpointConnectionsCreateOrUpdateFuture.Result. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("insights.PrivateEndpointConnectionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { - pec, err = client.CreateOrUpdateResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateEndpointConnectionsDeleteFuture.Result. -func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("insights.PrivateEndpointConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateEndpointProperty private endpoint which the connection belongs to. -type PrivateEndpointProperty struct { - // ID - Resource id of the private endpoint. - ID *string `json:"id,omitempty"` -} - -// PrivateLinkResource a private link resource -type PrivateLinkResource struct { - autorest.Response `json:"-"` - // PrivateLinkResourceProperties - Resource properties. - *PrivateLinkResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResource. -func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plr.PrivateLinkResourceProperties != nil { - objectMap["properties"] = plr.PrivateLinkResourceProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. -func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateLinkResourceProperties PrivateLinkResourceProperties - err = json.Unmarshal(*v, &privateLinkResourceProperties) - if err != nil { - return err - } - plr.PrivateLinkResourceProperties = &privateLinkResourceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - plr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - plr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - plr.Type = &typeVar - } - } - } - - return nil -} - -// PrivateLinkResourceListResult a list of private link resources -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]PrivateLinkResource `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceListResult. -func (plrlr PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkResourceListResultIterator provides access to a complete listing of PrivateLinkResource -// values. -type PrivateLinkResourceListResultIterator struct { - i int - page PrivateLinkResourceListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PrivateLinkResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PrivateLinkResourceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateLinkResourceListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PrivateLinkResourceListResultIterator) Response() PrivateLinkResourceListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PrivateLinkResourceListResultIterator) Value() PrivateLinkResource { - if !iter.page.NotDone() { - return PrivateLinkResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateLinkResourceListResultIterator type. -func NewPrivateLinkResourceListResultIterator(page PrivateLinkResourceListResultPage) PrivateLinkResourceListResultIterator { - return PrivateLinkResourceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (plrlr PrivateLinkResourceListResult) IsEmpty() bool { - return plrlr.Value == nil || len(*plrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (plrlr PrivateLinkResourceListResult) hasNextLink() bool { - return plrlr.NextLink != nil && len(*plrlr.NextLink) != 0 -} - -// privateLinkResourceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (plrlr PrivateLinkResourceListResult) privateLinkResourceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !plrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(plrlr.NextLink))) -} - -// PrivateLinkResourceListResultPage contains a page of PrivateLinkResource values. -type PrivateLinkResourceListResultPage struct { - fn func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error) - plrlr PrivateLinkResourceListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PrivateLinkResourceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.plrlr) - if err != nil { - return err - } - page.plrlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PrivateLinkResourceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateLinkResourceListResultPage) NotDone() bool { - return !page.plrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateLinkResourceListResultPage) Response() PrivateLinkResourceListResult { - return page.plrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateLinkResourceListResultPage) Values() []PrivateLinkResource { - if page.plrlr.IsEmpty() { - return nil - } - return *page.plrlr.Value -} - -// Creates a new instance of the PrivateLinkResourceListResultPage type. -func NewPrivateLinkResourceListResultPage(cur PrivateLinkResourceListResult, getNextPage func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error)) PrivateLinkResourceListResultPage { - return PrivateLinkResourceListResultPage{ - fn: getNextPage, - plrlr: cur, - } -} - -// PrivateLinkResourceProperties properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. -func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkScopedResourcesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type PrivateLinkScopedResourcesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateLinkScopedResourcesClient) (ScopedResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateLinkScopedResourcesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateLinkScopedResourcesCreateOrUpdateFuture.Result. -func (future *PrivateLinkScopedResourcesCreateOrUpdateFuture) result(client PrivateLinkScopedResourcesClient) (sr ScopedResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("insights.PrivateLinkScopedResourcesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.CreateOrUpdateResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesCreateOrUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateLinkScopedResourcesDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateLinkScopedResourcesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateLinkScopedResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateLinkScopedResourcesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateLinkScopedResourcesDeleteFuture.Result. -func (future *PrivateLinkScopedResourcesDeleteFuture) result(client PrivateLinkScopedResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("insights.PrivateLinkScopedResourcesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateLinkScopesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PrivateLinkScopesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateLinkScopesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateLinkScopesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateLinkScopesDeleteFuture.Result. -func (future *PrivateLinkScopesDeleteFuture) result(client PrivateLinkScopesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("insights.PrivateLinkScopesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateLinkScopesResource an azure resource object -type PrivateLinkScopesResource struct { - // ID - READ-ONLY; Azure resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkScopesResource. -func (plsr PrivateLinkScopesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plsr.Location != nil { - objectMap["location"] = plsr.Location - } - if plsr.Tags != nil { - objectMap["tags"] = plsr.Tags - } - return json.Marshal(objectMap) -} - -// PrivateLinkServiceConnectionStateProperty state of the private endpoint connection. -type PrivateLinkServiceConnectionStateProperty struct { - // Status - The private link service connection status. - Status *string `json:"status,omitempty"` - // Description - The private link service connection description. - Description *string `json:"description,omitempty"` - // ActionsRequired - READ-ONLY; The actions required for private link service connection. - ActionsRequired *string `json:"actionsRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionStateProperty. -func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plscsp.Status != nil { - objectMap["status"] = plscsp.Status - } - if plscsp.Description != nil { - objectMap["description"] = plscsp.Description - } - return json.Marshal(objectMap) -} - -// ProxyOnlyResource a proxy only azure resource object -type ProxyOnlyResource struct { - // ID - READ-ONLY; Azure resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyOnlyResource. -func (por ProxyOnlyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ProxyResource an azure resource object -type ProxyResource struct { - // ID - READ-ONLY; Azure resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Recurrence the repeating times at which this profile begins. This element is not used if the FixedDate -// element is used. -type Recurrence struct { - // Frequency - 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: 'RecurrenceFrequencyNone', 'RecurrenceFrequencySecond', 'RecurrenceFrequencyMinute', 'RecurrenceFrequencyHour', 'RecurrenceFrequencyDay', 'RecurrenceFrequencyWeek', 'RecurrenceFrequencyMonth', 'RecurrenceFrequencyYear' - Frequency RecurrenceFrequency `json:"frequency,omitempty"` - // Schedule - the scheduling constraints for when the profile begins. - Schedule *RecurrentSchedule `json:"schedule,omitempty"` -} - -// RecurrentSchedule the scheduling constraints for when the profile begins. -type RecurrentSchedule struct { - // TimeZone - 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 - TimeZone *string `json:"timeZone,omitempty"` - // Days - the collection of days that the profile takes effect on. Possible values are Sunday through Saturday. - Days *[]string `json:"days,omitempty"` - // Hours - 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). - Hours *[]int32 `json:"hours,omitempty"` - // Minutes - A collection of minutes at which the profile takes effect at. - Minutes *[]int32 `json:"minutes,omitempty"` -} - -// Resource an azure resource object -type Resource struct { - // ID - READ-ONLY; Azure resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. - Kind *string `json:"kind,omitempty"` - // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// ResourceForUpdate definition of ARM tracked top level resource properties for update operation. -type ResourceForUpdate struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ResourceForUpdate. -func (rfu ResourceForUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rfu.Tags != nil { - objectMap["tags"] = rfu.Tags - } - return json.Marshal(objectMap) -} - -// Response the response to a metrics query. -type Response struct { - autorest.Response `json:"-"` - // Cost - The integer value representing the relative cost of the query. - Cost *float64 `json:"cost,omitempty"` - // 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. - Timespan *string `json:"timespan,omitempty"` - // 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. - Interval *string `json:"interval,omitempty"` - // Namespace - The namespace of the metrics being queried - Namespace *string `json:"namespace,omitempty"` - // Resourceregion - The region of the resource being queried for metrics. - Resourceregion *string `json:"resourceregion,omitempty"` - // Value - the value of the collection. - Value *[]Metric `json:"value,omitempty"` -} - -// ResponseWithError an error response from the API. -type ResponseWithError struct { - // Error - Error information. - Error *Error `json:"error,omitempty"` -} - -// RetentionPolicy specifies the retention policy for the log. -type RetentionPolicy struct { - // Enabled - a value indicating whether the retention policy is enabled. - Enabled *bool `json:"enabled,omitempty"` - // Days - the number of days for the retention in days. A value of 0 will retain the events indefinitely. - Days *int32 `json:"days,omitempty"` -} - -// BasicRuleAction the action that is performed when the alert rule becomes active, and when an alert condition is -// resolved. -type BasicRuleAction interface { - AsRuleEmailAction() (*RuleEmailAction, bool) - AsRuleWebhookAction() (*RuleWebhookAction, bool) - AsRuleAction() (*RuleAction, bool) -} - -// RuleAction the action that is performed when the alert rule becomes active, and when an alert condition is -// resolved. -type RuleAction struct { - // OdataType - Possible values include: 'OdataTypeBasicRuleActionOdataTypeRuleAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleAction(body []byte) (BasicRuleAction, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction): - var rea RuleEmailAction - err := json.Unmarshal(body, &rea) - return rea, err - case string(OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction): - var rwa RuleWebhookAction - err := json.Unmarshal(body, &rwa) - return rwa, err - default: - var ra RuleAction - err := json.Unmarshal(body, &ra) - return ra, err - } -} -func unmarshalBasicRuleActionArray(body []byte) ([]BasicRuleAction, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - raArray := make([]BasicRuleAction, len(rawMessages)) - - for index, rawMessage := range rawMessages { - ra, err := unmarshalBasicRuleAction(*rawMessage) - if err != nil { - return nil, err - } - raArray[index] = ra - } - return raArray, nil -} - -// MarshalJSON is the custom marshaler for RuleAction. -func (ra RuleAction) MarshalJSON() ([]byte, error) { - ra.OdataType = OdataTypeBasicRuleActionOdataTypeRuleAction - objectMap := make(map[string]interface{}) - if ra.OdataType != "" { - objectMap["odata.type"] = ra.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return nil, false -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return nil, false -} - -// AsRuleAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleAction() (*RuleAction, bool) { - return &ra, true -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &ra, true -} - -// BasicRuleCondition the condition that results in the alert rule being activated. -type BasicRuleCondition interface { - AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) - AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) - AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) - AsRuleCondition() (*RuleCondition, bool) -} - -// RuleCondition the condition that results in the alert rule being activated. -type RuleCondition struct { - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeBasicRuleConditionOdataTypeRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleCondition(body []byte) (BasicRuleCondition, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition): - var trc ThresholdRuleCondition - err := json.Unmarshal(body, &trc) - return trc, err - case string(OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition): - var ltrc LocationThresholdRuleCondition - err := json.Unmarshal(body, <rc) - return ltrc, err - case string(OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition): - var merc ManagementEventRuleCondition - err := json.Unmarshal(body, &merc) - return merc, err - default: - var rc RuleCondition - err := json.Unmarshal(body, &rc) - return rc, err - } -} -func unmarshalBasicRuleConditionArray(body []byte) ([]BasicRuleCondition, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - rcArray := make([]BasicRuleCondition, len(rawMessages)) - - for index, rawMessage := range rawMessages { - rc, err := unmarshalBasicRuleCondition(*rawMessage) - if err != nil { - return nil, err - } - rcArray[index] = rc - } - return rcArray, nil -} - -// MarshalJSON is the custom marshaler for RuleCondition. -func (rc RuleCondition) MarshalJSON() ([]byte, error) { - rc.OdataType = OdataTypeBasicRuleConditionOdataTypeRuleCondition - objectMap := make(map[string]interface{}) - objectMap["dataSource"] = rc.DataSource - if rc.OdataType != "" { - objectMap["odata.type"] = rc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return &rc, true -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &rc, true -} - -// UnmarshalJSON is the custom unmarshaler for RuleCondition struct. -func (rc *RuleCondition) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - rc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - rc.OdataType = odataType - } - } - } - - return nil -} - -// BasicRuleDataSource the resource from which the rule collects its data. -type BasicRuleDataSource interface { - AsRuleMetricDataSource() (*RuleMetricDataSource, bool) - AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) - AsRuleDataSource() (*RuleDataSource, bool) -} - -// RuleDataSource the resource from which the rule collects its data. -type RuleDataSource struct { - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - LegacyResourceID *string `json:"legacyResourceId,omitempty"` - // ResourceLocation - the location of the resource. - ResourceLocation *string `json:"resourceLocation,omitempty"` - // MetricNamespace - the namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleDataSource(body []byte) (BasicRuleDataSource, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource): - var rmds RuleMetricDataSource - err := json.Unmarshal(body, &rmds) - return rmds, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource): - var rmeds RuleManagementEventDataSource - err := json.Unmarshal(body, &rmeds) - return rmeds, err - default: - var rds RuleDataSource - err := json.Unmarshal(body, &rds) - return rds, err - } -} -func unmarshalBasicRuleDataSourceArray(body []byte) ([]BasicRuleDataSource, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - rdsArray := make([]BasicRuleDataSource, len(rawMessages)) - - for index, rawMessage := range rawMessages { - rds, err := unmarshalBasicRuleDataSource(*rawMessage) - if err != nil { - return nil, err - } - rdsArray[index] = rds - } - return rdsArray, nil -} - -// MarshalJSON is the custom marshaler for RuleDataSource. -func (rds RuleDataSource) MarshalJSON() ([]byte, error) { - rds.OdataType = OdataTypeRuleDataSource - objectMap := make(map[string]interface{}) - if rds.ResourceURI != nil { - objectMap["resourceUri"] = rds.ResourceURI - } - if rds.LegacyResourceID != nil { - objectMap["legacyResourceId"] = rds.LegacyResourceID - } - if rds.ResourceLocation != nil { - objectMap["resourceLocation"] = rds.ResourceLocation - } - if rds.MetricNamespace != nil { - objectMap["metricNamespace"] = rds.MetricNamespace - } - if rds.OdataType != "" { - objectMap["odata.type"] = rds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return nil, false -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return nil, false -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return &rds, true -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rds, true -} - -// RuleEmailAction specifies the action to send email when the rule condition is evaluated. The -// discriminator is always RuleEmailAction in this case. -type RuleEmailAction struct { - // SendToServiceOwners - Whether the administrators (service and co-administrators) of the service should be notified when the alert is activated. - SendToServiceOwners *bool `json:"sendToServiceOwners,omitempty"` - // CustomEmails - the list of administrator's custom email addresses to notify of the activation of the alert. - CustomEmails *[]string `json:"customEmails,omitempty"` - // OdataType - Possible values include: 'OdataTypeBasicRuleActionOdataTypeRuleAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleEmailAction. -func (rea RuleEmailAction) MarshalJSON() ([]byte, error) { - rea.OdataType = OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction - objectMap := make(map[string]interface{}) - if rea.SendToServiceOwners != nil { - objectMap["sendToServiceOwners"] = rea.SendToServiceOwners - } - if rea.CustomEmails != nil { - objectMap["customEmails"] = rea.CustomEmails - } - if rea.OdataType != "" { - objectMap["odata.type"] = rea.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return &rea, true -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return nil, false -} - -// AsRuleAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleAction() (*RuleAction, bool) { - return nil, false -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &rea, true -} - -// RuleManagementEventClaimsDataSource the claims for a rule management event data source. -type RuleManagementEventClaimsDataSource struct { - // EmailAddress - the email address. - EmailAddress *string `json:"emailAddress,omitempty"` -} - -// RuleManagementEventDataSource a rule management event data source. The discriminator fields is always -// RuleManagementEventDataSource in this case. -type RuleManagementEventDataSource struct { - // EventName - the event name. - EventName *string `json:"eventName,omitempty"` - // EventSource - the event source. - EventSource *string `json:"eventSource,omitempty"` - // Level - the level. - Level *string `json:"level,omitempty"` - // OperationName - The name of the operation that should be checked for. If no name is provided, any operation will match. - OperationName *string `json:"operationName,omitempty"` - // ResourceGroupName - the resource group name. - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - // ResourceProviderName - the resource provider name. - ResourceProviderName *string `json:"resourceProviderName,omitempty"` - // Status - The status of the operation that should be checked for. If no status is provided, any status will match. - Status *string `json:"status,omitempty"` - // SubStatus - the substatus. - SubStatus *string `json:"subStatus,omitempty"` - // Claims - the claims. - Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - LegacyResourceID *string `json:"legacyResourceId,omitempty"` - // ResourceLocation - the location of the resource. - ResourceLocation *string `json:"resourceLocation,omitempty"` - // MetricNamespace - the namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { - rmeds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource - objectMap := make(map[string]interface{}) - if rmeds.EventName != nil { - objectMap["eventName"] = rmeds.EventName - } - if rmeds.EventSource != nil { - objectMap["eventSource"] = rmeds.EventSource - } - if rmeds.Level != nil { - objectMap["level"] = rmeds.Level - } - if rmeds.OperationName != nil { - objectMap["operationName"] = rmeds.OperationName - } - if rmeds.ResourceGroupName != nil { - objectMap["resourceGroupName"] = rmeds.ResourceGroupName - } - if rmeds.ResourceProviderName != nil { - objectMap["resourceProviderName"] = rmeds.ResourceProviderName - } - if rmeds.Status != nil { - objectMap["status"] = rmeds.Status - } - if rmeds.SubStatus != nil { - objectMap["subStatus"] = rmeds.SubStatus - } - if rmeds.Claims != nil { - objectMap["claims"] = rmeds.Claims - } - if rmeds.ResourceURI != nil { - objectMap["resourceUri"] = rmeds.ResourceURI - } - if rmeds.LegacyResourceID != nil { - objectMap["legacyResourceId"] = rmeds.LegacyResourceID - } - if rmeds.ResourceLocation != nil { - objectMap["resourceLocation"] = rmeds.ResourceLocation - } - if rmeds.MetricNamespace != nil { - objectMap["metricNamespace"] = rmeds.MetricNamespace - } - if rmeds.OdataType != "" { - objectMap["odata.type"] = rmeds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return nil, false -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return &rmeds, true -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return nil, false -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rmeds, true -} - -// RuleMetricDataSource a rule metric data source. The discriminator value is always RuleMetricDataSource -// in this case. -type RuleMetricDataSource struct { - // MetricName - the name of the metric that defines what the rule monitors. - MetricName *string `json:"metricName,omitempty"` - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - LegacyResourceID *string `json:"legacyResourceId,omitempty"` - // ResourceLocation - the location of the resource. - ResourceLocation *string `json:"resourceLocation,omitempty"` - // MetricNamespace - the namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleMetricDataSource. -func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) { - rmds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource - objectMap := make(map[string]interface{}) - if rmds.MetricName != nil { - objectMap["metricName"] = rmds.MetricName - } - if rmds.ResourceURI != nil { - objectMap["resourceUri"] = rmds.ResourceURI - } - if rmds.LegacyResourceID != nil { - objectMap["legacyResourceId"] = rmds.LegacyResourceID - } - if rmds.ResourceLocation != nil { - objectMap["resourceLocation"] = rmds.ResourceLocation - } - if rmds.MetricNamespace != nil { - objectMap["metricNamespace"] = rmds.MetricNamespace - } - if rmds.OdataType != "" { - objectMap["odata.type"] = rmds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return &rmds, true -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return nil, false -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return nil, false -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rmds, true -} - -// RuleWebhookAction specifies the action to post to service when the rule condition is evaluated. The -// discriminator is always RuleWebhookAction in this case. -type RuleWebhookAction struct { - // ServiceURI - the service uri to Post the notification when the alert activates or resolves. - ServiceURI *string `json:"serviceUri,omitempty"` - // Properties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. - Properties map[string]*string `json:"properties"` - // OdataType - Possible values include: 'OdataTypeBasicRuleActionOdataTypeRuleAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleWebhookAction. -func (rwa RuleWebhookAction) MarshalJSON() ([]byte, error) { - rwa.OdataType = OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction - objectMap := make(map[string]interface{}) - if rwa.ServiceURI != nil { - objectMap["serviceUri"] = rwa.ServiceURI - } - if rwa.Properties != nil { - objectMap["properties"] = rwa.Properties - } - if rwa.OdataType != "" { - objectMap["odata.type"] = rwa.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return nil, false -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return &rwa, true -} - -// AsRuleAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleAction() (*RuleAction, bool) { - return nil, false -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &rwa, true -} - -// ScaleAction the parameters for the scaling action. -type ScaleAction struct { - // Direction - the scale direction. Whether the scaling action increases or decreases the number of instances. Possible values include: 'ScaleDirectionNone', 'ScaleDirectionIncrease', 'ScaleDirectionDecrease' - Direction ScaleDirection `json:"direction,omitempty"` - // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ScaleTypeChangeCount', 'ScaleTypePercentChangeCount', 'ScaleTypeExactCount' - Type ScaleType `json:"type,omitempty"` - // Value - the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1. - Value *string `json:"value,omitempty"` - // Cooldown - 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. - Cooldown *string `json:"cooldown,omitempty"` -} - -// ScaleCapacity the number of instances that can be used during this profile. -type ScaleCapacity struct { - // Minimum - the minimum number of instances for the resource. - Minimum *string `json:"minimum,omitempty"` - // Maximum - 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. - Maximum *string `json:"maximum,omitempty"` - // Default - 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. - Default *string `json:"default,omitempty"` -} - -// ScaleRule a rule that provide the triggers and parameters for the scaling action. -type ScaleRule struct { - // MetricTrigger - the trigger that results in a scaling action. - MetricTrigger *MetricTrigger `json:"metricTrigger,omitempty"` - // ScaleAction - the parameters for the scaling action. - ScaleAction *ScaleAction `json:"scaleAction,omitempty"` -} - -// ScaleRuleMetricDimension specifies an auto scale rule metric dimension. -type ScaleRuleMetricDimension struct { - // DimensionName - Name of the dimension. - DimensionName *string `json:"DimensionName,omitempty"` - // Operator - the dimension operator. Only 'Equals' and 'NotEquals' are supported. 'Equals' being equal to any of the values. 'NotEquals' being not equal to all of the values. Possible values include: 'ScaleRuleMetricDimensionOperationTypeEquals', 'ScaleRuleMetricDimensionOperationTypeNotEquals' - Operator ScaleRuleMetricDimensionOperationType `json:"Operator,omitempty"` - // Values - list of dimension values. For example: ["App1","App2"]. - Values *[]string `json:"Values,omitempty"` -} - -// Schedule defines how often to run the search and the time interval. -type Schedule struct { - // FrequencyInMinutes - frequency (in minutes) at which rule condition should be evaluated. - FrequencyInMinutes *int32 `json:"frequencyInMinutes,omitempty"` - // TimeWindowInMinutes - Time window for which data needs to be fetched for query (should be greater than or equal to frequencyInMinutes). - TimeWindowInMinutes *int32 `json:"timeWindowInMinutes,omitempty"` -} - -// ScopedResource a private link scoped resource -type ScopedResource struct { - autorest.Response `json:"-"` - // ScopedResourceProperties - Resource properties. - *ScopedResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScopedResource. -func (sr ScopedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sr.ScopedResourceProperties != nil { - objectMap["properties"] = sr.ScopedResourceProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ScopedResource struct. -func (sr *ScopedResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var scopedResourceProperties ScopedResourceProperties - err = json.Unmarshal(*v, &scopedResourceProperties) - if err != nil { - return err - } - sr.ScopedResourceProperties = &scopedResourceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sr.Type = &typeVar - } - } - } - - return nil -} - -// ScopedResourceListResult a list of scoped resources in a private link scope. -type ScopedResourceListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ScopedResource `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScopedResourceListResult. -func (srlr ScopedResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ScopedResourceListResultIterator provides access to a complete listing of ScopedResource values. -type ScopedResourceListResultIterator struct { - i int - page ScopedResourceListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ScopedResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopedResourceListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ScopedResourceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ScopedResourceListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ScopedResourceListResultIterator) Response() ScopedResourceListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ScopedResourceListResultIterator) Value() ScopedResource { - if !iter.page.NotDone() { - return ScopedResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ScopedResourceListResultIterator type. -func NewScopedResourceListResultIterator(page ScopedResourceListResultPage) ScopedResourceListResultIterator { - return ScopedResourceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (srlr ScopedResourceListResult) IsEmpty() bool { - return srlr.Value == nil || len(*srlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (srlr ScopedResourceListResult) hasNextLink() bool { - return srlr.NextLink != nil && len(*srlr.NextLink) != 0 -} - -// scopedResourceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (srlr ScopedResourceListResult) scopedResourceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !srlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(srlr.NextLink))) -} - -// ScopedResourceListResultPage contains a page of ScopedResource values. -type ScopedResourceListResultPage struct { - fn func(context.Context, ScopedResourceListResult) (ScopedResourceListResult, error) - srlr ScopedResourceListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ScopedResourceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopedResourceListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.srlr) - if err != nil { - return err - } - page.srlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ScopedResourceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ScopedResourceListResultPage) NotDone() bool { - return !page.srlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ScopedResourceListResultPage) Response() ScopedResourceListResult { - return page.srlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ScopedResourceListResultPage) Values() []ScopedResource { - if page.srlr.IsEmpty() { - return nil - } - return *page.srlr.Value -} - -// Creates a new instance of the ScopedResourceListResultPage type. -func NewScopedResourceListResultPage(cur ScopedResourceListResult, getNextPage func(context.Context, ScopedResourceListResult) (ScopedResourceListResult, error)) ScopedResourceListResultPage { - return ScopedResourceListResultPage{ - fn: getNextPage, - srlr: cur, - } -} - -// ScopedResourceProperties properties of a private link scoped resource. -type ScopedResourceProperties struct { - // LinkedResourceID - The resource id of the scoped Azure monitor resource. - LinkedResourceID *string `json:"linkedResourceId,omitempty"` - // ProvisioningState - READ-ONLY; State of the private endpoint connection. - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScopedResourceProperties. -func (srp ScopedResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if srp.LinkedResourceID != nil { - objectMap["linkedResourceId"] = srp.LinkedResourceID - } - return json.Marshal(objectMap) -} - -// SenderAuthorization 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' -type SenderAuthorization struct { - // Action - the permissible actions. For instance: microsoft.support/supporttickets/write - Action *string `json:"action,omitempty"` - // Role - the role of the user. For instance: Subscription Admin - Role *string `json:"role,omitempty"` - // Scope - the scope. - Scope *string `json:"scope,omitempty"` -} - -// SingleBaseline the baseline values for a single sensitivity value. -type SingleBaseline struct { - // Sensitivity - the sensitivity of the baseline. Possible values include: 'BaselineSensitivityLow', 'BaselineSensitivityMedium', 'BaselineSensitivityHigh' - Sensitivity BaselineSensitivity `json:"sensitivity,omitempty"` - // LowThresholds - The low thresholds of the baseline. - LowThresholds *[]float64 `json:"lowThresholds,omitempty"` - // HighThresholds - The high thresholds of the baseline. - HighThresholds *[]float64 `json:"highThresholds,omitempty"` -} - -// SingleMetricBaseline the baseline results of a single metric. -type SingleMetricBaseline struct { - // ID - The metric baseline Id. - ID *string `json:"id,omitempty"` - // Type - The resource type of the metric baseline resource. - Type *string `json:"type,omitempty"` - // Name - The name of the metric for which the baselines were retrieved. - Name *string `json:"name,omitempty"` - // MetricBaselinesProperties - The metric baseline properties of the metric. - *MetricBaselinesProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SingleMetricBaseline. -func (smb SingleMetricBaseline) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if smb.ID != nil { - objectMap["id"] = smb.ID - } - if smb.Type != nil { - objectMap["type"] = smb.Type - } - if smb.Name != nil { - objectMap["name"] = smb.Name - } - if smb.MetricBaselinesProperties != nil { - objectMap["properties"] = smb.MetricBaselinesProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SingleMetricBaseline struct. -func (smb *SingleMetricBaseline) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - smb.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - smb.Type = &typeVar - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - smb.Name = &name - } - case "properties": - if v != nil { - var metricBaselinesProperties MetricBaselinesProperties - err = json.Unmarshal(*v, &metricBaselinesProperties) - if err != nil { - return err - } - smb.MetricBaselinesProperties = &metricBaselinesProperties - } - } - } - - return nil -} - -// SmsReceiver an SMS receiver. -type SmsReceiver struct { - // Name - The name of the SMS receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // CountryCode - The country code of the SMS receiver. - CountryCode *string `json:"countryCode,omitempty"` - // PhoneNumber - The phone number of the SMS receiver. - PhoneNumber *string `json:"phoneNumber,omitempty"` - // Status - READ-ONLY; The status of the receiver. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled' - Status ReceiverStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for SmsReceiver. -func (sr SmsReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sr.Name != nil { - objectMap["name"] = sr.Name - } - if sr.CountryCode != nil { - objectMap["countryCode"] = sr.CountryCode - } - if sr.PhoneNumber != nil { - objectMap["phoneNumber"] = sr.PhoneNumber - } - return json.Marshal(objectMap) -} - -// Source specifies the log search query. -type Source struct { - // Query - Log search query. Required for action type - AlertingAction - Query *string `json:"query,omitempty"` - // AuthorizedResources - List of Resource referred into query - AuthorizedResources *[]string `json:"authorizedResources,omitempty"` - // DataSourceID - The resource uri over which log search query is to be run. - DataSourceID *string `json:"dataSourceId,omitempty"` - // QueryType - Set value to 'ResultCount'. Possible values include: 'QueryTypeResultCount' - QueryType QueryType `json:"queryType,omitempty"` -} - -// SyslogDataSource definition of which syslog data will be collected and how it will be collected. -// Only collected from Linux machines. -type SyslogDataSource struct { - // Streams - List of streams that this data source will be sent to. - // A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. - Streams *[]KnownSyslogDataSourceStreams `json:"streams,omitempty"` - // FacilityNames - The list of facility names. - FacilityNames *[]KnownSyslogDataSourceFacilityNames `json:"facilityNames,omitempty"` - // LogLevels - The log levels to collect. - LogLevels *[]KnownSyslogDataSourceLogLevels `json:"logLevels,omitempty"` - // Name - A friendly name for the data source. - // This name should be unique across all data sources (regardless of type) within the data collection rule. - Name *string `json:"name,omitempty"` -} - -// SystemData metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // CreatedBy - The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - CreatedByType CreatedByType `json:"createdByType,omitempty"` - // CreatedAt - The timestamp of resource creation (UTC). - CreatedAt *date.Time `json:"createdAt,omitempty"` - // LastModifiedBy - The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The timestamp of resource last modification (UTC) - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// TagsResource a container holding only the Tags for a resource, allowing the user to update the tags on a -// PrivateLinkScope instance. -type TagsResource struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TagsResource. -func (tr TagsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - return json.Marshal(objectMap) -} - -// ThresholdRuleCondition a rule condition based on a metric crossing a threshold. -type ThresholdRuleCondition struct { - // Operator - the operator used to compare the data and the threshold. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' - Operator ConditionOperator `json:"operator,omitempty"` - // Threshold - the threshold value that activates the alert. - Threshold *float64 `json:"threshold,omitempty"` - // WindowSize - 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. - WindowSize *string `json:"windowSize,omitempty"` - // TimeAggregation - 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: 'TimeAggregationOperatorAverage', 'TimeAggregationOperatorMinimum', 'TimeAggregationOperatorMaximum', 'TimeAggregationOperatorTotal', 'TimeAggregationOperatorLast' - TimeAggregation TimeAggregationOperator `json:"timeAggregation,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeBasicRuleConditionOdataTypeRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) MarshalJSON() ([]byte, error) { - trc.OdataType = OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition - objectMap := make(map[string]interface{}) - if trc.Operator != "" { - objectMap["operator"] = trc.Operator - } - if trc.Threshold != nil { - objectMap["threshold"] = trc.Threshold - } - if trc.WindowSize != nil { - objectMap["windowSize"] = trc.WindowSize - } - if trc.TimeAggregation != "" { - objectMap["timeAggregation"] = trc.TimeAggregation - } - objectMap["dataSource"] = trc.DataSource - if trc.OdataType != "" { - objectMap["odata.type"] = trc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return &trc, true -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &trc, true -} - -// UnmarshalJSON is the custom unmarshaler for ThresholdRuleCondition struct. -func (trc *ThresholdRuleCondition) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "operator": - if v != nil { - var operator ConditionOperator - err = json.Unmarshal(*v, &operator) - if err != nil { - return err - } - trc.Operator = operator - } - case "threshold": - if v != nil { - var threshold float64 - err = json.Unmarshal(*v, &threshold) - if err != nil { - return err - } - trc.Threshold = &threshold - } - case "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - trc.WindowSize = &windowSize - } - case "timeAggregation": - if v != nil { - var timeAggregation TimeAggregationOperator - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - trc.TimeAggregation = timeAggregation - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - trc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - trc.OdataType = odataType - } - } - } - - return nil -} - -// TimeSeriesBaseline the baseline values for a single time series. -type TimeSeriesBaseline struct { - // Aggregation - The aggregation type of the metric. - Aggregation *string `json:"aggregation,omitempty"` - // Dimensions - The dimensions of this time series. - Dimensions *[]MetricSingleDimension `json:"dimensions,omitempty"` - // Timestamps - The list of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Data - The baseline values for each sensitivity. - Data *[]SingleBaseline `json:"data,omitempty"` - // MetadataValues - The baseline metadata values. - MetadataValues *[]BaselineMetadata `json:"metadataValues,omitempty"` -} - -// TimeSeriesElement a time series result type. The discriminator value is always TimeSeries in this case. -type TimeSeriesElement struct { - // Metadatavalues - the metadata values returned if $filter was specified in the call. - Metadatavalues *[]MetadataValue `json:"metadatavalues,omitempty"` - // Data - An array of data points representing the metric values. This is only returned if a result type of data is specified. - Data *[]MetricValue `json:"data,omitempty"` -} - -// TimeWindow a specific date-time for the profile. -type TimeWindow struct { - // TimeZone - 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 - TimeZone *string `json:"timeZone,omitempty"` - // Start - the start time for the profile in ISO 8601 format. - Start *date.Time `json:"start,omitempty"` - // End - the end time for the profile in ISO 8601 format. - End *date.Time `json:"end,omitempty"` -} - -// TriggerCondition the condition that results in the Log Search rule. -type TriggerCondition struct { - // ThresholdOperator - Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'ConditionalOperatorGreaterThanOrEqual', 'ConditionalOperatorLessThanOrEqual', 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' - ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` - // Threshold - Result or count threshold based on which rule should be triggered. - Threshold *float64 `json:"threshold,omitempty"` - // MetricTrigger - Trigger condition for metric query rule - MetricTrigger *LogMetricTrigger `json:"metricTrigger,omitempty"` -} - -// VMInsightsOnboardingStatus VM Insights onboarding status for a resource. -type VMInsightsOnboardingStatus struct { - autorest.Response `json:"-"` - // VMInsightsOnboardingStatusProperties - Resource properties. - *VMInsightsOnboardingStatusProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for VMInsightsOnboardingStatus. -func (vios VMInsightsOnboardingStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vios.VMInsightsOnboardingStatusProperties != nil { - objectMap["properties"] = vios.VMInsightsOnboardingStatusProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VMInsightsOnboardingStatus struct. -func (vios *VMInsightsOnboardingStatus) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var VMInsightsOnboardingStatusProperties VMInsightsOnboardingStatusProperties - err = json.Unmarshal(*v, &VMInsightsOnboardingStatusProperties) - if err != nil { - return err - } - vios.VMInsightsOnboardingStatusProperties = &VMInsightsOnboardingStatusProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vios.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vios.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vios.Type = &typeVar - } - } - } - - return nil -} - -// VMInsightsOnboardingStatusProperties resource properties. -type VMInsightsOnboardingStatusProperties struct { - // ResourceID - Azure Resource Manager identifier of the resource whose onboarding status is being represented. - ResourceID *string `json:"resourceId,omitempty"` - // OnboardingStatus - 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: 'OnboardingStatusOnboarded', 'OnboardingStatusNotOnboarded', 'OnboardingStatusUnknown' - OnboardingStatus OnboardingStatus `json:"onboardingStatus,omitempty"` - // DataStatus - 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: 'DataStatusPresent', 'DataStatusNotPresent' - DataStatus DataStatus `json:"dataStatus,omitempty"` - // Data - Containers that currently store VM Insights data for the specified resource. - Data *[]DataContainer `json:"data,omitempty"` -} - -// VoiceReceiver a voice receiver. -type VoiceReceiver struct { - // Name - The name of the voice receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // CountryCode - The country code of the voice receiver. - CountryCode *string `json:"countryCode,omitempty"` - // PhoneNumber - The phone number of the voice receiver. - PhoneNumber *string `json:"phoneNumber,omitempty"` -} - -// WebhookNotification webhook notification of an autoscale event. -type WebhookNotification struct { - // ServiceURI - the service address to receive the notification. - ServiceURI *string `json:"serviceUri,omitempty"` - // Properties - a property bag of settings. This value can be empty. - Properties map[string]*string `json:"properties"` -} - -// MarshalJSON is the custom marshaler for WebhookNotification. -func (wn WebhookNotification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wn.ServiceURI != nil { - objectMap["serviceUri"] = wn.ServiceURI - } - if wn.Properties != nil { - objectMap["properties"] = wn.Properties - } - return json.Marshal(objectMap) -} - -// WebhookReceiver a webhook receiver. -type WebhookReceiver struct { - // Name - The name of the webhook receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // ServiceURI - The URI where webhooks should be sent. - ServiceURI *string `json:"serviceUri,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` - // UseAadAuth - Indicates whether or not use AAD authentication. - UseAadAuth *bool `json:"useAadAuth,omitempty"` - // ObjectID - Indicates the webhook app object Id for aad auth. - ObjectID *string `json:"objectId,omitempty"` - // IdentifierURI - Indicates the identifier uri for aad auth. - IdentifierURI *string `json:"identifierUri,omitempty"` - // TenantID - Indicates the tenant id for aad auth. - TenantID *string `json:"tenantId,omitempty"` -} - -// WebtestLocationAvailabilityCriteria specifies the metric alert rule criteria for a web test resource. -type WebtestLocationAvailabilityCriteria struct { - // WebTestID - The Application Insights web test Id. - WebTestID *string `json:"webTestId,omitempty"` - // ComponentID - The Application Insights resource Id. - ComponentID *string `json:"componentId,omitempty"` - // FailedLocationCount - The number of failed locations. - FailedLocationCount *float64 `json:"failedLocationCount,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) MarshalJSON() ([]byte, error) { - wlac.OdataType = OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria - objectMap := make(map[string]interface{}) - if wlac.WebTestID != nil { - objectMap["webTestId"] = wlac.WebTestID - } - if wlac.ComponentID != nil { - objectMap["componentId"] = wlac.ComponentID - } - if wlac.FailedLocationCount != nil { - objectMap["failedLocationCount"] = wlac.FailedLocationCount - } - if wlac.OdataType != "" { - objectMap["odata.type"] = wlac.OdataType - } - for k, v := range wlac.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return &wlac, true -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return nil, false -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &wlac, true -} - -// UnmarshalJSON is the custom unmarshaler for WebtestLocationAvailabilityCriteria struct. -func (wlac *WebtestLocationAvailabilityCriteria) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "webTestId": - if v != nil { - var webTestID string - err = json.Unmarshal(*v, &webTestID) - if err != nil { - return err - } - wlac.WebTestID = &webTestID - } - case "componentId": - if v != nil { - var componentID string - err = json.Unmarshal(*v, &componentID) - if err != nil { - return err - } - wlac.ComponentID = &componentID - } - case "failedLocationCount": - if v != nil { - var failedLocationCount float64 - err = json.Unmarshal(*v, &failedLocationCount) - if err != nil { - return err - } - wlac.FailedLocationCount = &failedLocationCount - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if wlac.AdditionalProperties == nil { - wlac.AdditionalProperties = make(map[string]interface{}) - } - wlac.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - wlac.OdataType = odataType - } - } - } - - return nil -} - -// WindowsEventLogDataSource definition of which Windows Event Log events will be collected and how they -// will be collected. -// Only collected from Windows machines. -type WindowsEventLogDataSource struct { - // Streams - List of streams that this data source will be sent to. - // A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. - Streams *[]KnownWindowsEventLogDataSourceStreams `json:"streams,omitempty"` - // XPathQueries - A list of Windows Event Log queries in XPATH format. - XPathQueries *[]string `json:"xPathQueries,omitempty"` - // Name - A friendly name for the data source. - // This name should be unique across all data sources (regardless of type) within the data collection rule. - Name *string `json:"name,omitempty"` -} - -// WorkspaceInfo information about a Log Analytics Workspace. -type WorkspaceInfo struct { - // ID - Azure Resource Manager identifier of the Log Analytics Workspace. - ID *string `json:"id,omitempty"` - // Location - Location of the Log Analytics workspace. - Location *string `json:"location,omitempty"` - // WorkspaceInfoProperties - Resource properties. - *WorkspaceInfoProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkspaceInfo. -func (wi WorkspaceInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wi.ID != nil { - objectMap["id"] = wi.ID - } - if wi.Location != nil { - objectMap["location"] = wi.Location - } - if wi.WorkspaceInfoProperties != nil { - objectMap["properties"] = wi.WorkspaceInfoProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WorkspaceInfo struct. -func (wi *WorkspaceInfo) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - wi.ID = &ID - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - wi.Location = &location - } - case "properties": - if v != nil { - var workspaceInfoProperties WorkspaceInfoProperties - err = json.Unmarshal(*v, &workspaceInfoProperties) - if err != nil { - return err - } - wi.WorkspaceInfoProperties = &workspaceInfoProperties - } - } - } - - return nil -} - -// WorkspaceInfoProperties resource properties. -type WorkspaceInfoProperties struct { - // CustomerID - Log Analytics workspace identifier. - CustomerID *string `json:"customerId,omitempty"` -} diff --git a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/CHANGELOG.md b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/_meta.json b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/_meta.json new file mode 100644 index 000000000000..a29100fdba83 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "83f6c7b9ac240d3862e909245f0a61d70ae33908", + "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", + "tag": "package-2021-05-preview-diagnostics", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-05-preview-diagnostics --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/actiongroups.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/actiongroups.go similarity index 67% rename from services/preview/monitor/mgmt/2021-04-01-preview/insights/actiongroups.go rename to services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/actiongroups.go index ce2e6509e2da..2462889b553d 100644 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/actiongroups.go +++ b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/actiongroups.go @@ -1,4 +1,4 @@ -package insights +package diagnostics // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -59,25 +59,25 @@ func (client ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGro }}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.ActionGroupsClient", "CreateOrUpdate", err.Error()) + return result, validation.NewError("diagnostics.ActionGroupsClient", "CreateOrUpdate", err.Error()) } req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, actionGroupName, actionGroup) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") return } resp, err := client.CreateOrUpdateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "CreateOrUpdate", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "CreateOrUpdate", resp, "Failure sending request") return } result, err = client.CreateOrUpdateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "CreateOrUpdate", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "CreateOrUpdate", resp, "Failure responding to request") return } @@ -92,7 +92,7 @@ func (client ActionGroupsClient) CreateOrUpdatePreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-06-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -101,7 +101,7 @@ func (client ActionGroupsClient) CreateOrUpdatePreparer(ctx context.Context, res autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}", pathParameters), autorest.WithJSON(actionGroup), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -146,25 +146,25 @@ func (client ActionGroupsClient) Delete(ctx context.Context, resourceGroupName s {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.ActionGroupsClient", "Delete", err.Error()) + return result, validation.NewError("diagnostics.ActionGroupsClient", "Delete", err.Error()) } req, err := client.DeletePreparer(ctx, resourceGroupName, actionGroupName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "Delete", nil, "Failure preparing request") return } resp, err := client.DeleteSender(req) if err != nil { result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "Delete", resp, "Failure sending request") return } result, err = client.DeleteResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "Delete", resp, "Failure responding to request") return } @@ -179,7 +179,7 @@ func (client ActionGroupsClient) DeletePreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-06-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -187,7 +187,7 @@ func (client ActionGroupsClient) DeletePreparer(ctx context.Context, resourceGro preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -234,25 +234,25 @@ func (client ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGro Constraints: []validation.Constraint{{Target: "enableRequest.ReceiverName", Name: validation.Null, Rule: true, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.ActionGroupsClient", "EnableReceiver", err.Error()) + return result, validation.NewError("diagnostics.ActionGroupsClient", "EnableReceiver", err.Error()) } req, err := client.EnableReceiverPreparer(ctx, resourceGroupName, actionGroupName, enableRequest) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "EnableReceiver", nil, "Failure preparing request") return } resp, err := client.EnableReceiverSender(req) if err != nil { result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "EnableReceiver", resp, "Failure sending request") return } result, err = client.EnableReceiverResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "EnableReceiver", resp, "Failure responding to request") return } @@ -267,7 +267,7 @@ func (client ActionGroupsClient) EnableReceiverPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-06-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -276,7 +276,7 @@ func (client ActionGroupsClient) EnableReceiverPreparer(ctx context.Context, res autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}/subscribe", pathParameters), autorest.WithJSON(enableRequest), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -293,7 +293,7 @@ func (client ActionGroupsClient) EnableReceiverSender(req *http.Request) (*http. func (client ActionGroupsClient) EnableReceiverResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusConflict), + azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByClosing()) result.Response = resp return @@ -320,25 +320,25 @@ func (client ActionGroupsClient) Get(ctx context.Context, resourceGroupName stri {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.ActionGroupsClient", "Get", err.Error()) + return result, validation.NewError("diagnostics.ActionGroupsClient", "Get", err.Error()) } req, err := client.GetPreparer(ctx, resourceGroupName, actionGroupName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Get", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "Get", nil, "Failure preparing request") return } resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Get", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "Get", resp, "Failure sending request") return } result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Get", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "Get", resp, "Failure responding to request") return } @@ -353,7 +353,7 @@ func (client ActionGroupsClient) GetPreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-06-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -361,7 +361,7 @@ func (client ActionGroupsClient) GetPreparer(ctx context.Context, resourceGroupN preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -384,6 +384,86 @@ func (client ActionGroupsClient) GetResponder(resp *http.Response) (result Actio return } +// GetTestNotifications get the test notifications by the notification id +// Parameters: +// notificationID - the notification id +func (client ActionGroupsClient) GetTestNotifications(ctx context.Context, notificationID string) (result TestNotificationDetailsResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.GetTestNotifications") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("diagnostics.ActionGroupsClient", "GetTestNotifications", err.Error()) + } + + req, err := client.GetTestNotificationsPreparer(ctx, notificationID) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "GetTestNotifications", nil, "Failure preparing request") + return + } + + resp, err := client.GetTestNotificationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "GetTestNotifications", resp, "Failure sending request") + return + } + + result, err = client.GetTestNotificationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "GetTestNotifications", resp, "Failure responding to request") + return + } + + return +} + +// GetTestNotificationsPreparer prepares the GetTestNotifications request. +func (client ActionGroupsClient) GetTestNotificationsPreparer(ctx context.Context, notificationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "notificationId": autorest.Encode("path", notificationID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/notificationStatus/{notificationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetTestNotificationsSender sends the GetTestNotifications request. The method will close the +// http.Response Body if it receives an error. +func (client ActionGroupsClient) GetTestNotificationsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetTestNotificationsResponder handles the response to the GetTestNotifications request. The method always +// closes the http.Response Body. +func (client ActionGroupsClient) GetTestNotificationsResponder(resp *http.Response) (result TestNotificationDetailsResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // ListByResourceGroup get a list of all action groups in a resource group. // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. @@ -404,25 +484,25 @@ func (client ActionGroupsClient) ListByResourceGroup(ctx context.Context, resour {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.ActionGroupsClient", "ListByResourceGroup", err.Error()) + return result, validation.NewError("diagnostics.ActionGroupsClient", "ListByResourceGroup", err.Error()) } req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListByResourceGroup", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "ListByResourceGroup", nil, "Failure preparing request") return } resp, err := client.ListByResourceGroupSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListByResourceGroup", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "ListByResourceGroup", resp, "Failure sending request") return } result, err = client.ListByResourceGroupResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListByResourceGroup", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "ListByResourceGroup", resp, "Failure responding to request") return } @@ -436,7 +516,7 @@ func (client ActionGroupsClient) ListByResourceGroupPreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-06-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -444,7 +524,7 @@ func (client ActionGroupsClient) ListByResourceGroupPreparer(ctx context.Context preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -482,25 +562,25 @@ func (client ActionGroupsClient) ListBySubscriptionID(ctx context.Context) (resu if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.ActionGroupsClient", "ListBySubscriptionID", err.Error()) + return result, validation.NewError("diagnostics.ActionGroupsClient", "ListBySubscriptionID", err.Error()) } req, err := client.ListBySubscriptionIDPreparer(ctx) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "ListBySubscriptionID", nil, "Failure preparing request") return } resp, err := client.ListBySubscriptionIDSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "ListBySubscriptionID", resp, "Failure sending request") return } result, err = client.ListBySubscriptionIDResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "ListBySubscriptionID", resp, "Failure responding to request") return } @@ -513,7 +593,7 @@ func (client ActionGroupsClient) ListBySubscriptionIDPreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-06-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -521,7 +601,7 @@ func (client ActionGroupsClient) ListBySubscriptionIDPreparer(ctx context.Contex preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/actionGroups", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -544,6 +624,93 @@ func (client ActionGroupsClient) ListBySubscriptionIDResponder(resp *http.Respon return } +// PostTestNotifications send test notifications to a set of provided receivers +// Parameters: +// notificationRequest - the notification request body which includes the contact details +func (client ActionGroupsClient) PostTestNotifications(ctx context.Context, notificationRequest NotificationRequestBody) (result ActionGroupsPostTestNotificationsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.PostTestNotifications") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: notificationRequest, + Constraints: []validation.Constraint{{Target: "notificationRequest.AlertType", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "notificationRequest.AlertType", Name: validation.MaxLength, Rule: 30, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("diagnostics.ActionGroupsClient", "PostTestNotifications", err.Error()) + } + + req, err := client.PostTestNotificationsPreparer(ctx, notificationRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "PostTestNotifications", nil, "Failure preparing request") + return + } + + result, err = client.PostTestNotificationsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "PostTestNotifications", result.Response(), "Failure sending request") + return + } + + return +} + +// PostTestNotificationsPreparer prepares the PostTestNotifications request. +func (client ActionGroupsClient) PostTestNotificationsPreparer(ctx context.Context, notificationRequest NotificationRequestBody) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/createNotifications", pathParameters), + autorest.WithJSON(notificationRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PostTestNotificationsSender sends the PostTestNotifications request. The method will close the +// http.Response Body if it receives an error. +func (client ActionGroupsClient) PostTestNotificationsSender(req *http.Request) (future ActionGroupsPostTestNotificationsFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// PostTestNotificationsResponder handles the response to the PostTestNotifications request. The method always +// closes the http.Response Body. +func (client ActionGroupsClient) PostTestNotificationsResponder(resp *http.Response) (result TestNotificationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // Update updates an existing action group's tags. To update other fields use the CreateOrUpdate method. // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. @@ -566,25 +733,25 @@ func (client ActionGroupsClient) Update(ctx context.Context, resourceGroupName s {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.ActionGroupsClient", "Update", err.Error()) + return result, validation.NewError("diagnostics.ActionGroupsClient", "Update", err.Error()) } req, err := client.UpdatePreparer(ctx, resourceGroupName, actionGroupName, actionGroupPatch) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Update", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "Update", nil, "Failure preparing request") return } resp, err := client.UpdateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Update", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "Update", resp, "Failure sending request") return } result, err = client.UpdateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Update", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "Update", resp, "Failure responding to request") return } @@ -599,7 +766,7 @@ func (client ActionGroupsClient) UpdatePreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-06-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -608,7 +775,7 @@ func (client ActionGroupsClient) UpdatePreparer(ctx context.Context, resourceGro autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}", pathParameters), autorest.WithJSON(actionGroupPatch), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/autoscalesettings.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/autoscalesettings.go similarity index 81% rename from services/preview/monitor/mgmt/2021-04-01-preview/insights/autoscalesettings.go rename to services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/autoscalesettings.go index db9b916df1d9..c3e87ca2a97a 100644 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/autoscalesettings.go +++ b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/autoscalesettings.go @@ -1,4 +1,4 @@ -package insights +package diagnostics // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -53,31 +53,32 @@ func (client AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resour Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AutoscaleSetting", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.MaxItems, Rule: 20, Chain: nil}}}, - }}}}, + Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AutoscaleSetting", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.MaxItems, Rule: 20, Chain: nil}}}, + }}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.AutoscaleSettingsClient", "CreateOrUpdate", err.Error()) + return result, validation.NewError("diagnostics.AutoscaleSettingsClient", "CreateOrUpdate", err.Error()) } req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, autoscaleSettingName, parameters) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") return } resp, err := client.CreateOrUpdateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure sending request") return } result, err = client.CreateOrUpdateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") return } @@ -92,16 +93,20 @@ func (client AutoscaleSettingsClient) CreateOrUpdatePreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2015-04-01" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } + parameters.ID = nil + parameters.Name = nil + parameters.Type = nil + parameters.SystemData = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -146,25 +151,25 @@ func (client AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupN {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.AutoscaleSettingsClient", "Delete", err.Error()) + return result, validation.NewError("diagnostics.AutoscaleSettingsClient", "Delete", err.Error()) } req, err := client.DeletePreparer(ctx, resourceGroupName, autoscaleSettingName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "Delete", nil, "Failure preparing request") return } resp, err := client.DeleteSender(req) if err != nil { result.Response = resp - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "Delete", resp, "Failure sending request") return } result, err = client.DeleteResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "Delete", resp, "Failure responding to request") return } @@ -179,7 +184,7 @@ func (client AutoscaleSettingsClient) DeletePreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2015-04-01" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -187,7 +192,7 @@ func (client AutoscaleSettingsClient) DeletePreparer(ctx context.Context, resour preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -230,25 +235,25 @@ func (client AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.AutoscaleSettingsClient", "Get", err.Error()) + return result, validation.NewError("diagnostics.AutoscaleSettingsClient", "Get", err.Error()) } req, err := client.GetPreparer(ctx, resourceGroupName, autoscaleSettingName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Get", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "Get", nil, "Failure preparing request") return } resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Get", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "Get", resp, "Failure sending request") return } result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Get", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "Get", resp, "Failure responding to request") return } @@ -263,7 +268,7 @@ func (client AutoscaleSettingsClient) GetPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2015-04-01" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -271,7 +276,7 @@ func (client AutoscaleSettingsClient) GetPreparer(ctx context.Context, resourceG preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -314,26 +319,26 @@ func (client AutoscaleSettingsClient) ListByResourceGroup(ctx context.Context, r {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.AutoscaleSettingsClient", "ListByResourceGroup", err.Error()) + return result, validation.NewError("diagnostics.AutoscaleSettingsClient", "ListByResourceGroup", err.Error()) } result.fn = client.listByResourceGroupNextResults req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "ListByResourceGroup", nil, "Failure preparing request") return } resp, err := client.ListByResourceGroupSender(req) if err != nil { result.asrc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure sending request") return } result.asrc, err = client.ListByResourceGroupResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure responding to request") return } if result.asrc.hasNextLink() && result.asrc.IsEmpty() { @@ -351,7 +356,7 @@ func (client AutoscaleSettingsClient) ListByResourceGroupPreparer(ctx context.Co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2015-04-01" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -359,7 +364,7 @@ func (client AutoscaleSettingsClient) ListByResourceGroupPreparer(ctx context.Co preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -386,7 +391,7 @@ func (client AutoscaleSettingsClient) ListByResourceGroupResponder(resp *http.Re func (client AutoscaleSettingsClient) listByResourceGroupNextResults(ctx context.Context, lastResults AutoscaleSettingResourceCollection) (result AutoscaleSettingResourceCollection, err error) { req, err := lastResults.autoscaleSettingResourceCollectionPreparer(ctx) if err != nil { - return result, autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") } if req == nil { return @@ -394,11 +399,11 @@ func (client AutoscaleSettingsClient) listByResourceGroupNextResults(ctx context resp, err := client.ListByResourceGroupSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") } result, err = client.ListByResourceGroupResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") } return } @@ -434,26 +439,26 @@ func (client AutoscaleSettingsClient) ListBySubscription(ctx context.Context) (r if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.AutoscaleSettingsClient", "ListBySubscription", err.Error()) + return result, validation.NewError("diagnostics.AutoscaleSettingsClient", "ListBySubscription", err.Error()) } result.fn = client.listBySubscriptionNextResults req, err := client.ListBySubscriptionPreparer(ctx) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "ListBySubscription", nil, "Failure preparing request") return } resp, err := client.ListBySubscriptionSender(req) if err != nil { result.asrc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "ListBySubscription", resp, "Failure sending request") return } result.asrc, err = client.ListBySubscriptionResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "ListBySubscription", resp, "Failure responding to request") return } if result.asrc.hasNextLink() && result.asrc.IsEmpty() { @@ -470,7 +475,7 @@ func (client AutoscaleSettingsClient) ListBySubscriptionPreparer(ctx context.Con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2015-04-01" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -478,7 +483,7 @@ func (client AutoscaleSettingsClient) ListBySubscriptionPreparer(ctx context.Con preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/autoscalesettings", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -505,7 +510,7 @@ func (client AutoscaleSettingsClient) ListBySubscriptionResponder(resp *http.Res func (client AutoscaleSettingsClient) listBySubscriptionNextResults(ctx context.Context, lastResults AutoscaleSettingResourceCollection) (result AutoscaleSettingResourceCollection, err error) { req, err := lastResults.autoscaleSettingResourceCollectionPreparer(ctx) if err != nil { - return result, autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") } if req == nil { return @@ -513,11 +518,11 @@ func (client AutoscaleSettingsClient) listBySubscriptionNextResults(ctx context. resp, err := client.ListBySubscriptionSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") } result, err = client.ListBySubscriptionResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") } return } @@ -560,25 +565,25 @@ func (client AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupN {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.AutoscaleSettingsClient", "Update", err.Error()) + return result, validation.NewError("diagnostics.AutoscaleSettingsClient", "Update", err.Error()) } req, err := client.UpdatePreparer(ctx, resourceGroupName, autoscaleSettingName, autoscaleSettingResource) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Update", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "Update", nil, "Failure preparing request") return } resp, err := client.UpdateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Update", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "Update", resp, "Failure sending request") return } result, err = client.UpdateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Update", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "Update", resp, "Failure responding to request") return } @@ -593,7 +598,7 @@ func (client AutoscaleSettingsClient) UpdatePreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2015-04-01" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -602,7 +607,7 @@ func (client AutoscaleSettingsClient) UpdatePreparer(ctx context.Context, resour autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), autorest.WithJSON(autoscaleSettingResource), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/client.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/client.go new file mode 100644 index 000000000000..639583c55438 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/client.go @@ -0,0 +1,41 @@ +// Package diagnostics implements the Azure ARM Diagnostics service API version . +// +// Monitor Management Client +package diagnostics + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for 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 ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Diagnostics + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Diagnostics. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/diagnosticsapi/interfaces.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/diagnosticsapi/interfaces.go new file mode 100644 index 000000000000..c7e020bc5902 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/diagnosticsapi/interfaces.go @@ -0,0 +1,137 @@ +package diagnosticsapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for 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 ( + "context" + "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics" + "github.com/Azure/go-autorest/autorest" +) + +// AutoscaleSettingsClientAPI contains the set of methods on the AutoscaleSettingsClient type. +type AutoscaleSettingsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters diagnostics.AutoscaleSettingResource) (result diagnostics.AutoscaleSettingResource, err error) + Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result diagnostics.AutoscaleSettingResource, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result diagnostics.AutoscaleSettingResourceCollectionPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result diagnostics.AutoscaleSettingResourceCollectionIterator, err error) + ListBySubscription(ctx context.Context) (result diagnostics.AutoscaleSettingResourceCollectionPage, err error) + ListBySubscriptionComplete(ctx context.Context) (result diagnostics.AutoscaleSettingResourceCollectionIterator, err error) + Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource diagnostics.AutoscaleSettingResourcePatch) (result diagnostics.AutoscaleSettingResource, err error) +} + +var _ AutoscaleSettingsClientAPI = (*diagnostics.AutoscaleSettingsClient)(nil) + +// PredictiveMetricClientAPI contains the set of methods on the PredictiveMetricClient type. +type PredictiveMetricClientAPI interface { + Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string, timespan string, interval string, metricNamespace string, metricName string, aggregation string) (result diagnostics.PredictiveResponse, err error) +} + +var _ PredictiveMetricClientAPI = (*diagnostics.PredictiveMetricClient)(nil) + +// SettingsClientAPI contains the set of methods on the SettingsClient type. +type SettingsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceURI string, parameters diagnostics.SettingsResource, name string) (result diagnostics.SettingsResource, err error) + Delete(ctx context.Context, resourceURI string, name string) (result autorest.Response, err error) + Get(ctx context.Context, resourceURI string, name string) (result diagnostics.SettingsResource, err error) + List(ctx context.Context, resourceURI string) (result diagnostics.SettingsResourceCollection, err error) +} + +var _ SettingsClientAPI = (*diagnostics.SettingsClient)(nil) + +// SettingsCategoryClientAPI contains the set of methods on the SettingsCategoryClient type. +type SettingsCategoryClientAPI interface { + Get(ctx context.Context, resourceURI string, name string) (result diagnostics.SettingsCategoryResource, err error) + List(ctx context.Context, resourceURI string) (result diagnostics.SettingsCategoryResourceCollection, err error) +} + +var _ SettingsCategoryClientAPI = (*diagnostics.SettingsCategoryClient)(nil) + +// ManagementGroupDiagnosticSettingsClientAPI contains the set of methods on the ManagementGroupDiagnosticSettingsClient type. +type ManagementGroupDiagnosticSettingsClientAPI interface { + CreateOrUpdate(ctx context.Context, managementGroupID string, parameters diagnostics.ManagementGroupDiagnosticSettingsResource, name string) (result diagnostics.ManagementGroupDiagnosticSettingsResource, err error) + Delete(ctx context.Context, managementGroupID string, name string) (result autorest.Response, err error) + Get(ctx context.Context, managementGroupID string, name string) (result diagnostics.ManagementGroupDiagnosticSettingsResource, err error) + List(ctx context.Context, managementGroupID string) (result diagnostics.ManagementGroupDiagnosticSettingsResourceCollection, err error) +} + +var _ ManagementGroupDiagnosticSettingsClientAPI = (*diagnostics.ManagementGroupDiagnosticSettingsClient)(nil) + +// SubscriptionDiagnosticSettingsClientAPI contains the set of methods on the SubscriptionDiagnosticSettingsClient type. +type SubscriptionDiagnosticSettingsClientAPI interface { + CreateOrUpdate(ctx context.Context, parameters diagnostics.SubscriptionDiagnosticSettingsResource, name string) (result diagnostics.SubscriptionDiagnosticSettingsResource, err error) + Delete(ctx context.Context, name string) (result autorest.Response, err error) + Get(ctx context.Context, name string) (result diagnostics.SubscriptionDiagnosticSettingsResource, err error) + List(ctx context.Context) (result diagnostics.SubscriptionDiagnosticSettingsResourceCollection, err error) +} + +var _ SubscriptionDiagnosticSettingsClientAPI = (*diagnostics.SubscriptionDiagnosticSettingsClient)(nil) + +// PrivateLinkScopesClientAPI contains the set of methods on the PrivateLinkScopesClient type. +type PrivateLinkScopesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, azureMonitorPrivateLinkScopePayload diagnostics.AzureMonitorPrivateLinkScope) (result diagnostics.AzureMonitorPrivateLinkScope, err error) + Delete(ctx context.Context, resourceGroupName string, scopeName string) (result diagnostics.PrivateLinkScopesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, scopeName string) (result diagnostics.AzureMonitorPrivateLinkScope, err error) + List(ctx context.Context) (result diagnostics.AzureMonitorPrivateLinkScopeListResultPage, err error) + ListComplete(ctx context.Context) (result diagnostics.AzureMonitorPrivateLinkScopeListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result diagnostics.AzureMonitorPrivateLinkScopeListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result diagnostics.AzureMonitorPrivateLinkScopeListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, scopeName string, privateLinkScopeTags diagnostics.TagsResource) (result diagnostics.AzureMonitorPrivateLinkScope, err error) +} + +var _ PrivateLinkScopesClientAPI = (*diagnostics.PrivateLinkScopesClient)(nil) + +// PrivateLinkScopeOperationStatusClientAPI contains the set of methods on the PrivateLinkScopeOperationStatusClient type. +type PrivateLinkScopeOperationStatusClientAPI interface { + Get(ctx context.Context, asyncOperationID string, resourceGroupName string) (result diagnostics.OperationStatus, err error) +} + +var _ PrivateLinkScopeOperationStatusClientAPI = (*diagnostics.PrivateLinkScopeOperationStatusClient)(nil) + +// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. +type PrivateLinkResourcesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, scopeName string, groupName string) (result diagnostics.PrivateLinkResource, err error) + ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result diagnostics.PrivateLinkResourceListResult, err error) +} + +var _ PrivateLinkResourcesClientAPI = (*diagnostics.PrivateLinkResourcesClient)(nil) + +// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. +type PrivateEndpointConnectionsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters diagnostics.PrivateEndpointConnection) (result diagnostics.PrivateEndpointConnectionsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (result diagnostics.PrivateEndpointConnectionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (result diagnostics.PrivateEndpointConnection, err error) + ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result diagnostics.PrivateEndpointConnectionListResult, err error) +} + +var _ PrivateEndpointConnectionsClientAPI = (*diagnostics.PrivateEndpointConnectionsClient)(nil) + +// PrivateLinkScopedResourcesClientAPI contains the set of methods on the PrivateLinkScopedResourcesClient type. +type PrivateLinkScopedResourcesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, name string, parameters diagnostics.ScopedResource) (result diagnostics.PrivateLinkScopedResourcesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, scopeName string, name string) (result diagnostics.PrivateLinkScopedResourcesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, scopeName string, name string) (result diagnostics.ScopedResource, err error) + ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result diagnostics.ScopedResourceListResultPage, err error) + ListByPrivateLinkScopeComplete(ctx context.Context, resourceGroupName string, scopeName string) (result diagnostics.ScopedResourceListResultIterator, err error) +} + +var _ PrivateLinkScopedResourcesClientAPI = (*diagnostics.PrivateLinkScopedResourcesClient)(nil) + +// ActionGroupsClientAPI contains the set of methods on the ActionGroupsClient type. +type ActionGroupsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup diagnostics.ActionGroupResource) (result diagnostics.ActionGroupResource, err error) + Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) + EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest diagnostics.EnableRequest) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result diagnostics.ActionGroupResource, err error) + GetTestNotifications(ctx context.Context, notificationID string) (result diagnostics.TestNotificationDetailsResponse, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result diagnostics.ActionGroupList, err error) + ListBySubscriptionID(ctx context.Context) (result diagnostics.ActionGroupList, err error) + PostTestNotifications(ctx context.Context, notificationRequest diagnostics.NotificationRequestBody) (result diagnostics.ActionGroupsPostTestNotificationsFuture, err error) + Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch diagnostics.ActionGroupPatchBody) (result diagnostics.ActionGroupResource, err error) +} + +var _ ActionGroupsClientAPI = (*diagnostics.ActionGroupsClient)(nil) diff --git a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/enums.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/enums.go new file mode 100644 index 000000000000..89cb1098aa72 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/enums.go @@ -0,0 +1,272 @@ +package diagnostics + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// AccessMode enumerates the values for access mode. +type AccessMode string + +const ( + // Open ... + Open AccessMode = "Open" + // PrivateOnly ... + PrivateOnly AccessMode = "PrivateOnly" +) + +// PossibleAccessModeValues returns an array of possible values for the AccessMode const type. +func PossibleAccessModeValues() []AccessMode { + return []AccessMode{Open, PrivateOnly} +} + +// CategoryType enumerates the values for category type. +type CategoryType string + +const ( + // Logs ... + Logs CategoryType = "Logs" + // Metrics ... + Metrics CategoryType = "Metrics" +) + +// PossibleCategoryTypeValues returns an array of possible values for the CategoryType const type. +func PossibleCategoryTypeValues() []CategoryType { + return []CategoryType{Logs, Metrics} +} + +// ComparisonOperationType enumerates the values for comparison operation type. +type ComparisonOperationType string + +const ( + // Equals ... + Equals ComparisonOperationType = "Equals" + // GreaterThan ... + GreaterThan ComparisonOperationType = "GreaterThan" + // GreaterThanOrEqual ... + GreaterThanOrEqual ComparisonOperationType = "GreaterThanOrEqual" + // LessThan ... + LessThan ComparisonOperationType = "LessThan" + // LessThanOrEqual ... + LessThanOrEqual ComparisonOperationType = "LessThanOrEqual" + // NotEquals ... + NotEquals ComparisonOperationType = "NotEquals" +) + +// PossibleComparisonOperationTypeValues returns an array of possible values for the ComparisonOperationType const type. +func PossibleComparisonOperationTypeValues() []ComparisonOperationType { + return []ComparisonOperationType{Equals, GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual, NotEquals} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // Application ... + Application CreatedByType = "Application" + // Key ... + Key CreatedByType = "Key" + // ManagedIdentity ... + ManagedIdentity CreatedByType = "ManagedIdentity" + // User ... + User CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{Application, Key, ManagedIdentity, User} +} + +// MetricStatisticType enumerates the values for metric statistic type. +type MetricStatisticType string + +const ( + // Average ... + Average MetricStatisticType = "Average" + // Count ... + Count MetricStatisticType = "Count" + // Max ... + Max MetricStatisticType = "Max" + // Min ... + Min MetricStatisticType = "Min" + // Sum ... + Sum MetricStatisticType = "Sum" +) + +// PossibleMetricStatisticTypeValues returns an array of possible values for the MetricStatisticType const type. +func PossibleMetricStatisticTypeValues() []MetricStatisticType { + return []MetricStatisticType{Average, Count, Max, Min, Sum} +} + +// PredictiveAutoscalePolicyScaleMode enumerates the values for predictive autoscale policy scale mode. +type PredictiveAutoscalePolicyScaleMode string + +const ( + // Disabled ... + Disabled PredictiveAutoscalePolicyScaleMode = "Disabled" + // Enabled ... + Enabled PredictiveAutoscalePolicyScaleMode = "Enabled" + // ForecastOnly ... + ForecastOnly PredictiveAutoscalePolicyScaleMode = "ForecastOnly" +) + +// PossiblePredictiveAutoscalePolicyScaleModeValues returns an array of possible values for the PredictiveAutoscalePolicyScaleMode const type. +func PossiblePredictiveAutoscalePolicyScaleModeValues() []PredictiveAutoscalePolicyScaleMode { + return []PredictiveAutoscalePolicyScaleMode{Disabled, Enabled, ForecastOnly} +} + +// PrivateEndpointConnectionProvisioningState enumerates the values for private endpoint connection +// provisioning state. +type PrivateEndpointConnectionProvisioningState string + +const ( + // Creating ... + Creating PrivateEndpointConnectionProvisioningState = "Creating" + // Deleting ... + Deleting PrivateEndpointConnectionProvisioningState = "Deleting" + // Failed ... + Failed PrivateEndpointConnectionProvisioningState = "Failed" + // Succeeded ... + Succeeded PrivateEndpointConnectionProvisioningState = "Succeeded" +) + +// PossiblePrivateEndpointConnectionProvisioningStateValues returns an array of possible values for the PrivateEndpointConnectionProvisioningState const type. +func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { + return []PrivateEndpointConnectionProvisioningState{Creating, Deleting, Failed, Succeeded} +} + +// PrivateEndpointServiceConnectionStatus enumerates the values for private endpoint service connection status. +type PrivateEndpointServiceConnectionStatus string + +const ( + // Approved ... + Approved PrivateEndpointServiceConnectionStatus = "Approved" + // Pending ... + Pending PrivateEndpointServiceConnectionStatus = "Pending" + // Rejected ... + Rejected PrivateEndpointServiceConnectionStatus = "Rejected" +) + +// PossiblePrivateEndpointServiceConnectionStatusValues returns an array of possible values for the PrivateEndpointServiceConnectionStatus const type. +func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointServiceConnectionStatus { + return []PrivateEndpointServiceConnectionStatus{Approved, Pending, Rejected} +} + +// ReceiverStatus enumerates the values for receiver status. +type ReceiverStatus string + +const ( + // ReceiverStatusDisabled ... + ReceiverStatusDisabled ReceiverStatus = "Disabled" + // ReceiverStatusEnabled ... + ReceiverStatusEnabled ReceiverStatus = "Enabled" + // ReceiverStatusNotSpecified ... + ReceiverStatusNotSpecified ReceiverStatus = "NotSpecified" +) + +// PossibleReceiverStatusValues returns an array of possible values for the ReceiverStatus const type. +func PossibleReceiverStatusValues() []ReceiverStatus { + return []ReceiverStatus{ReceiverStatusDisabled, ReceiverStatusEnabled, ReceiverStatusNotSpecified} +} + +// RecurrenceFrequency enumerates the values for recurrence frequency. +type RecurrenceFrequency string + +const ( + // Day ... + Day RecurrenceFrequency = "Day" + // Hour ... + Hour RecurrenceFrequency = "Hour" + // Minute ... + Minute RecurrenceFrequency = "Minute" + // Month ... + Month RecurrenceFrequency = "Month" + // None ... + None RecurrenceFrequency = "None" + // Second ... + Second RecurrenceFrequency = "Second" + // Week ... + Week RecurrenceFrequency = "Week" + // Year ... + Year RecurrenceFrequency = "Year" +) + +// PossibleRecurrenceFrequencyValues returns an array of possible values for the RecurrenceFrequency const type. +func PossibleRecurrenceFrequencyValues() []RecurrenceFrequency { + return []RecurrenceFrequency{Day, Hour, Minute, Month, None, Second, Week, Year} +} + +// ScaleDirection enumerates the values for scale direction. +type ScaleDirection string + +const ( + // ScaleDirectionDecrease ... + ScaleDirectionDecrease ScaleDirection = "Decrease" + // ScaleDirectionIncrease ... + ScaleDirectionIncrease ScaleDirection = "Increase" + // ScaleDirectionNone ... + ScaleDirectionNone ScaleDirection = "None" +) + +// PossibleScaleDirectionValues returns an array of possible values for the ScaleDirection const type. +func PossibleScaleDirectionValues() []ScaleDirection { + return []ScaleDirection{ScaleDirectionDecrease, ScaleDirectionIncrease, ScaleDirectionNone} +} + +// ScaleRuleMetricDimensionOperationType enumerates the values for scale rule metric dimension operation type. +type ScaleRuleMetricDimensionOperationType string + +const ( + // ScaleRuleMetricDimensionOperationTypeEquals ... + ScaleRuleMetricDimensionOperationTypeEquals ScaleRuleMetricDimensionOperationType = "Equals" + // ScaleRuleMetricDimensionOperationTypeNotEquals ... + ScaleRuleMetricDimensionOperationTypeNotEquals ScaleRuleMetricDimensionOperationType = "NotEquals" +) + +// PossibleScaleRuleMetricDimensionOperationTypeValues returns an array of possible values for the ScaleRuleMetricDimensionOperationType const type. +func PossibleScaleRuleMetricDimensionOperationTypeValues() []ScaleRuleMetricDimensionOperationType { + return []ScaleRuleMetricDimensionOperationType{ScaleRuleMetricDimensionOperationTypeEquals, ScaleRuleMetricDimensionOperationTypeNotEquals} +} + +// ScaleType enumerates the values for scale type. +type ScaleType string + +const ( + // ChangeCount ... + ChangeCount ScaleType = "ChangeCount" + // ExactCount ... + ExactCount ScaleType = "ExactCount" + // PercentChangeCount ... + PercentChangeCount ScaleType = "PercentChangeCount" + // ServiceAllowedNextValue ... + ServiceAllowedNextValue ScaleType = "ServiceAllowedNextValue" +) + +// PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. +func PossibleScaleTypeValues() []ScaleType { + return []ScaleType{ChangeCount, ExactCount, PercentChangeCount, ServiceAllowedNextValue} +} + +// TimeAggregationType enumerates the values for time aggregation type. +type TimeAggregationType string + +const ( + // TimeAggregationTypeAverage ... + TimeAggregationTypeAverage TimeAggregationType = "Average" + // TimeAggregationTypeCount ... + TimeAggregationTypeCount TimeAggregationType = "Count" + // TimeAggregationTypeLast ... + TimeAggregationTypeLast TimeAggregationType = "Last" + // TimeAggregationTypeMaximum ... + TimeAggregationTypeMaximum TimeAggregationType = "Maximum" + // TimeAggregationTypeMinimum ... + TimeAggregationTypeMinimum TimeAggregationType = "Minimum" + // TimeAggregationTypeTotal ... + TimeAggregationTypeTotal TimeAggregationType = "Total" +) + +// PossibleTimeAggregationTypeValues returns an array of possible values for the TimeAggregationType const type. +func PossibleTimeAggregationTypeValues() []TimeAggregationType { + return []TimeAggregationType{TimeAggregationTypeAverage, TimeAggregationTypeCount, TimeAggregationTypeLast, TimeAggregationTypeMaximum, TimeAggregationTypeMinimum, TimeAggregationTypeTotal} +} diff --git a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/managementgroupdiagnosticsettings.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/managementgroupdiagnosticsettings.go new file mode 100644 index 000000000000..41005a5bbd1c --- /dev/null +++ b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/managementgroupdiagnosticsettings.go @@ -0,0 +1,334 @@ +package diagnostics + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for 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 ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ManagementGroupDiagnosticSettingsClient is the monitor Management Client +type ManagementGroupDiagnosticSettingsClient struct { + BaseClient +} + +// NewManagementGroupDiagnosticSettingsClient creates an instance of the ManagementGroupDiagnosticSettingsClient +// client. +func NewManagementGroupDiagnosticSettingsClient(subscriptionID string) ManagementGroupDiagnosticSettingsClient { + return NewManagementGroupDiagnosticSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewManagementGroupDiagnosticSettingsClientWithBaseURI creates an instance of the +// ManagementGroupDiagnosticSettingsClient client using a custom endpoint. Use this when interacting with an Azure +// cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewManagementGroupDiagnosticSettingsClientWithBaseURI(baseURI string, subscriptionID string) ManagementGroupDiagnosticSettingsClient { + return ManagementGroupDiagnosticSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates management group diagnostic settings for the specified resource. +// Parameters: +// managementGroupID - the management group id. +// parameters - parameters supplied to the operation. +// name - the name of the diagnostic setting. +func (client ManagementGroupDiagnosticSettingsClient) CreateOrUpdate(ctx context.Context, managementGroupID string, parameters ManagementGroupDiagnosticSettingsResource, name string) (result ManagementGroupDiagnosticSettingsResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagementGroupDiagnosticSettingsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, managementGroupID, parameters, name) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.ManagementGroupDiagnosticSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "diagnostics.ManagementGroupDiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.ManagementGroupDiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ManagementGroupDiagnosticSettingsClient) CreateOrUpdatePreparer(ctx context.Context, managementGroupID string, parameters ManagementGroupDiagnosticSettingsResource, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managementGroupId": managementGroupID, + "name": autorest.Encode("path", name), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementGroupDiagnosticSettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ManagementGroupDiagnosticSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result ManagementGroupDiagnosticSettingsResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes existing management group diagnostic settings for the specified resource. +// Parameters: +// managementGroupID - the management group id. +// name - the name of the diagnostic setting. +func (client ManagementGroupDiagnosticSettingsClient) Delete(ctx context.Context, managementGroupID string, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagementGroupDiagnosticSettingsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, managementGroupID, name) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.ManagementGroupDiagnosticSettingsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "diagnostics.ManagementGroupDiagnosticSettingsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.ManagementGroupDiagnosticSettingsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ManagementGroupDiagnosticSettingsClient) DeletePreparer(ctx context.Context, managementGroupID string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managementGroupId": managementGroupID, + "name": autorest.Encode("path", name), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementGroupDiagnosticSettingsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ManagementGroupDiagnosticSettingsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the active management group diagnostic settings for the specified resource. +// Parameters: +// managementGroupID - the management group id. +// name - the name of the diagnostic setting. +func (client ManagementGroupDiagnosticSettingsClient) Get(ctx context.Context, managementGroupID string, name string) (result ManagementGroupDiagnosticSettingsResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagementGroupDiagnosticSettingsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, managementGroupID, name) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.ManagementGroupDiagnosticSettingsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "diagnostics.ManagementGroupDiagnosticSettingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.ManagementGroupDiagnosticSettingsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ManagementGroupDiagnosticSettingsClient) GetPreparer(ctx context.Context, managementGroupID string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managementGroupId": managementGroupID, + "name": autorest.Encode("path", name), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementGroupDiagnosticSettingsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ManagementGroupDiagnosticSettingsClient) GetResponder(resp *http.Response) (result ManagementGroupDiagnosticSettingsResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets the active management group diagnostic settings list for the specified management group. +// Parameters: +// managementGroupID - the management group id. +func (client ManagementGroupDiagnosticSettingsClient) List(ctx context.Context, managementGroupID string) (result ManagementGroupDiagnosticSettingsResourceCollection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagementGroupDiagnosticSettingsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, managementGroupID) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.ManagementGroupDiagnosticSettingsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "diagnostics.ManagementGroupDiagnosticSettingsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.ManagementGroupDiagnosticSettingsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ManagementGroupDiagnosticSettingsClient) ListPreparer(ctx context.Context, managementGroupID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managementGroupId": managementGroupID, + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementGroupDiagnosticSettingsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ManagementGroupDiagnosticSettingsClient) ListResponder(resp *http.Response) (result ManagementGroupDiagnosticSettingsResourceCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/models.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/models.go new file mode 100644 index 000000000000..ec2789e2e859 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/models.go @@ -0,0 +1,2780 @@ +package diagnostics + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for 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 ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics" + +// AccessModeSettings properties that define the scope private link mode settings. +type AccessModeSettings struct { + // QueryAccessMode - Specifies the default access mode of queries through associated private endpoints in scope. If not specified default value is 'Open'. You can override this default setting for a specific private endpoint connection by adding an exclusion in the 'exclusions' array. Possible values include: 'Open', 'PrivateOnly' + QueryAccessMode AccessMode `json:"queryAccessMode,omitempty"` + // IngestionAccessMode - Specifies the default access mode of ingestion through associated private endpoints in scope. If not specified default value is 'Open'. You can override this default setting for a specific private endpoint connection by adding an exclusion in the 'exclusions' array. Possible values include: 'Open', 'PrivateOnly' + IngestionAccessMode AccessMode `json:"ingestionAccessMode,omitempty"` + // Exclusions - List of exclusions that override the default access mode settings for specific private endpoint connections. + Exclusions *[]AccessModeSettingsExclusion `json:"exclusions,omitempty"` +} + +// AccessModeSettingsExclusion properties that define the scope private link mode settings exclusion item. +// This setting applies to a specific private endpoint connection and overrides the default settings for +// that private endpoint connection. +type AccessModeSettingsExclusion struct { + // PrivateEndpointConnectionName - The private endpoint connection name associated to the private endpoint on which we want to apply the specific access mode settings. + PrivateEndpointConnectionName *string `json:"privateEndpointConnectionName,omitempty"` + // QueryAccessMode - Specifies the access mode of queries through the specified private endpoint connection in the exclusion. Possible values include: 'Open', 'PrivateOnly' + QueryAccessMode AccessMode `json:"queryAccessMode,omitempty"` + // IngestionAccessMode - Specifies the access mode of ingestion through the specified private endpoint connection in the exclusion. Possible values include: 'Open', 'PrivateOnly' + IngestionAccessMode AccessMode `json:"ingestionAccessMode,omitempty"` +} + +// ActionDetail the action detail +type ActionDetail struct { + // MechanismType - The mechanism type + MechanismType *string `json:"MechanismType,omitempty"` + // Name - The name of the action + Name *string `json:"Name,omitempty"` + // Status - The status of the action + Status *string `json:"Status,omitempty"` + // SubState - The substatus of the action + SubState *string `json:"SubState,omitempty"` + // SendTime - The send time + SendTime *string `json:"SendTime,omitempty"` + // Detail - The detail of the friendly error message + Detail *string `json:"Detail,omitempty"` +} + +// ActionGroup an Azure action group. +type ActionGroup struct { + // GroupShortName - The short name of the action group. This will be used in SMS messages. + GroupShortName *string `json:"groupShortName,omitempty"` + // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications. + Enabled *bool `json:"enabled,omitempty"` + // EmailReceivers - The list of email receivers that are part of this action group. + EmailReceivers *[]EmailReceiver `json:"emailReceivers,omitempty"` + // SmsReceivers - The list of SMS receivers that are part of this action group. + SmsReceivers *[]SmsReceiver `json:"smsReceivers,omitempty"` + // WebhookReceivers - The list of webhook receivers that are part of this action group. + WebhookReceivers *[]WebhookReceiver `json:"webhookReceivers,omitempty"` + // ItsmReceivers - The list of ITSM receivers that are part of this action group. + ItsmReceivers *[]ItsmReceiver `json:"itsmReceivers,omitempty"` + // AzureAppPushReceivers - The list of AzureAppPush receivers that are part of this action group. + AzureAppPushReceivers *[]AzureAppPushReceiver `json:"azureAppPushReceivers,omitempty"` + // AutomationRunbookReceivers - The list of AutomationRunbook receivers that are part of this action group. + AutomationRunbookReceivers *[]AutomationRunbookReceiver `json:"automationRunbookReceivers,omitempty"` + // VoiceReceivers - The list of voice receivers that are part of this action group. + VoiceReceivers *[]VoiceReceiver `json:"voiceReceivers,omitempty"` + // LogicAppReceivers - The list of logic app receivers that are part of this action group. + LogicAppReceivers *[]LogicAppReceiver `json:"logicAppReceivers,omitempty"` + // AzureFunctionReceivers - The list of azure function receivers that are part of this action group. + AzureFunctionReceivers *[]AzureFunctionReceiver `json:"azureFunctionReceivers,omitempty"` + // ArmRoleReceivers - 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. + ArmRoleReceivers *[]ArmRoleReceiver `json:"armRoleReceivers,omitempty"` + // EventHubReceivers - The list of event hub receivers that are part of this action group. + EventHubReceivers *[]EventHubReceiver `json:"eventHubReceivers,omitempty"` +} + +// ActionGroupList a list of action groups. +type ActionGroupList struct { + autorest.Response `json:"-"` + // Value - The list of action groups. + Value *[]ActionGroupResource `json:"value,omitempty"` + // NextLink - Provides the link to retrieve the next set of elements. + NextLink *string `json:"nextLink,omitempty"` +} + +// ActionGroupPatch an Azure action group for patch operations. +type ActionGroupPatch struct { + // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated. + Enabled *bool `json:"enabled,omitempty"` +} + +// ActionGroupPatchBody an action group object for the body of patch operations. +type ActionGroupPatchBody struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // ActionGroupPatch - The action group settings for an update operation. + *ActionGroupPatch `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ActionGroupPatchBody. +func (agpb ActionGroupPatchBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agpb.Tags != nil { + objectMap["tags"] = agpb.Tags + } + if agpb.ActionGroupPatch != nil { + objectMap["properties"] = agpb.ActionGroupPatch + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ActionGroupPatchBody struct. +func (agpb *ActionGroupPatchBody) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + agpb.Tags = tags + } + case "properties": + if v != nil { + var actionGroupPatch ActionGroupPatch + err = json.Unmarshal(*v, &actionGroupPatch) + if err != nil { + return err + } + agpb.ActionGroupPatch = &actionGroupPatch + } + } + } + + return nil +} + +// ActionGroupResource an action group resource. +type ActionGroupResource struct { + autorest.Response `json:"-"` + // ActionGroup - The action groups properties of the resource. + *ActionGroup `json:"properties,omitempty"` + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` + // Kind - READ-ONLY; Azure resource kind + Kind *string `json:"kind,omitempty"` + // Identity - READ-ONLY; Azure resource identity + Identity *string `json:"identity,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ActionGroupResource. +func (agr ActionGroupResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agr.ActionGroup != nil { + objectMap["properties"] = agr.ActionGroup + } + if agr.Location != nil { + objectMap["location"] = agr.Location + } + if agr.Tags != nil { + objectMap["tags"] = agr.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ActionGroupResource struct. +func (agr *ActionGroupResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var actionGroup ActionGroup + err = json.Unmarshal(*v, &actionGroup) + if err != nil { + return err + } + agr.ActionGroup = &actionGroup + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agr.Type = &typeVar + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + agr.Kind = &kind + } + case "identity": + if v != nil { + var identity string + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + agr.Identity = &identity + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + agr.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + agr.Tags = tags + } + } + } + + return nil +} + +// ActionGroupsPostTestNotificationsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ActionGroupsPostTestNotificationsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ActionGroupsClient) (TestNotificationResponse, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ActionGroupsPostTestNotificationsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ActionGroupsPostTestNotificationsFuture.Result. +func (future *ActionGroupsPostTestNotificationsFuture) result(client ActionGroupsClient) (tnr TestNotificationResponse, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsPostTestNotificationsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + tnr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("diagnostics.ActionGroupsPostTestNotificationsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if tnr.Response.Response, err = future.GetResult(sender); err == nil && tnr.Response.Response.StatusCode != http.StatusNoContent { + tnr, err = client.PostTestNotificationsResponder(tnr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsPostTestNotificationsFuture", "Result", tnr.Response.Response, "Failure responding to request") + } + } + return +} + +// ArmRoleReceiver an arm role receiver. +type ArmRoleReceiver struct { + // Name - The name of the arm role receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // RoleID - The arm role id. + RoleID *string `json:"roleId,omitempty"` + // UseCommonAlertSchema - Indicates whether to use common alert schema. + UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` +} + +// AutomationRunbookReceiver the Azure Automation Runbook notification receiver. +type AutomationRunbookReceiver struct { + // AutomationAccountID - The Azure automation account Id which holds this runbook and authenticate to Azure resource. + AutomationAccountID *string `json:"automationAccountId,omitempty"` + // RunbookName - The name for this runbook. + RunbookName *string `json:"runbookName,omitempty"` + // WebhookResourceID - The resource id for webhook linked to this runbook. + WebhookResourceID *string `json:"webhookResourceId,omitempty"` + // IsGlobalRunbook - Indicates whether this instance is global runbook. + IsGlobalRunbook *bool `json:"isGlobalRunbook,omitempty"` + // Name - Indicates name of the webhook. + Name *string `json:"name,omitempty"` + // ServiceURI - The URI where webhooks should be sent. + ServiceURI *string `json:"serviceUri,omitempty"` + // UseCommonAlertSchema - Indicates whether to use common alert schema. + UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` +} + +// AutoscaleErrorResponse describes the format of Error response. +type AutoscaleErrorResponse struct { + // Error - The error object. + Error *AutoscaleErrorResponseError `json:"error,omitempty"` + // SystemData - READ-ONLY; The system metadata related to the response. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutoscaleErrorResponse. +func (aer AutoscaleErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aer.Error != nil { + objectMap["error"] = aer.Error + } + return json.Marshal(objectMap) +} + +// AutoscaleErrorResponseError the error object. +type AutoscaleErrorResponseError struct { + // Code - One of a server-defined set of error codes. + Code *string `json:"code,omitempty"` + // Message - A human-readable representation of the error. + Message *string `json:"message,omitempty"` + // Target - The target of the particular error. + Target *string `json:"target,omitempty"` + // Details - A human-readable representation of the error's details. + Details *string `json:"details,omitempty"` +} + +// AutoscaleNotification autoscale notification. +type AutoscaleNotification struct { + // Operation - the operation associated with the notification and its value must be "scale" + Operation *string `json:"operation,omitempty"` + // Email - the email notification. + Email *EmailNotification `json:"email,omitempty"` + // Webhooks - the collection of webhook notifications. + Webhooks *[]WebhookNotification `json:"webhooks,omitempty"` +} + +// AutoscaleProfile autoscale profile. +type AutoscaleProfile struct { + // Name - the name of the profile. + Name *string `json:"name,omitempty"` + // Capacity - the number of instances that can be used during this profile. + Capacity *ScaleCapacity `json:"capacity,omitempty"` + // Rules - the collection of rules that provide the triggers and parameters for the scaling action. A maximum of 10 rules can be specified. + Rules *[]ScaleRule `json:"rules,omitempty"` + // FixedDate - the specific date-time for the profile. This element is not used if the Recurrence element is used. + FixedDate *TimeWindow `json:"fixedDate,omitempty"` + // Recurrence - the repeating times at which this profile begins. This element is not used if the FixedDate element is used. + Recurrence *Recurrence `json:"recurrence,omitempty"` +} + +// AutoscaleSetting a setting that contains all of the configuration for the automatic scaling of a +// resource. +type AutoscaleSetting struct { + // Profiles - the collection of automatic scaling profiles that specify different scaling parameters for different time periods. A maximum of 20 profiles can be specified. + Profiles *[]AutoscaleProfile `json:"profiles,omitempty"` + // Notifications - the collection of notifications. + Notifications *[]AutoscaleNotification `json:"notifications,omitempty"` + // Enabled - the enabled flag. Specifies whether automatic scaling is enabled for the resource. The default value is 'true'. + Enabled *bool `json:"enabled,omitempty"` + // PredictiveAutoscalePolicy - the predictive autoscale policy mode. + PredictiveAutoscalePolicy *PredictiveAutoscalePolicy `json:"predictiveAutoscalePolicy,omitempty"` + // Name - the name of the autoscale setting. + Name *string `json:"name,omitempty"` + // TargetResourceURI - the resource identifier of the resource that the autoscale setting should be added to. + TargetResourceURI *string `json:"targetResourceUri,omitempty"` + // TargetResourceLocation - the location of the resource that the autoscale setting should be added to. + TargetResourceLocation *string `json:"targetResourceLocation,omitempty"` +} + +// AutoscaleSettingResource the autoscale setting resource. +type AutoscaleSettingResource struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. + Tags map[string]*string `json:"tags"` + // AutoscaleSetting - The autoscale setting of the resource. + *AutoscaleSetting `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system metadata related to the response. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutoscaleSettingResource. +func (asr AutoscaleSettingResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asr.Location != nil { + objectMap["location"] = asr.Location + } + if asr.Tags != nil { + objectMap["tags"] = asr.Tags + } + if asr.AutoscaleSetting != nil { + objectMap["properties"] = asr.AutoscaleSetting + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResource struct. +func (asr *AutoscaleSettingResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + asr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + asr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + asr.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + asr.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + asr.Tags = tags + } + case "properties": + if v != nil { + var autoscaleSetting AutoscaleSetting + err = json.Unmarshal(*v, &autoscaleSetting) + if err != nil { + return err + } + asr.AutoscaleSetting = &autoscaleSetting + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + asr.SystemData = &systemData + } + } + } + + return nil +} + +// AutoscaleSettingResourceCollection represents a collection of autoscale setting resources. +type AutoscaleSettingResourceCollection struct { + autorest.Response `json:"-"` + // Value - the values for the autoscale setting resources. + Value *[]AutoscaleSettingResource `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// AutoscaleSettingResourceCollectionIterator provides access to a complete listing of +// AutoscaleSettingResource values. +type AutoscaleSettingResourceCollectionIterator struct { + i int + page AutoscaleSettingResourceCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AutoscaleSettingResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AutoscaleSettingResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AutoscaleSettingResourceCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AutoscaleSettingResourceCollectionIterator) Response() AutoscaleSettingResourceCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AutoscaleSettingResourceCollectionIterator) Value() AutoscaleSettingResource { + if !iter.page.NotDone() { + return AutoscaleSettingResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AutoscaleSettingResourceCollectionIterator type. +func NewAutoscaleSettingResourceCollectionIterator(page AutoscaleSettingResourceCollectionPage) AutoscaleSettingResourceCollectionIterator { + return AutoscaleSettingResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (asrc AutoscaleSettingResourceCollection) IsEmpty() bool { + return asrc.Value == nil || len(*asrc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (asrc AutoscaleSettingResourceCollection) hasNextLink() bool { + return asrc.NextLink != nil && len(*asrc.NextLink) != 0 +} + +// autoscaleSettingResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (asrc AutoscaleSettingResourceCollection) autoscaleSettingResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !asrc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(asrc.NextLink))) +} + +// AutoscaleSettingResourceCollectionPage contains a page of AutoscaleSettingResource values. +type AutoscaleSettingResourceCollectionPage struct { + fn func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error) + asrc AutoscaleSettingResourceCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AutoscaleSettingResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.asrc) + if err != nil { + return err + } + page.asrc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AutoscaleSettingResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AutoscaleSettingResourceCollectionPage) NotDone() bool { + return !page.asrc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AutoscaleSettingResourceCollectionPage) Response() AutoscaleSettingResourceCollection { + return page.asrc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AutoscaleSettingResourceCollectionPage) Values() []AutoscaleSettingResource { + if page.asrc.IsEmpty() { + return nil + } + return *page.asrc.Value +} + +// Creates a new instance of the AutoscaleSettingResourceCollectionPage type. +func NewAutoscaleSettingResourceCollectionPage(cur AutoscaleSettingResourceCollection, getNextPage func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error)) AutoscaleSettingResourceCollectionPage { + return AutoscaleSettingResourceCollectionPage{ + fn: getNextPage, + asrc: cur, + } +} + +// AutoscaleSettingResourcePatch the autoscale setting object for patch operations. +type AutoscaleSettingResourcePatch struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // AutoscaleSetting - The autoscale setting properties of the update operation. + *AutoscaleSetting `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutoscaleSettingResourcePatch. +func (asrp AutoscaleSettingResourcePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asrp.Tags != nil { + objectMap["tags"] = asrp.Tags + } + if asrp.AutoscaleSetting != nil { + objectMap["properties"] = asrp.AutoscaleSetting + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResourcePatch struct. +func (asrp *AutoscaleSettingResourcePatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + asrp.Tags = tags + } + case "properties": + if v != nil { + var autoscaleSetting AutoscaleSetting + err = json.Unmarshal(*v, &autoscaleSetting) + if err != nil { + return err + } + asrp.AutoscaleSetting = &autoscaleSetting + } + } + } + + return nil +} + +// AzureAppPushReceiver the Azure mobile App push notification receiver. +type AzureAppPushReceiver struct { + // Name - The name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // EmailAddress - The email address registered for the Azure mobile app. + EmailAddress *string `json:"emailAddress,omitempty"` +} + +// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. +type AzureEntityResource struct { + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureEntityResource. +func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AzureFunctionReceiver an azure function receiver. +type AzureFunctionReceiver struct { + // Name - The name of the azure function receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // FunctionAppResourceID - The azure resource id of the function app. + FunctionAppResourceID *string `json:"functionAppResourceId,omitempty"` + // FunctionName - The function name in the function app. + FunctionName *string `json:"functionName,omitempty"` + // HTTPTriggerURL - The http trigger url where http request sent to. + HTTPTriggerURL *string `json:"httpTriggerUrl,omitempty"` + // UseCommonAlertSchema - Indicates whether to use common alert schema. + UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` +} + +// AzureMonitorPrivateLinkScope an Azure Monitor PrivateLinkScope definition. +type AzureMonitorPrivateLinkScope struct { + autorest.Response `json:"-"` + // AzureMonitorPrivateLinkScopeProperties - Properties that define a Azure Monitor PrivateLinkScope resource. + *AzureMonitorPrivateLinkScopeProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; System data + SystemData *SystemData `json:"systemData,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureMonitorPrivateLinkScope. +func (ampls AzureMonitorPrivateLinkScope) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ampls.AzureMonitorPrivateLinkScopeProperties != nil { + objectMap["properties"] = ampls.AzureMonitorPrivateLinkScopeProperties + } + if ampls.Tags != nil { + objectMap["tags"] = ampls.Tags + } + if ampls.Location != nil { + objectMap["location"] = ampls.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AzureMonitorPrivateLinkScope struct. +func (ampls *AzureMonitorPrivateLinkScope) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var azureMonitorPrivateLinkScopeProperties AzureMonitorPrivateLinkScopeProperties + err = json.Unmarshal(*v, &azureMonitorPrivateLinkScopeProperties) + if err != nil { + return err + } + ampls.AzureMonitorPrivateLinkScopeProperties = &azureMonitorPrivateLinkScopeProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + ampls.SystemData = &systemData + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ampls.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ampls.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ampls.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ampls.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ampls.Type = &typeVar + } + } + } + + return nil +} + +// AzureMonitorPrivateLinkScopeListResult describes the list of Azure Monitor PrivateLinkScope resources. +type AzureMonitorPrivateLinkScopeListResult struct { + autorest.Response `json:"-"` + // Value - List of Azure Monitor PrivateLinkScope definitions. + Value *[]AzureMonitorPrivateLinkScope `json:"value,omitempty"` + // NextLink - The URI to get the next set of Azure Monitor PrivateLinkScope definitions if too many PrivateLinkScopes where returned in the result set. + NextLink *string `json:"nextLink,omitempty"` +} + +// AzureMonitorPrivateLinkScopeListResultIterator provides access to a complete listing of +// AzureMonitorPrivateLinkScope values. +type AzureMonitorPrivateLinkScopeListResultIterator struct { + i int + page AzureMonitorPrivateLinkScopeListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AzureMonitorPrivateLinkScopeListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureMonitorPrivateLinkScopeListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AzureMonitorPrivateLinkScopeListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AzureMonitorPrivateLinkScopeListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AzureMonitorPrivateLinkScopeListResultIterator) Response() AzureMonitorPrivateLinkScopeListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AzureMonitorPrivateLinkScopeListResultIterator) Value() AzureMonitorPrivateLinkScope { + if !iter.page.NotDone() { + return AzureMonitorPrivateLinkScope{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AzureMonitorPrivateLinkScopeListResultIterator type. +func NewAzureMonitorPrivateLinkScopeListResultIterator(page AzureMonitorPrivateLinkScopeListResultPage) AzureMonitorPrivateLinkScopeListResultIterator { + return AzureMonitorPrivateLinkScopeListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (amplslr AzureMonitorPrivateLinkScopeListResult) IsEmpty() bool { + return amplslr.Value == nil || len(*amplslr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (amplslr AzureMonitorPrivateLinkScopeListResult) hasNextLink() bool { + return amplslr.NextLink != nil && len(*amplslr.NextLink) != 0 +} + +// azureMonitorPrivateLinkScopeListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (amplslr AzureMonitorPrivateLinkScopeListResult) azureMonitorPrivateLinkScopeListResultPreparer(ctx context.Context) (*http.Request, error) { + if !amplslr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(amplslr.NextLink))) +} + +// AzureMonitorPrivateLinkScopeListResultPage contains a page of AzureMonitorPrivateLinkScope values. +type AzureMonitorPrivateLinkScopeListResultPage struct { + fn func(context.Context, AzureMonitorPrivateLinkScopeListResult) (AzureMonitorPrivateLinkScopeListResult, error) + amplslr AzureMonitorPrivateLinkScopeListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AzureMonitorPrivateLinkScopeListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureMonitorPrivateLinkScopeListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.amplslr) + if err != nil { + return err + } + page.amplslr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AzureMonitorPrivateLinkScopeListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AzureMonitorPrivateLinkScopeListResultPage) NotDone() bool { + return !page.amplslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AzureMonitorPrivateLinkScopeListResultPage) Response() AzureMonitorPrivateLinkScopeListResult { + return page.amplslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AzureMonitorPrivateLinkScopeListResultPage) Values() []AzureMonitorPrivateLinkScope { + if page.amplslr.IsEmpty() { + return nil + } + return *page.amplslr.Value +} + +// Creates a new instance of the AzureMonitorPrivateLinkScopeListResultPage type. +func NewAzureMonitorPrivateLinkScopeListResultPage(cur AzureMonitorPrivateLinkScopeListResult, getNextPage func(context.Context, AzureMonitorPrivateLinkScopeListResult) (AzureMonitorPrivateLinkScopeListResult, error)) AzureMonitorPrivateLinkScopeListResultPage { + return AzureMonitorPrivateLinkScopeListResultPage{ + fn: getNextPage, + amplslr: cur, + } +} + +// AzureMonitorPrivateLinkScopeProperties properties that define a Azure Monitor PrivateLinkScope resource. +type AzureMonitorPrivateLinkScopeProperties struct { + // ProvisioningState - READ-ONLY; Current state of this PrivateLinkScope: whether or not is has been provisioned within the resource group it is defined. Users cannot change this value but are able to read from it. Values will include Provisioning ,Succeeded, Canceled and Failed. + ProvisioningState *string `json:"provisioningState,omitempty"` + // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections. + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + // AccessModeSettings - Access mode settings + AccessModeSettings *AccessModeSettings `json:"accessModeSettings,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureMonitorPrivateLinkScopeProperties. +func (amplsp AzureMonitorPrivateLinkScopeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if amplsp.AccessModeSettings != nil { + objectMap["accessModeSettings"] = amplsp.AccessModeSettings + } + return json.Marshal(objectMap) +} + +// AzureResource an azure resource object +type AzureResource struct { + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` + // Kind - READ-ONLY; Azure resource kind + Kind *string `json:"kind,omitempty"` + // Identity - READ-ONLY; Azure resource identity + Identity *string `json:"identity,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for AzureResource. +func (ar AzureResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ar.Location != nil { + objectMap["location"] = ar.Location + } + if ar.Tags != nil { + objectMap["tags"] = ar.Tags + } + return json.Marshal(objectMap) +} + +// Context the context info +type Context struct { + // NotificationSource - The source of the notification request + NotificationSource *string `json:"NotificationSource,omitempty"` + // ContextType - The context id type + ContextType *string `json:"ContextType,omitempty"` +} + +// DefaultErrorResponse common error response for all Azure Resource Manager APIs to return error details +// for failed operations. (This also follows the OData error response format.). +type DefaultErrorResponse struct { + // Error - The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + +// EmailNotification email notification of an autoscale event. +type EmailNotification struct { + // SendToSubscriptionAdministrator - a value indicating whether to send email to subscription administrator. + SendToSubscriptionAdministrator *bool `json:"sendToSubscriptionAdministrator,omitempty"` + // SendToSubscriptionCoAdministrators - a value indicating whether to send email to subscription co-administrators. + SendToSubscriptionCoAdministrators *bool `json:"sendToSubscriptionCoAdministrators,omitempty"` + // CustomEmails - the custom e-mails list. This value can be null or empty, in which case this attribute will be ignored. + CustomEmails *[]string `json:"customEmails,omitempty"` +} + +// EmailReceiver an email receiver. +type EmailReceiver struct { + // Name - The name of the email receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // EmailAddress - The email address of this receiver. + EmailAddress *string `json:"emailAddress,omitempty"` + // UseCommonAlertSchema - Indicates whether to use common alert schema. + UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` + // Status - READ-ONLY; The receiver status of the e-mail. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled' + Status ReceiverStatus `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for EmailReceiver. +func (er EmailReceiver) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if er.Name != nil { + objectMap["name"] = er.Name + } + if er.EmailAddress != nil { + objectMap["emailAddress"] = er.EmailAddress + } + if er.UseCommonAlertSchema != nil { + objectMap["useCommonAlertSchema"] = er.UseCommonAlertSchema + } + return json.Marshal(objectMap) +} + +// EnableRequest describes a receiver that should be resubscribed. +type EnableRequest struct { + // ReceiverName - The name of the receiver to resubscribe. + ReceiverName *string `json:"receiverName,omitempty"` +} + +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorDetail the error detail. +type ErrorDetail struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorDetail `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDetail. +func (ed ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponse describes the format of Error response. +type ErrorResponse struct { + // Code - Error code + Code *string `json:"code,omitempty"` + // Message - Error message indicating why the operation failed. + Message *string `json:"message,omitempty"` +} + +// EventHubReceiver an Event hub receiver. +type EventHubReceiver struct { + // Name - The name of the Event hub receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // EventHubNameSpace - The Event Hub namespace + EventHubNameSpace *string `json:"eventHubNameSpace,omitempty"` + // EventHubName - The name of the specific Event Hub queue + EventHubName *string `json:"eventHubName,omitempty"` + // UseCommonAlertSchema - Indicates whether to use common alert schema. + UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` + // TenantID - The tenant Id for the subscription containing this event hub + TenantID *string `json:"tenantId,omitempty"` + // SubscriptionID - The Id for the subscription containing this event hub + SubscriptionID *string `json:"subscriptionId,omitempty"` +} + +// ItsmReceiver an Itsm receiver. +type ItsmReceiver struct { + // Name - The name of the Itsm receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // WorkspaceID - OMS LA instance identifier. + WorkspaceID *string `json:"workspaceId,omitempty"` + // ConnectionID - Unique identification of ITSM connection among multiple defined in above workspace. + ConnectionID *string `json:"connectionId,omitempty"` + // TicketConfiguration - JSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well. + TicketConfiguration *string `json:"ticketConfiguration,omitempty"` + // Region - Region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' + Region *string `json:"region,omitempty"` +} + +// LogicAppReceiver a logic app receiver. +type LogicAppReceiver struct { + // Name - The name of the logic app receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // ResourceID - The azure resource id of the logic app receiver. + ResourceID *string `json:"resourceId,omitempty"` + // CallbackURL - The callback url where http request sent to. + CallbackURL *string `json:"callbackUrl,omitempty"` + // UseCommonAlertSchema - Indicates whether to use common alert schema. + UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` +} + +// LogSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. +type LogSettings struct { + // 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. + Category *string `json:"category,omitempty"` + // CategoryGroup - Name of a Diagnostic Log category group 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. + CategoryGroup *string `json:"categoryGroup,omitempty"` + // Enabled - a value indicating whether this log is enabled. + Enabled *bool `json:"enabled,omitempty"` + // RetentionPolicy - the retention policy for this log. + RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` +} + +// ManagementGroupDiagnosticSettings the management group diagnostic settings. +type ManagementGroupDiagnosticSettings struct { + // StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs. + StorageAccountID *string `json:"storageAccountId,omitempty"` + // ServiceBusRuleID - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. + ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` + // EventHubAuthorizationRuleID - The resource Id for the event hub authorization rule. + EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"` + // EventHubName - The name of the event hub. If none is specified, the default event hub will be selected. + EventHubName *string `json:"eventHubName,omitempty"` + // Logs - The list of logs settings. + Logs *[]ManagementGroupLogSettings `json:"logs,omitempty"` + // WorkspaceID - The full ARM resource ID of the 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 + WorkspaceID *string `json:"workspaceId,omitempty"` + // MarketplacePartnerID - The full ARM resource ID of the Marketplace resource to which you would like to send Diagnostic Logs. + MarketplacePartnerID *string `json:"marketplacePartnerId,omitempty"` +} + +// ManagementGroupDiagnosticSettingsResource the management group diagnostic setting resource. +type ManagementGroupDiagnosticSettingsResource struct { + autorest.Response `json:"-"` + // ManagementGroupDiagnosticSettings - Properties of a Management Group Diagnostic Settings Resource. + *ManagementGroupDiagnosticSettings `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system metadata related to this resource. + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagementGroupDiagnosticSettingsResource. +func (mgdsr ManagementGroupDiagnosticSettingsResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mgdsr.ManagementGroupDiagnosticSettings != nil { + objectMap["properties"] = mgdsr.ManagementGroupDiagnosticSettings + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagementGroupDiagnosticSettingsResource struct. +func (mgdsr *ManagementGroupDiagnosticSettingsResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var managementGroupDiagnosticSettings ManagementGroupDiagnosticSettings + err = json.Unmarshal(*v, &managementGroupDiagnosticSettings) + if err != nil { + return err + } + mgdsr.ManagementGroupDiagnosticSettings = &managementGroupDiagnosticSettings + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mgdsr.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mgdsr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mgdsr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mgdsr.Type = &typeVar + } + } + } + + return nil +} + +// ManagementGroupDiagnosticSettingsResourceCollection represents a collection of management group +// diagnostic settings resources. +type ManagementGroupDiagnosticSettingsResourceCollection struct { + autorest.Response `json:"-"` + // Value - The collection of management group diagnostic settings resources. + Value *[]ManagementGroupDiagnosticSettingsResource `json:"value,omitempty"` +} + +// ManagementGroupLogSettings part of Management Group diagnostic setting. Specifies the settings for a +// particular log. +type ManagementGroupLogSettings struct { + // Category - Name of a Management Group Diagnostic Log category for a resource type this setting is applied to. + Category *string `json:"category,omitempty"` + // CategoryGroup - Name of a Management Group Diagnostic Log category group for a resource type this setting is applied to. + CategoryGroup *string `json:"categoryGroup,omitempty"` + // Enabled - a value indicating whether this log is enabled. + Enabled *bool `json:"enabled,omitempty"` +} + +// MetricSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. +type MetricSettings struct { + // TimeGrain - the timegrain of the metric in ISO8601 format. + TimeGrain *string `json:"timeGrain,omitempty"` + // 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. + Category *string `json:"category,omitempty"` + // Enabled - a value indicating whether this category is enabled. + Enabled *bool `json:"enabled,omitempty"` + // RetentionPolicy - the retention policy for this category. + RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` +} + +// MetricTrigger the trigger that results in a scaling action. +type MetricTrigger struct { + // MetricName - the name of the metric that defines what the rule monitors. + MetricName *string `json:"metricName,omitempty"` + // MetricNamespace - the namespace of the metric that defines what the rule monitors. + MetricNamespace *string `json:"metricNamespace,omitempty"` + // MetricResourceURI - the resource identifier of the resource the rule monitors. + MetricResourceURI *string `json:"metricResourceUri,omitempty"` + // MetricResourceLocation - the location of the resource the rule monitors. + MetricResourceLocation *string `json:"metricResourceLocation,omitempty"` + // TimeGrain - 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. + TimeGrain *string `json:"timeGrain,omitempty"` + // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'Average', 'Min', 'Max', 'Sum', 'Count' + Statistic MetricStatisticType `json:"statistic,omitempty"` + // TimeWindow - 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. + TimeWindow *string `json:"timeWindow,omitempty"` + // TimeAggregation - time aggregation type. How the data that is collected should be combined over time. The default value is Average. Possible values include: 'TimeAggregationTypeAverage', 'TimeAggregationTypeMinimum', 'TimeAggregationTypeMaximum', 'TimeAggregationTypeTotal', 'TimeAggregationTypeCount', 'TimeAggregationTypeLast' + TimeAggregation TimeAggregationType `json:"timeAggregation,omitempty"` + // Operator - the operator that is used to compare the metric data and the threshold. Possible values include: 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' + Operator ComparisonOperationType `json:"operator,omitempty"` + // Threshold - the threshold of the metric that triggers the scale action. + Threshold *float64 `json:"threshold,omitempty"` + // Dimensions - List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. + Dimensions *[]ScaleRuleMetricDimension `json:"dimensions,omitempty"` + // DividePerInstance - a value indicating whether metric should divide per instance. + DividePerInstance *bool `json:"dividePerInstance,omitempty"` +} + +// NotificationRequestBody the request body which contain contact detail metadata +type NotificationRequestBody struct { + // AlertType - The name of the supported alert type. + AlertType *string `json:"alertType,omitempty"` + // EmailReceivers - The list of email receivers that are part of this action group. + EmailReceivers *[]EmailReceiver `json:"emailReceivers,omitempty"` + // SmsReceivers - The list of SMS receivers that are part of this action group. + SmsReceivers *[]SmsReceiver `json:"smsReceivers,omitempty"` + // WebhookReceivers - The list of webhook receivers that are part of this action group. + WebhookReceivers *[]WebhookReceiver `json:"webhookReceivers,omitempty"` + // ItsmReceivers - The list of ITSM receivers that are part of this action group. + ItsmReceivers *[]ItsmReceiver `json:"itsmReceivers,omitempty"` + // AzureAppPushReceivers - The list of AzureAppPush receivers that are part of this action group. + AzureAppPushReceivers *[]AzureAppPushReceiver `json:"azureAppPushReceivers,omitempty"` + // AutomationRunbookReceivers - The list of AutomationRunbook receivers that are part of this action group. + AutomationRunbookReceivers *[]AutomationRunbookReceiver `json:"automationRunbookReceivers,omitempty"` + // VoiceReceivers - The list of voice receivers that are part of this action group. + VoiceReceivers *[]VoiceReceiver `json:"voiceReceivers,omitempty"` + // LogicAppReceivers - The list of logic app receivers that are part of this action group. + LogicAppReceivers *[]LogicAppReceiver `json:"logicAppReceivers,omitempty"` + // AzureFunctionReceivers - The list of azure function receivers that are part of this action group. + AzureFunctionReceivers *[]AzureFunctionReceiver `json:"azureFunctionReceivers,omitempty"` + // ArmRoleReceivers - 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. + ArmRoleReceivers *[]ArmRoleReceiver `json:"armRoleReceivers,omitempty"` + // EventHubReceivers - The list of event hub receivers that are part of this action group. + EventHubReceivers *[]EventHubReceiver `json:"eventHubReceivers,omitempty"` +} + +// OperationStatus the status of operation. +type OperationStatus struct { + autorest.Response `json:"-"` + // ID - The operation Id. + ID *string `json:"id,omitempty"` + // Name - The operation name. + Name *string `json:"name,omitempty"` + // StartTime - Start time of the job in standard ISO8601 format. + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - End time of the job in standard ISO8601 format. + EndTime *date.Time `json:"endTime,omitempty"` + // Status - The status of the operation. + Status *string `json:"status,omitempty"` + // Error - The error detail of the operation if any. + Error *ErrorDetail `json:"error,omitempty"` +} + +// PredictiveAutoscalePolicy the parameters for enabling predictive autoscale. +type PredictiveAutoscalePolicy struct { + // ScaleMode - the predictive autoscale mode. Possible values include: 'Disabled', 'ForecastOnly', 'Enabled' + ScaleMode PredictiveAutoscalePolicyScaleMode `json:"scaleMode,omitempty"` + // ScaleLookAheadTime - the amount of time to specify by which instances are launched in advance. It must be between 1 minute and 60 minutes in ISO 8601 format. + ScaleLookAheadTime *string `json:"scaleLookAheadTime,omitempty"` +} + +// PredictiveResponse the response to a metrics query. +type PredictiveResponse struct { + autorest.Response `json:"-"` + // 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. + Timespan *string `json:"timespan,omitempty"` + // 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. + Interval *string `json:"interval,omitempty"` + // MetricName - The metrics being queried + MetricName *string `json:"metricName,omitempty"` + // TargetResourceID - resource of the predictive metric. + TargetResourceID *string `json:"targetResourceId,omitempty"` + // Data - the value of the collection. + Data *[]PredictiveValue `json:"data,omitempty"` +} + +// PredictiveValue represents a predictive metric value in the given bucket. +type PredictiveValue struct { + // TimeStamp - the timestamp for the metric value in ISO 8601 format. + TimeStamp *date.Time `json:"timeStamp,omitempty"` + // Value - Predictive value in this time bucket. + Value *float64 `json:"value,omitempty"` +} + +// PrivateEndpoint the Private Endpoint resource. +type PrivateEndpoint struct { + // ID - READ-ONLY; The ARM identifier for Private Endpoint + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpoint. +func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PrivateEndpointConnection the Private Endpoint Connection resource. +type PrivateEndpointConnection struct { + autorest.Response `json:"-"` + // PrivateEndpointConnectionProperties - Resource properties. + *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnection. +func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pec.PrivateEndpointConnectionProperties != nil { + objectMap["properties"] = pec.PrivateEndpointConnectionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. +func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateEndpointConnectionProperties PrivateEndpointConnectionProperties + err = json.Unmarshal(*v, &privateEndpointConnectionProperties) + if err != nil { + return err + } + pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pec.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pec.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pec.Type = &typeVar + } + } + } + + return nil +} + +// PrivateEndpointConnectionListResult list of private endpoint connection associated with the specified +// storage account +type PrivateEndpointConnectionListResult struct { + autorest.Response `json:"-"` + // Value - Array of private endpoint connections + Value *[]PrivateEndpointConnection `json:"value,omitempty"` +} + +// PrivateEndpointConnectionProperties properties of the PrivateEndpointConnectProperties. +type PrivateEndpointConnectionProperties struct { + // PrivateEndpoint - The resource of private end point. + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + // ProvisioningState - The provisioning state of the private endpoint connection resource. Possible values include: 'Succeeded', 'Creating', 'Deleting', 'Failed' + ProvisioningState PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` +} + +// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type PrivateEndpointConnectionsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateEndpointConnectionsCreateOrUpdateFuture.Result. +func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pec.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("diagnostics.PrivateEndpointConnectionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { + pec, err = client.CreateOrUpdateResponder(pec.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") + } + } + return +} + +// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateEndpointConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateEndpointConnectionsDeleteFuture.Result. +func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("diagnostics.PrivateEndpointConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PrivateLinkResource a private link resource +type PrivateLinkResource struct { + autorest.Response `json:"-"` + // PrivateLinkResourceProperties - Resource properties. + *PrivateLinkResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResource. +func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plr.PrivateLinkResourceProperties != nil { + objectMap["properties"] = plr.PrivateLinkResourceProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. +func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateLinkResourceProperties PrivateLinkResourceProperties + err = json.Unmarshal(*v, &privateLinkResourceProperties) + if err != nil { + return err + } + plr.PrivateLinkResourceProperties = &privateLinkResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + plr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + plr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + plr.Type = &typeVar + } + } + } + + return nil +} + +// PrivateLinkResourceListResult a list of private link resources +type PrivateLinkResourceListResult struct { + autorest.Response `json:"-"` + // Value - Array of private link resources + Value *[]PrivateLinkResource `json:"value,omitempty"` +} + +// PrivateLinkResourceProperties properties of a private link resource. +type PrivateLinkResourceProperties struct { + // GroupID - READ-ONLY; The private link resource group id. + GroupID *string `json:"groupId,omitempty"` + // RequiredMembers - READ-ONLY; The private link resource required member names. + RequiredMembers *[]string `json:"requiredMembers,omitempty"` + // RequiredZoneNames - The private link resource Private link DNS zone name. + RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. +func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plrp.RequiredZoneNames != nil { + objectMap["requiredZoneNames"] = plrp.RequiredZoneNames + } + return json.Marshal(objectMap) +} + +// PrivateLinkScopedResourcesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type PrivateLinkScopedResourcesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateLinkScopedResourcesClient) (ScopedResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateLinkScopedResourcesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateLinkScopedResourcesCreateOrUpdateFuture.Result. +func (future *PrivateLinkScopedResourcesCreateOrUpdateFuture) result(client PrivateLinkScopedResourcesClient) (sr ScopedResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("diagnostics.PrivateLinkScopedResourcesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { + sr, err = client.CreateOrUpdateResponder(sr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesCreateOrUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") + } + } + return +} + +// PrivateLinkScopedResourcesDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateLinkScopedResourcesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateLinkScopedResourcesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateLinkScopedResourcesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateLinkScopedResourcesDeleteFuture.Result. +func (future *PrivateLinkScopedResourcesDeleteFuture) result(client PrivateLinkScopedResourcesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("diagnostics.PrivateLinkScopedResourcesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PrivateLinkScopesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PrivateLinkScopesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateLinkScopesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateLinkScopesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateLinkScopesDeleteFuture.Result. +func (future *PrivateLinkScopesDeleteFuture) result(client PrivateLinkScopesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("diagnostics.PrivateLinkScopesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PrivateLinkServiceConnectionState a collection of information about the state of the connection between +// service consumer and provider. +type PrivateLinkServiceConnectionState struct { + // Status - Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: 'Pending', 'Approved', 'Rejected' + Status PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` + // Description - The reason for approval/rejection of the connection. + Description *string `json:"description,omitempty"` + // ActionsRequired - A message indicating if changes on the service provider require any updates on the consumer. + ActionsRequired *string `json:"actionsRequired,omitempty"` +} + +// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not +// have tags and a location +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Recurrence the repeating times at which this profile begins. This element is not used if the FixedDate +// element is used. +type Recurrence struct { + // Frequency - 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' + Frequency RecurrenceFrequency `json:"frequency,omitempty"` + // Schedule - the scheduling constraints for when the profile begins. + Schedule *RecurrentSchedule `json:"schedule,omitempty"` +} + +// RecurrentSchedule the scheduling constraints for when the profile begins. +type RecurrentSchedule struct { + // TimeZone - 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 + TimeZone *string `json:"timeZone,omitempty"` + // Days - the collection of days that the profile takes effect on. Possible values are Sunday through Saturday. + Days *[]string `json:"days,omitempty"` + // Hours - 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). + Hours *[]int32 `json:"hours,omitempty"` + // Minutes - A collection of minutes at which the profile takes effect at. + Minutes *[]int32 `json:"minutes,omitempty"` +} + +// Resource common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// RetentionPolicy specifies the retention policy for the log. +type RetentionPolicy struct { + // Enabled - a value indicating whether the retention policy is enabled. + Enabled *bool `json:"enabled,omitempty"` + // Days - the number of days for the retention in days. A value of 0 will retain the events indefinitely. + Days *int32 `json:"days,omitempty"` +} + +// ScaleAction the parameters for the scaling action. +type ScaleAction struct { + // Direction - the scale direction. Whether the scaling action increases or decreases the number of instances. Possible values include: 'ScaleDirectionNone', 'ScaleDirectionIncrease', 'ScaleDirectionDecrease' + Direction ScaleDirection `json:"direction,omitempty"` + // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount', 'ServiceAllowedNextValue' + Type ScaleType `json:"type,omitempty"` + // Value - the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1. + Value *string `json:"value,omitempty"` + // Cooldown - 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. + Cooldown *string `json:"cooldown,omitempty"` +} + +// ScaleCapacity the number of instances that can be used during this profile. +type ScaleCapacity struct { + // Minimum - the minimum number of instances for the resource. + Minimum *string `json:"minimum,omitempty"` + // Maximum - 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. + Maximum *string `json:"maximum,omitempty"` + // Default - 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. + Default *string `json:"default,omitempty"` +} + +// ScaleRule a rule that provide the triggers and parameters for the scaling action. +type ScaleRule struct { + // MetricTrigger - the trigger that results in a scaling action. + MetricTrigger *MetricTrigger `json:"metricTrigger,omitempty"` + // ScaleAction - the parameters for the scaling action. + ScaleAction *ScaleAction `json:"scaleAction,omitempty"` +} + +// ScaleRuleMetricDimension specifies an auto scale rule metric dimension. +type ScaleRuleMetricDimension struct { + // DimensionName - Name of the dimension. + DimensionName *string `json:"DimensionName,omitempty"` + // Operator - the dimension operator. Only 'Equals' and 'NotEquals' are supported. 'Equals' being equal to any of the values. 'NotEquals' being not equal to all of the values. Possible values include: 'ScaleRuleMetricDimensionOperationTypeEquals', 'ScaleRuleMetricDimensionOperationTypeNotEquals' + Operator ScaleRuleMetricDimensionOperationType `json:"Operator,omitempty"` + // Values - list of dimension values. For example: ["App1","App2"]. + Values *[]string `json:"Values,omitempty"` +} + +// ScopedResource a private link scoped resource +type ScopedResource struct { + autorest.Response `json:"-"` + // ScopedResourceProperties - Resource properties. + *ScopedResourceProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; System data + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ScopedResource. +func (sr ScopedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sr.ScopedResourceProperties != nil { + objectMap["properties"] = sr.ScopedResourceProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ScopedResource struct. +func (sr *ScopedResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var scopedResourceProperties ScopedResourceProperties + err = json.Unmarshal(*v, &scopedResourceProperties) + if err != nil { + return err + } + sr.ScopedResourceProperties = &scopedResourceProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + sr.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sr.Type = &typeVar + } + } + } + + return nil +} + +// ScopedResourceListResult a list of scoped resources in a private link scope. +type ScopedResourceListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Array of results. + Value *[]ScopedResource `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ScopedResourceListResult. +func (srlr ScopedResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ScopedResourceListResultIterator provides access to a complete listing of ScopedResource values. +type ScopedResourceListResultIterator struct { + i int + page ScopedResourceListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ScopedResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScopedResourceListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ScopedResourceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ScopedResourceListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ScopedResourceListResultIterator) Response() ScopedResourceListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ScopedResourceListResultIterator) Value() ScopedResource { + if !iter.page.NotDone() { + return ScopedResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ScopedResourceListResultIterator type. +func NewScopedResourceListResultIterator(page ScopedResourceListResultPage) ScopedResourceListResultIterator { + return ScopedResourceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (srlr ScopedResourceListResult) IsEmpty() bool { + return srlr.Value == nil || len(*srlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (srlr ScopedResourceListResult) hasNextLink() bool { + return srlr.NextLink != nil && len(*srlr.NextLink) != 0 +} + +// scopedResourceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (srlr ScopedResourceListResult) scopedResourceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !srlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(srlr.NextLink))) +} + +// ScopedResourceListResultPage contains a page of ScopedResource values. +type ScopedResourceListResultPage struct { + fn func(context.Context, ScopedResourceListResult) (ScopedResourceListResult, error) + srlr ScopedResourceListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ScopedResourceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScopedResourceListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.srlr) + if err != nil { + return err + } + page.srlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ScopedResourceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ScopedResourceListResultPage) NotDone() bool { + return !page.srlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ScopedResourceListResultPage) Response() ScopedResourceListResult { + return page.srlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ScopedResourceListResultPage) Values() []ScopedResource { + if page.srlr.IsEmpty() { + return nil + } + return *page.srlr.Value +} + +// Creates a new instance of the ScopedResourceListResultPage type. +func NewScopedResourceListResultPage(cur ScopedResourceListResult, getNextPage func(context.Context, ScopedResourceListResult) (ScopedResourceListResult, error)) ScopedResourceListResultPage { + return ScopedResourceListResultPage{ + fn: getNextPage, + srlr: cur, + } +} + +// ScopedResourceProperties properties of a private link scoped resource. +type ScopedResourceProperties struct { + // LinkedResourceID - The resource id of the scoped Azure monitor resource. + LinkedResourceID *string `json:"linkedResourceId,omitempty"` + // ProvisioningState - READ-ONLY; State of the private endpoint connection. + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ScopedResourceProperties. +func (srp ScopedResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if srp.LinkedResourceID != nil { + objectMap["linkedResourceId"] = srp.LinkedResourceID + } + return json.Marshal(objectMap) +} + +// Settings the diagnostic settings. +type Settings struct { + // StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs. + StorageAccountID *string `json:"storageAccountId,omitempty"` + // ServiceBusRuleID - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. + ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` + // EventHubAuthorizationRuleID - The resource Id for the event hub authorization rule. + EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"` + // EventHubName - The name of the event hub. If none is specified, the default event hub will be selected. + EventHubName *string `json:"eventHubName,omitempty"` + // Metrics - The list of metric settings. + Metrics *[]MetricSettings `json:"metrics,omitempty"` + // Logs - The list of logs settings. + Logs *[]LogSettings `json:"logs,omitempty"` + // WorkspaceID - The full ARM resource ID of the 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 + WorkspaceID *string `json:"workspaceId,omitempty"` + // MarketplacePartnerID - The full ARM resource ID of the Marketplace resource to which you would like to send Diagnostic Logs. + MarketplacePartnerID *string `json:"marketplacePartnerId,omitempty"` + // LogAnalyticsDestinationType - A string indicating whether the export to Log Analytics should use the default destination type, i.e. AzureDiagnostics, or use a destination type constructed as follows: _. Possible values are: Dedicated and null (null is default.) + LogAnalyticsDestinationType *string `json:"logAnalyticsDestinationType,omitempty"` +} + +// SettingsCategory the diagnostic settings Category. +type SettingsCategory struct { + // CategoryType - The type of the diagnostic settings category. Possible values include: 'Metrics', 'Logs' + CategoryType CategoryType `json:"categoryType,omitempty"` + // CategoryGroups - the collection of what category groups are supported. + CategoryGroups *[]string `json:"categoryGroups,omitempty"` +} + +// SettingsCategoryResource the diagnostic settings category resource. +type SettingsCategoryResource struct { + autorest.Response `json:"-"` + // SettingsCategory - The properties of a Diagnostic Settings Category. + *SettingsCategory `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system metadata related to this resource. + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SettingsCategoryResource. +func (scr SettingsCategoryResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scr.SettingsCategory != nil { + objectMap["properties"] = scr.SettingsCategory + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SettingsCategoryResource struct. +func (scr *SettingsCategoryResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var settingsCategory SettingsCategory + err = json.Unmarshal(*v, &settingsCategory) + if err != nil { + return err + } + scr.SettingsCategory = &settingsCategory + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + scr.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + scr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + scr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + scr.Type = &typeVar + } + } + } + + return nil +} + +// SettingsCategoryResourceCollection represents a collection of diagnostic setting category resources. +type SettingsCategoryResourceCollection struct { + autorest.Response `json:"-"` + // Value - The collection of diagnostic settings category resources. + Value *[]SettingsCategoryResource `json:"value,omitempty"` +} + +// SettingsResource the diagnostic setting resource. +type SettingsResource struct { + autorest.Response `json:"-"` + // Settings - Properties of a Diagnostic Settings Resource. + *Settings `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system metadata related to this resource. + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SettingsResource. +func (sr SettingsResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sr.Settings != nil { + objectMap["properties"] = sr.Settings + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SettingsResource struct. +func (sr *SettingsResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var settings Settings + err = json.Unmarshal(*v, &settings) + if err != nil { + return err + } + sr.Settings = &settings + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + sr.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sr.Type = &typeVar + } + } + } + + return nil +} + +// SettingsResourceCollection represents a collection of alert rule resources. +type SettingsResourceCollection struct { + autorest.Response `json:"-"` + // Value - The collection of diagnostic settings resources;. + Value *[]SettingsResource `json:"value,omitempty"` +} + +// SmsReceiver an SMS receiver. +type SmsReceiver struct { + // Name - The name of the SMS receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // CountryCode - The country code of the SMS receiver. + CountryCode *string `json:"countryCode,omitempty"` + // PhoneNumber - The phone number of the SMS receiver. + PhoneNumber *string `json:"phoneNumber,omitempty"` + // Status - READ-ONLY; The status of the receiver. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled' + Status ReceiverStatus `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for SmsReceiver. +func (sr SmsReceiver) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sr.Name != nil { + objectMap["name"] = sr.Name + } + if sr.CountryCode != nil { + objectMap["countryCode"] = sr.CountryCode + } + if sr.PhoneNumber != nil { + objectMap["phoneNumber"] = sr.PhoneNumber + } + return json.Marshal(objectMap) +} + +// SubscriptionDiagnosticSettings the subscription diagnostic settings. +type SubscriptionDiagnosticSettings struct { + // StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs. + StorageAccountID *string `json:"storageAccountId,omitempty"` + // ServiceBusRuleID - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. + ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` + // EventHubAuthorizationRuleID - The resource Id for the event hub authorization rule. + EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"` + // EventHubName - The name of the event hub. If none is specified, the default event hub will be selected. + EventHubName *string `json:"eventHubName,omitempty"` + // Logs - The list of logs settings. + Logs *[]SubscriptionLogSettings `json:"logs,omitempty"` + // WorkspaceID - The full ARM resource ID of the 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 + WorkspaceID *string `json:"workspaceId,omitempty"` + // MarketplacePartnerID - The full ARM resource ID of the Marketplace resource to which you would like to send Diagnostic Logs. + MarketplacePartnerID *string `json:"marketplacePartnerId,omitempty"` +} + +// SubscriptionDiagnosticSettingsResource the subscription diagnostic setting resource. +type SubscriptionDiagnosticSettingsResource struct { + autorest.Response `json:"-"` + // SubscriptionDiagnosticSettings - Properties of a Subscription Diagnostic Settings Resource. + *SubscriptionDiagnosticSettings `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system metadata related to this resource. + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SubscriptionDiagnosticSettingsResource. +func (sdsr SubscriptionDiagnosticSettingsResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sdsr.SubscriptionDiagnosticSettings != nil { + objectMap["properties"] = sdsr.SubscriptionDiagnosticSettings + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SubscriptionDiagnosticSettingsResource struct. +func (sdsr *SubscriptionDiagnosticSettingsResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var subscriptionDiagnosticSettings SubscriptionDiagnosticSettings + err = json.Unmarshal(*v, &subscriptionDiagnosticSettings) + if err != nil { + return err + } + sdsr.SubscriptionDiagnosticSettings = &subscriptionDiagnosticSettings + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + sdsr.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sdsr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sdsr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sdsr.Type = &typeVar + } + } + } + + return nil +} + +// SubscriptionDiagnosticSettingsResourceCollection represents a collection of subscription diagnostic +// settings resources. +type SubscriptionDiagnosticSettingsResourceCollection struct { + autorest.Response `json:"-"` + // Value - The collection of subscription diagnostic settings resources. + Value *[]SubscriptionDiagnosticSettingsResource `json:"value,omitempty"` +} + +// SubscriptionLogSettings part of Subscription diagnostic setting. Specifies the settings for a particular +// log. +type SubscriptionLogSettings struct { + // Category - Name of a Subscription Diagnostic Log category for a resource type this setting is applied to. + Category *string `json:"category,omitempty"` + // CategoryGroup - Name of a Subscription Diagnostic Log category group for a resource type this setting is applied to. + CategoryGroup *string `json:"categoryGroup,omitempty"` + // Enabled - a value indicating whether this log is enabled. + Enabled *bool `json:"enabled,omitempty"` +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TagsResource a container holding only the Tags for a resource, allowing the user to update the tags on a +// PrivateLinkScope instance. +type TagsResource struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for TagsResource. +func (tr TagsResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + return json.Marshal(objectMap) +} + +// TestNotificationDetailsResponse the details of the test notification results. +type TestNotificationDetailsResponse struct { + autorest.Response `json:"-"` + Context *Context `json:"Context,omitempty"` + // State - The overall state + State *string `json:"State,omitempty"` + // CompletedTime - The completed time + CompletedTime *string `json:"CompletedTime,omitempty"` + // CreatedTime - The created time + CreatedTime *string `json:"CreatedTime,omitempty"` + // ActionDetails - The list of action detail + ActionDetails *[]ActionDetail `json:"ActionDetails,omitempty"` +} + +// TestNotificationResponse the response when test notification succeeded +type TestNotificationResponse struct { + autorest.Response `json:"-"` + // NotificationID - The notification id + NotificationID *string `json:"notificationId,omitempty"` + // CorrelationID - The correlation id + CorrelationID *string `json:"correlationId,omitempty"` + // CreatedTime - The created time + CreatedTime *string `json:"createdTime,omitempty"` +} + +// TimeWindow a specific date-time for the profile. +type TimeWindow struct { + // TimeZone - 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 + TimeZone *string `json:"timeZone,omitempty"` + // Start - the start time for the profile in ISO 8601 format. + Start *date.Time `json:"start,omitempty"` + // End - the end time for the profile in ISO 8601 format. + End *date.Time `json:"end,omitempty"` +} + +// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource +// which has 'tags' and a 'location' +type TrackedResource struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} + +// VoiceReceiver a voice receiver. +type VoiceReceiver struct { + // Name - The name of the voice receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // CountryCode - The country code of the voice receiver. + CountryCode *string `json:"countryCode,omitempty"` + // PhoneNumber - The phone number of the voice receiver. + PhoneNumber *string `json:"phoneNumber,omitempty"` +} + +// WebhookNotification webhook notification of an autoscale event. +type WebhookNotification struct { + // ServiceURI - the service address to receive the notification. + ServiceURI *string `json:"serviceUri,omitempty"` + // Properties - a property bag of settings. This value can be empty. + Properties map[string]*string `json:"properties"` +} + +// MarshalJSON is the custom marshaler for WebhookNotification. +func (wn WebhookNotification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wn.ServiceURI != nil { + objectMap["serviceUri"] = wn.ServiceURI + } + if wn.Properties != nil { + objectMap["properties"] = wn.Properties + } + return json.Marshal(objectMap) +} + +// WebhookReceiver a webhook receiver. +type WebhookReceiver struct { + // Name - The name of the webhook receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // ServiceURI - The URI where webhooks should be sent. + ServiceURI *string `json:"serviceUri,omitempty"` + // UseCommonAlertSchema - Indicates whether to use common alert schema. + UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` + // UseAadAuth - Indicates whether or not use AAD authentication. + UseAadAuth *bool `json:"useAadAuth,omitempty"` + // ObjectID - Indicates the webhook app object Id for aad auth. + ObjectID *string `json:"objectId,omitempty"` + // IdentifierURI - Indicates the identifier uri for aad auth. + IdentifierURI *string `json:"identifierUri,omitempty"` + // TenantID - Indicates the tenant id for aad auth. + TenantID *string `json:"tenantId,omitempty"` +} diff --git a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/predictivemetric.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/predictivemetric.go new file mode 100644 index 000000000000..1f26c4d58b3e --- /dev/null +++ b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/predictivemetric.go @@ -0,0 +1,130 @@ +package diagnostics + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for 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 ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PredictiveMetricClient is the monitor Management Client +type PredictiveMetricClient struct { + BaseClient +} + +// NewPredictiveMetricClient creates an instance of the PredictiveMetricClient client. +func NewPredictiveMetricClient(subscriptionID string) PredictiveMetricClient { + return NewPredictiveMetricClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPredictiveMetricClientWithBaseURI creates an instance of the PredictiveMetricClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewPredictiveMetricClientWithBaseURI(baseURI string, subscriptionID string) PredictiveMetricClient { + return PredictiveMetricClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get predictive autoscale metric future data +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// autoscaleSettingName - the autoscale setting name. +// timespan - the timespan of the query. It is a string with the following format +// 'startDateTime_ISO/endDateTime_ISO'. +// interval - the interval (i.e. timegrain) of the query. +// metricNamespace - metric namespace to query metric definitions for. +// metricName - the names of the metrics (comma separated) to retrieve. Special case: If a metricname itself +// has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be **'Metric%2Name1'** +// aggregation - the list of aggregation types (comma separated) to retrieve. +func (client PredictiveMetricClient) Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string, timespan string, interval string, metricNamespace string, metricName string, aggregation string) (result PredictiveResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PredictiveMetricClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("diagnostics.PredictiveMetricClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, autoscaleSettingName, timespan, interval, metricNamespace, metricName, aggregation) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.PredictiveMetricClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "diagnostics.PredictiveMetricClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.PredictiveMetricClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PredictiveMetricClient) GetPreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string, timespan string, interval string, metricNamespace string, metricName string, aggregation string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "aggregation": autorest.Encode("query", aggregation), + "api-version": APIVersion, + "interval": autorest.Encode("query", interval), + "metricName": autorest.Encode("query", metricName), + "metricNamespace": autorest.Encode("query", metricNamespace), + "timespan": autorest.Encode("query", timespan), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}/predictiveMetrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PredictiveMetricClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PredictiveMetricClient) GetResponder(resp *http.Response) (result PredictiveResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/privateendpointconnections.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privateendpointconnections.go similarity index 77% rename from services/preview/monitor/mgmt/2021-04-01-preview/insights/privateendpointconnections.go rename to services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privateendpointconnections.go index c8bc7078ed76..f2c2e634ec75 100644 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/privateendpointconnections.go +++ b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privateendpointconnections.go @@ -1,4 +1,4 @@ -package insights +package diagnostics // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -56,23 +56,19 @@ func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Contex {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState.Status", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState.Description", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("insights.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) + Chain: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("diagnostics.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) } req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, scopeName, privateEndpointConnectionName, parameters) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") return } result, err = client.CreateOrUpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") return } @@ -88,7 +84,7 @@ func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-10-17-preview" + const APIVersion = "2021-07-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -153,18 +149,18 @@ func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resou {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.PrivateEndpointConnectionsClient", "Delete", err.Error()) + return result, validation.NewError("diagnostics.PrivateEndpointConnectionsClient", "Delete", err.Error()) } req, err := client.DeletePreparer(ctx, resourceGroupName, scopeName, privateEndpointConnectionName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") return } result, err = client.DeleteSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") return } @@ -180,7 +176,7 @@ func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-10-17-preview" + const APIVersion = "2021-07-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -242,25 +238,25 @@ func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resource {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.PrivateEndpointConnectionsClient", "Get", err.Error()) + return result, validation.NewError("diagnostics.PrivateEndpointConnectionsClient", "Get", err.Error()) } req, err := client.GetPreparer(ctx, resourceGroupName, scopeName, privateEndpointConnectionName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") return } resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") return } result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") return } @@ -276,7 +272,7 @@ func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-10-17-preview" + const APIVersion = "2021-07-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -311,13 +307,13 @@ func (client PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. // scopeName - the name of the Azure Monitor PrivateLinkScope resource. -func (client PrivateEndpointConnectionsClient) ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result PrivateEndpointConnectionListResultPage, err error) { +func (client PrivateEndpointConnectionsClient) ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result PrivateEndpointConnectionListResult, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByPrivateLinkScope") defer func() { sc := -1 - if result.peclr.Response.Response != nil { - sc = result.peclr.Response.Response.StatusCode + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() @@ -328,30 +324,25 @@ func (client PrivateEndpointConnectionsClient) ListByPrivateLinkScope(ctx contex {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", err.Error()) + return result, validation.NewError("diagnostics.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", err.Error()) } - result.fn = client.listByPrivateLinkScopeNextResults req, err := client.ListByPrivateLinkScopePreparer(ctx, resourceGroupName, scopeName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", nil, "Failure preparing request") return } resp, err := client.ListByPrivateLinkScopeSender(req) if err != nil { - result.peclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", resp, "Failure sending request") + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "diagnostics.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", resp, "Failure sending request") return } - result.peclr, err = client.ListByPrivateLinkScopeResponder(resp) + result, err = client.ListByPrivateLinkScopeResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", resp, "Failure responding to request") - return - } - if result.peclr.hasNextLink() && result.peclr.IsEmpty() { - err = result.NextWithContext(ctx) + err = autorest.NewErrorWithError(err, "diagnostics.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", resp, "Failure responding to request") return } @@ -366,7 +357,7 @@ func (client PrivateEndpointConnectionsClient) ListByPrivateLinkScopePreparer(ct "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-10-17-preview" + const APIVersion = "2021-07-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -396,40 +387,3 @@ func (client PrivateEndpointConnectionsClient) ListByPrivateLinkScopeResponder(r result.Response = autorest.Response{Response: resp} return } - -// listByPrivateLinkScopeNextResults retrieves the next set of results, if any. -func (client PrivateEndpointConnectionsClient) listByPrivateLinkScopeNextResults(ctx context.Context, lastResults PrivateEndpointConnectionListResult) (result PrivateEndpointConnectionListResult, err error) { - req, err := lastResults.privateEndpointConnectionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "listByPrivateLinkScopeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByPrivateLinkScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "listByPrivateLinkScopeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByPrivateLinkScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "listByPrivateLinkScopeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByPrivateLinkScopeComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateEndpointConnectionsClient) ListByPrivateLinkScopeComplete(ctx context.Context, resourceGroupName string, scopeName string) (result PrivateEndpointConnectionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByPrivateLinkScope") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByPrivateLinkScope(ctx, resourceGroupName, scopeName) - return -} diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/privatelinkresources.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privatelinkresources.go similarity index 70% rename from services/preview/monitor/mgmt/2021-04-01-preview/insights/privatelinkresources.go rename to services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privatelinkresources.go index 02157f85d6c4..7845fd559174 100644 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/privatelinkresources.go +++ b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privatelinkresources.go @@ -1,4 +1,4 @@ -package insights +package diagnostics // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -54,25 +54,25 @@ func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupN {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.PrivateLinkResourcesClient", "Get", err.Error()) + return result, validation.NewError("diagnostics.PrivateLinkResourcesClient", "Get", err.Error()) } req, err := client.GetPreparer(ctx, resourceGroupName, scopeName, groupName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "Get", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkResourcesClient", "Get", nil, "Failure preparing request") return } resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") return } result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") return } @@ -88,7 +88,7 @@ func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-10-17-preview" + const APIVersion = "2021-07-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -123,13 +123,13 @@ func (client PrivateLinkResourcesClient) GetResponder(resp *http.Response) (resu // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. // scopeName - the name of the Azure Monitor PrivateLinkScope resource. -func (client PrivateLinkResourcesClient) ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result PrivateLinkResourceListResultPage, err error) { +func (client PrivateLinkResourcesClient) ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result PrivateLinkResourceListResult, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByPrivateLinkScope") defer func() { sc := -1 - if result.plrlr.Response.Response != nil { - sc = result.plrlr.Response.Response.StatusCode + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() @@ -140,30 +140,25 @@ func (client PrivateLinkResourcesClient) ListByPrivateLinkScope(ctx context.Cont {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.PrivateLinkResourcesClient", "ListByPrivateLinkScope", err.Error()) + return result, validation.NewError("diagnostics.PrivateLinkResourcesClient", "ListByPrivateLinkScope", err.Error()) } - result.fn = client.listByPrivateLinkScopeNextResults req, err := client.ListByPrivateLinkScopePreparer(ctx, resourceGroupName, scopeName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "ListByPrivateLinkScope", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkResourcesClient", "ListByPrivateLinkScope", nil, "Failure preparing request") return } resp, err := client.ListByPrivateLinkScopeSender(req) if err != nil { - result.plrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "ListByPrivateLinkScope", resp, "Failure sending request") + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkResourcesClient", "ListByPrivateLinkScope", resp, "Failure sending request") return } - result.plrlr, err = client.ListByPrivateLinkScopeResponder(resp) + result, err = client.ListByPrivateLinkScopeResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "ListByPrivateLinkScope", resp, "Failure responding to request") - return - } - if result.plrlr.hasNextLink() && result.plrlr.IsEmpty() { - err = result.NextWithContext(ctx) + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkResourcesClient", "ListByPrivateLinkScope", resp, "Failure responding to request") return } @@ -178,7 +173,7 @@ func (client PrivateLinkResourcesClient) ListByPrivateLinkScopePreparer(ctx cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-10-17-preview" + const APIVersion = "2021-07-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -208,40 +203,3 @@ func (client PrivateLinkResourcesClient) ListByPrivateLinkScopeResponder(resp *h result.Response = autorest.Response{Response: resp} return } - -// listByPrivateLinkScopeNextResults retrieves the next set of results, if any. -func (client PrivateLinkResourcesClient) listByPrivateLinkScopeNextResults(ctx context.Context, lastResults PrivateLinkResourceListResult) (result PrivateLinkResourceListResult, err error) { - req, err := lastResults.privateLinkResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "listByPrivateLinkScopeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByPrivateLinkScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "listByPrivateLinkScopeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByPrivateLinkScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "listByPrivateLinkScopeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByPrivateLinkScopeComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkResourcesClient) ListByPrivateLinkScopeComplete(ctx context.Context, resourceGroupName string, scopeName string) (result PrivateLinkResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByPrivateLinkScope") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByPrivateLinkScope(ctx, resourceGroupName, scopeName) - return -} diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/privatelinkscopedresources.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privatelinkscopedresources.go similarity index 86% rename from services/preview/monitor/mgmt/2021-04-01-preview/insights/privatelinkscopedresources.go rename to services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privatelinkscopedresources.go index 87ad66e22a67..77d9020c8e0b 100644 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/privatelinkscopedresources.go +++ b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privatelinkscopedresources.go @@ -1,4 +1,4 @@ -package insights +package diagnostics // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -54,18 +54,18 @@ func (client PrivateLinkScopedResourcesClient) CreateOrUpdate(ctx context.Contex {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.PrivateLinkScopedResourcesClient", "CreateOrUpdate", err.Error()) + return result, validation.NewError("diagnostics.PrivateLinkScopedResourcesClient", "CreateOrUpdate", err.Error()) } req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, scopeName, name, parameters) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "CreateOrUpdate", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesClient", "CreateOrUpdate", nil, "Failure preparing request") return } result, err = client.CreateOrUpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesClient", "CreateOrUpdate", result.Response(), "Failure sending request") return } @@ -81,11 +81,12 @@ func (client PrivateLinkScopedResourcesClient) CreateOrUpdatePreparer(ctx contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-10-17-preview" + const APIVersion = "2021-07-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } + parameters.SystemData = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), @@ -146,18 +147,18 @@ func (client PrivateLinkScopedResourcesClient) Delete(ctx context.Context, resou {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.PrivateLinkScopedResourcesClient", "Delete", err.Error()) + return result, validation.NewError("diagnostics.PrivateLinkScopedResourcesClient", "Delete", err.Error()) } req, err := client.DeletePreparer(ctx, resourceGroupName, scopeName, name) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "Delete", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesClient", "Delete", nil, "Failure preparing request") return } result, err = client.DeleteSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "Delete", result.Response(), "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesClient", "Delete", result.Response(), "Failure sending request") return } @@ -173,7 +174,7 @@ func (client PrivateLinkScopedResourcesClient) DeletePreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-10-17-preview" + const APIVersion = "2021-07-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -235,25 +236,25 @@ func (client PrivateLinkScopedResourcesClient) Get(ctx context.Context, resource {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.PrivateLinkScopedResourcesClient", "Get", err.Error()) + return result, validation.NewError("diagnostics.PrivateLinkScopedResourcesClient", "Get", err.Error()) } req, err := client.GetPreparer(ctx, resourceGroupName, scopeName, name) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "Get", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesClient", "Get", nil, "Failure preparing request") return } resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "Get", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesClient", "Get", resp, "Failure sending request") return } result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "Get", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesClient", "Get", resp, "Failure responding to request") return } @@ -269,7 +270,7 @@ func (client PrivateLinkScopedResourcesClient) GetPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-10-17-preview" + const APIVersion = "2021-07-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -321,26 +322,26 @@ func (client PrivateLinkScopedResourcesClient) ListByPrivateLinkScope(ctx contex {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.PrivateLinkScopedResourcesClient", "ListByPrivateLinkScope", err.Error()) + return result, validation.NewError("diagnostics.PrivateLinkScopedResourcesClient", "ListByPrivateLinkScope", err.Error()) } result.fn = client.listByPrivateLinkScopeNextResults req, err := client.ListByPrivateLinkScopePreparer(ctx, resourceGroupName, scopeName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "ListByPrivateLinkScope", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesClient", "ListByPrivateLinkScope", nil, "Failure preparing request") return } resp, err := client.ListByPrivateLinkScopeSender(req) if err != nil { result.srlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "ListByPrivateLinkScope", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesClient", "ListByPrivateLinkScope", resp, "Failure sending request") return } result.srlr, err = client.ListByPrivateLinkScopeResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "ListByPrivateLinkScope", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesClient", "ListByPrivateLinkScope", resp, "Failure responding to request") return } if result.srlr.hasNextLink() && result.srlr.IsEmpty() { @@ -359,7 +360,7 @@ func (client PrivateLinkScopedResourcesClient) ListByPrivateLinkScopePreparer(ct "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-10-17-preview" + const APIVersion = "2021-07-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -394,7 +395,7 @@ func (client PrivateLinkScopedResourcesClient) ListByPrivateLinkScopeResponder(r func (client PrivateLinkScopedResourcesClient) listByPrivateLinkScopeNextResults(ctx context.Context, lastResults ScopedResourceListResult) (result ScopedResourceListResult, err error) { req, err := lastResults.scopedResourceListResultPreparer(ctx) if err != nil { - return result, autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "listByPrivateLinkScopeNextResults", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesClient", "listByPrivateLinkScopeNextResults", nil, "Failure preparing next results request") } if req == nil { return @@ -402,11 +403,11 @@ func (client PrivateLinkScopedResourcesClient) listByPrivateLinkScopeNextResults resp, err := client.ListByPrivateLinkScopeSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "listByPrivateLinkScopeNextResults", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesClient", "listByPrivateLinkScopeNextResults", resp, "Failure sending next results request") } result, err = client.ListByPrivateLinkScopeResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "listByPrivateLinkScopeNextResults", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesClient", "listByPrivateLinkScopeNextResults", resp, "Failure responding to next results request") } return } diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/privatelinkscopeoperationstatus.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privatelinkscopeoperationstatus.go similarity index 88% rename from services/preview/monitor/mgmt/2021-04-01-preview/insights/privatelinkscopeoperationstatus.go rename to services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privatelinkscopeoperationstatus.go index a29fa9edf886..20c3d6dffb9e 100644 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/privatelinkscopeoperationstatus.go +++ b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privatelinkscopeoperationstatus.go @@ -1,4 +1,4 @@ -package insights +package diagnostics // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -53,25 +53,25 @@ func (client PrivateLinkScopeOperationStatusClient) Get(ctx context.Context, asy {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.PrivateLinkScopeOperationStatusClient", "Get", err.Error()) + return result, validation.NewError("diagnostics.PrivateLinkScopeOperationStatusClient", "Get", err.Error()) } req, err := client.GetPreparer(ctx, asyncOperationID, resourceGroupName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopeOperationStatusClient", "Get", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopeOperationStatusClient", "Get", nil, "Failure preparing request") return } resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopeOperationStatusClient", "Get", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopeOperationStatusClient", "Get", resp, "Failure sending request") return } result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopeOperationStatusClient", "Get", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopeOperationStatusClient", "Get", resp, "Failure responding to request") return } @@ -86,7 +86,7 @@ func (client PrivateLinkScopeOperationStatusClient) GetPreparer(ctx context.Cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-10-17-preview" + const APIVersion = "2021-07-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/privatelinkscopes.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privatelinkscopes.go similarity index 84% rename from services/preview/monitor/mgmt/2021-04-01-preview/insights/privatelinkscopes.go rename to services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privatelinkscopes.go index fc2796420366..9011ab1187a9 100644 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/privatelinkscopes.go +++ b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privatelinkscopes.go @@ -1,4 +1,4 @@ -package insights +package diagnostics // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -57,26 +57,27 @@ func (client PrivateLinkScopesClient) CreateOrUpdate(ctx context.Context, resour {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: azureMonitorPrivateLinkScopePayload, - Constraints: []validation.Constraint{{Target: "azureMonitorPrivateLinkScopePayload.AzureMonitorPrivateLinkScopeProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.PrivateLinkScopesClient", "CreateOrUpdate", err.Error()) + Constraints: []validation.Constraint{{Target: "azureMonitorPrivateLinkScopePayload.AzureMonitorPrivateLinkScopeProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "azureMonitorPrivateLinkScopePayload.AzureMonitorPrivateLinkScopeProperties.AccessModeSettings", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("diagnostics.PrivateLinkScopesClient", "CreateOrUpdate", err.Error()) } req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, scopeName, azureMonitorPrivateLinkScopePayload) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "CreateOrUpdate", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "CreateOrUpdate", nil, "Failure preparing request") return } resp, err := client.CreateOrUpdateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "CreateOrUpdate", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "CreateOrUpdate", resp, "Failure sending request") return } result, err = client.CreateOrUpdateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "CreateOrUpdate", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "CreateOrUpdate", resp, "Failure responding to request") return } @@ -91,11 +92,12 @@ func (client PrivateLinkScopesClient) CreateOrUpdatePreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-10-17-preview" + const APIVersion = "2021-07-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } + azureMonitorPrivateLinkScopePayload.SystemData = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), @@ -145,18 +147,18 @@ func (client PrivateLinkScopesClient) Delete(ctx context.Context, resourceGroupN {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.PrivateLinkScopesClient", "Delete", err.Error()) + return result, validation.NewError("diagnostics.PrivateLinkScopesClient", "Delete", err.Error()) } req, err := client.DeletePreparer(ctx, resourceGroupName, scopeName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "Delete", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "Delete", nil, "Failure preparing request") return } result, err = client.DeleteSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "Delete", result.Response(), "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "Delete", result.Response(), "Failure sending request") return } @@ -171,7 +173,7 @@ func (client PrivateLinkScopesClient) DeletePreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-10-17-preview" + const APIVersion = "2021-07-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -232,25 +234,25 @@ func (client PrivateLinkScopesClient) Get(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.PrivateLinkScopesClient", "Get", err.Error()) + return result, validation.NewError("diagnostics.PrivateLinkScopesClient", "Get", err.Error()) } req, err := client.GetPreparer(ctx, resourceGroupName, scopeName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "Get", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "Get", nil, "Failure preparing request") return } resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "Get", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "Get", resp, "Failure sending request") return } result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "Get", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "Get", resp, "Failure responding to request") return } @@ -265,7 +267,7 @@ func (client PrivateLinkScopesClient) GetPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-10-17-preview" + const APIVersion = "2021-07-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -311,26 +313,26 @@ func (client PrivateLinkScopesClient) List(ctx context.Context) (result AzureMon if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.PrivateLinkScopesClient", "List", err.Error()) + return result, validation.NewError("diagnostics.PrivateLinkScopesClient", "List", err.Error()) } result.fn = client.listNextResults req, err := client.ListPreparer(ctx) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "List", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "List", nil, "Failure preparing request") return } resp, err := client.ListSender(req) if err != nil { result.amplslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "List", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "List", resp, "Failure sending request") return } result.amplslr, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "List", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "List", resp, "Failure responding to request") return } if result.amplslr.hasNextLink() && result.amplslr.IsEmpty() { @@ -347,7 +349,7 @@ func (client PrivateLinkScopesClient) ListPreparer(ctx context.Context) (*http.R "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-10-17-preview" + const APIVersion = "2021-07-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -382,7 +384,7 @@ func (client PrivateLinkScopesClient) ListResponder(resp *http.Response) (result func (client PrivateLinkScopesClient) listNextResults(ctx context.Context, lastResults AzureMonitorPrivateLinkScopeListResult) (result AzureMonitorPrivateLinkScopeListResult, err error) { req, err := lastResults.azureMonitorPrivateLinkScopeListResultPreparer(ctx) if err != nil { - return result, autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "listNextResults", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "listNextResults", nil, "Failure preparing next results request") } if req == nil { return @@ -390,11 +392,11 @@ func (client PrivateLinkScopesClient) listNextResults(ctx context.Context, lastR resp, err := client.ListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "listNextResults", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "listNextResults", resp, "Failure sending next results request") } result, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "listNextResults", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "listNextResults", resp, "Failure responding to next results request") } return } @@ -435,26 +437,26 @@ func (client PrivateLinkScopesClient) ListByResourceGroup(ctx context.Context, r {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.PrivateLinkScopesClient", "ListByResourceGroup", err.Error()) + return result, validation.NewError("diagnostics.PrivateLinkScopesClient", "ListByResourceGroup", err.Error()) } result.fn = client.listByResourceGroupNextResults req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "ListByResourceGroup", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "ListByResourceGroup", nil, "Failure preparing request") return } resp, err := client.ListByResourceGroupSender(req) if err != nil { result.amplslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "ListByResourceGroup", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "ListByResourceGroup", resp, "Failure sending request") return } result.amplslr, err = client.ListByResourceGroupResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "ListByResourceGroup", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "ListByResourceGroup", resp, "Failure responding to request") return } if result.amplslr.hasNextLink() && result.amplslr.IsEmpty() { @@ -472,7 +474,7 @@ func (client PrivateLinkScopesClient) ListByResourceGroupPreparer(ctx context.Co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-10-17-preview" + const APIVersion = "2021-07-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -507,7 +509,7 @@ func (client PrivateLinkScopesClient) ListByResourceGroupResponder(resp *http.Re func (client PrivateLinkScopesClient) listByResourceGroupNextResults(ctx context.Context, lastResults AzureMonitorPrivateLinkScopeListResult) (result AzureMonitorPrivateLinkScopeListResult, err error) { req, err := lastResults.azureMonitorPrivateLinkScopeListResultPreparer(ctx) if err != nil { - return result, autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") } if req == nil { return @@ -515,11 +517,11 @@ func (client PrivateLinkScopesClient) listByResourceGroupNextResults(ctx context resp, err := client.ListByResourceGroupSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") } result, err = client.ListByResourceGroupResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") } return } @@ -562,25 +564,25 @@ func (client PrivateLinkScopesClient) UpdateTags(ctx context.Context, resourceGr {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.PrivateLinkScopesClient", "UpdateTags", err.Error()) + return result, validation.NewError("diagnostics.PrivateLinkScopesClient", "UpdateTags", err.Error()) } req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, scopeName, privateLinkScopeTags) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "UpdateTags", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "UpdateTags", nil, "Failure preparing request") return } resp, err := client.UpdateTagsSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "UpdateTags", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "UpdateTags", resp, "Failure sending request") return } result, err = client.UpdateTagsResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "UpdateTags", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "UpdateTags", resp, "Failure responding to request") return } @@ -595,7 +597,7 @@ func (client PrivateLinkScopesClient) UpdateTagsPreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-10-17-preview" + const APIVersion = "2021-07-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/diagnosticsettings.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/settings.go similarity index 52% rename from services/preview/monitor/mgmt/2021-04-01-preview/insights/diagnosticsettings.go rename to services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/settings.go index 0c0ec82dfe29..73726518719e 100644 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/diagnosticsettings.go +++ b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/settings.go @@ -1,4 +1,4 @@ -package insights +package diagnostics // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,26 +10,24 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" "net/http" ) -// DiagnosticSettingsClient is the monitor Management Client -type DiagnosticSettingsClient struct { +// SettingsClient is the monitor Management Client +type SettingsClient struct { BaseClient } -// NewDiagnosticSettingsClient creates an instance of the DiagnosticSettingsClient client. -func NewDiagnosticSettingsClient(subscriptionID string) DiagnosticSettingsClient { - return NewDiagnosticSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) +// NewSettingsClient creates an instance of the SettingsClient client. +func NewSettingsClient(subscriptionID string) SettingsClient { + return NewSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// NewDiagnosticSettingsClientWithBaseURI creates an instance of the DiagnosticSettingsClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewDiagnosticSettingsClientWithBaseURI(baseURI string, subscriptionID string) DiagnosticSettingsClient { - return DiagnosticSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} +// NewSettingsClientWithBaseURI creates an instance of the SettingsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewSettingsClientWithBaseURI(baseURI string, subscriptionID string) SettingsClient { + return SettingsClient{NewWithBaseURI(baseURI, subscriptionID)} } // CreateOrUpdate creates or updates diagnostic settings for the specified resource. @@ -37,9 +35,9 @@ func NewDiagnosticSettingsClientWithBaseURI(baseURI string, subscriptionID strin // resourceURI - the identifier of the resource. // parameters - parameters supplied to the operation. // name - the name of the diagnostic setting. -func (client DiagnosticSettingsClient) CreateOrUpdate(ctx context.Context, resourceURI string, parameters DiagnosticSettingsResource, name string) (result DiagnosticSettingsResource, err error) { +func (client SettingsClient) CreateOrUpdate(ctx context.Context, resourceURI string, parameters SettingsResource, name string) (result SettingsResource, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.CreateOrUpdate") + ctx = tracing.StartSpan(ctx, fqdn+"/SettingsClient.CreateOrUpdate") defer func() { sc := -1 if result.Response.Response != nil { @@ -48,28 +46,22 @@ func (client DiagnosticSettingsClient) CreateOrUpdate(ctx context.Context, resou tracing.EndSpan(ctx, sc, err) }() } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceURI, - Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DiagnosticSettingsClient", "CreateOrUpdate", err.Error()) - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceURI, parameters, name) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.SettingsClient", "CreateOrUpdate", nil, "Failure preparing request") return } resp, err := client.CreateOrUpdateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.SettingsClient", "CreateOrUpdate", resp, "Failure sending request") return } result, err = client.CreateOrUpdateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "diagnostics.SettingsClient", "CreateOrUpdate", resp, "Failure responding to request") return } @@ -77,22 +69,23 @@ func (client DiagnosticSettingsClient) CreateOrUpdate(ctx context.Context, resou } // CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DiagnosticSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceURI string, parameters DiagnosticSettingsResource, name string) (*http.Request, error) { +func (client SettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceURI string, parameters SettingsResource, name string) (*http.Request, error) { pathParameters := map[string]interface{}{ "name": autorest.Encode("path", name), "resourceUri": resourceURI, } - const APIVersion = "2017-05-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } + parameters.SystemData = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -100,13 +93,13 @@ func (client DiagnosticSettingsClient) CreateOrUpdatePreparer(ctx context.Contex // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. -func (client DiagnosticSettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { +func (client SettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. -func (client DiagnosticSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result DiagnosticSettingsResource, err error) { +func (client SettingsClient) CreateOrUpdateResponder(resp *http.Response) (result SettingsResource, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -120,9 +113,9 @@ func (client DiagnosticSettingsClient) CreateOrUpdateResponder(resp *http.Respon // Parameters: // resourceURI - the identifier of the resource. // name - the name of the diagnostic setting. -func (client DiagnosticSettingsClient) Delete(ctx context.Context, resourceURI string, name string) (result autorest.Response, err error) { +func (client SettingsClient) Delete(ctx context.Context, resourceURI string, name string) (result autorest.Response, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.Delete") + ctx = tracing.StartSpan(ctx, fqdn+"/SettingsClient.Delete") defer func() { sc := -1 if result.Response != nil { @@ -131,28 +124,22 @@ func (client DiagnosticSettingsClient) Delete(ctx context.Context, resourceURI s tracing.EndSpan(ctx, sc, err) }() } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceURI, - Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DiagnosticSettingsClient", "Delete", err.Error()) - } - req, err := client.DeletePreparer(ctx, resourceURI, name) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.SettingsClient", "Delete", nil, "Failure preparing request") return } resp, err := client.DeleteSender(req) if err != nil { result.Response = resp - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.SettingsClient", "Delete", resp, "Failure sending request") return } result, err = client.DeleteResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "diagnostics.SettingsClient", "Delete", resp, "Failure responding to request") return } @@ -160,13 +147,13 @@ func (client DiagnosticSettingsClient) Delete(ctx context.Context, resourceURI s } // DeletePreparer prepares the Delete request. -func (client DiagnosticSettingsClient) DeletePreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { +func (client SettingsClient) DeletePreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { pathParameters := map[string]interface{}{ "name": autorest.Encode("path", name), "resourceUri": resourceURI, } - const APIVersion = "2017-05-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -174,20 +161,20 @@ func (client DiagnosticSettingsClient) DeletePreparer(ctx context.Context, resou preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. -func (client DiagnosticSettingsClient) DeleteSender(req *http.Request) (*http.Response, error) { +func (client SettingsClient) DeleteSender(req *http.Request) (*http.Response, error) { return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. -func (client DiagnosticSettingsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { +func (client SettingsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), @@ -200,9 +187,9 @@ func (client DiagnosticSettingsClient) DeleteResponder(resp *http.Response) (res // Parameters: // resourceURI - the identifier of the resource. // name - the name of the diagnostic setting. -func (client DiagnosticSettingsClient) Get(ctx context.Context, resourceURI string, name string) (result DiagnosticSettingsResource, err error) { +func (client SettingsClient) Get(ctx context.Context, resourceURI string, name string) (result SettingsResource, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.Get") + ctx = tracing.StartSpan(ctx, fqdn+"/SettingsClient.Get") defer func() { sc := -1 if result.Response.Response != nil { @@ -211,28 +198,22 @@ func (client DiagnosticSettingsClient) Get(ctx context.Context, resourceURI stri tracing.EndSpan(ctx, sc, err) }() } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceURI, - Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DiagnosticSettingsClient", "Get", err.Error()) - } - req, err := client.GetPreparer(ctx, resourceURI, name) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Get", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.SettingsClient", "Get", nil, "Failure preparing request") return } resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Get", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.SettingsClient", "Get", resp, "Failure sending request") return } result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Get", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "diagnostics.SettingsClient", "Get", resp, "Failure responding to request") return } @@ -240,13 +221,13 @@ func (client DiagnosticSettingsClient) Get(ctx context.Context, resourceURI stri } // GetPreparer prepares the Get request. -func (client DiagnosticSettingsClient) GetPreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { +func (client SettingsClient) GetPreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { pathParameters := map[string]interface{}{ "name": autorest.Encode("path", name), "resourceUri": resourceURI, } - const APIVersion = "2017-05-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -254,20 +235,20 @@ func (client DiagnosticSettingsClient) GetPreparer(ctx context.Context, resource preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. -func (client DiagnosticSettingsClient) GetSender(req *http.Request) (*http.Response, error) { +func (client SettingsClient) GetSender(req *http.Request) (*http.Response, error) { return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client DiagnosticSettingsClient) GetResponder(resp *http.Response) (result DiagnosticSettingsResource, err error) { +func (client SettingsClient) GetResponder(resp *http.Response) (result SettingsResource, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -280,9 +261,9 @@ func (client DiagnosticSettingsClient) GetResponder(resp *http.Response) (result // List gets the active diagnostic settings list for the specified resource. // Parameters: // resourceURI - the identifier of the resource. -func (client DiagnosticSettingsClient) List(ctx context.Context, resourceURI string) (result DiagnosticSettingsResourceCollection, err error) { +func (client SettingsClient) List(ctx context.Context, resourceURI string) (result SettingsResourceCollection, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.List") + ctx = tracing.StartSpan(ctx, fqdn+"/SettingsClient.List") defer func() { sc := -1 if result.Response.Response != nil { @@ -291,28 +272,22 @@ func (client DiagnosticSettingsClient) List(ctx context.Context, resourceURI str tracing.EndSpan(ctx, sc, err) }() } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceURI, - Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DiagnosticSettingsClient", "List", err.Error()) - } - req, err := client.ListPreparer(ctx, resourceURI) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "List", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "diagnostics.SettingsClient", "List", nil, "Failure preparing request") return } resp, err := client.ListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "List", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "diagnostics.SettingsClient", "List", resp, "Failure sending request") return } result, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "List", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "diagnostics.SettingsClient", "List", resp, "Failure responding to request") return } @@ -320,12 +295,12 @@ func (client DiagnosticSettingsClient) List(ctx context.Context, resourceURI str } // ListPreparer prepares the List request. -func (client DiagnosticSettingsClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { +func (client SettingsClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceUri": resourceURI, } - const APIVersion = "2017-05-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -333,20 +308,20 @@ func (client DiagnosticSettingsClient) ListPreparer(ctx context.Context, resourc preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. -func (client DiagnosticSettingsClient) ListSender(req *http.Request) (*http.Response, error) { +func (client SettingsClient) ListSender(req *http.Request) (*http.Response, error) { return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } // ListResponder handles the response to the List request. The method always // closes the http.Response Body. -func (client DiagnosticSettingsClient) ListResponder(resp *http.Response) (result DiagnosticSettingsResourceCollection, err error) { +func (client SettingsClient) ListResponder(resp *http.Response) (result SettingsResourceCollection, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), diff --git a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/settingscategory.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/settingscategory.go new file mode 100644 index 000000000000..20823f2912cf --- /dev/null +++ b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/settingscategory.go @@ -0,0 +1,180 @@ +package diagnostics + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for 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 ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SettingsCategoryClient is the monitor Management Client +type SettingsCategoryClient struct { + BaseClient +} + +// NewSettingsCategoryClient creates an instance of the SettingsCategoryClient client. +func NewSettingsCategoryClient(subscriptionID string) SettingsCategoryClient { + return NewSettingsCategoryClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSettingsCategoryClientWithBaseURI creates an instance of the SettingsCategoryClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewSettingsCategoryClientWithBaseURI(baseURI string, subscriptionID string) SettingsCategoryClient { + return SettingsCategoryClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets the diagnostic settings category for the specified resource. +// Parameters: +// resourceURI - the identifier of the resource. +// name - the name of the diagnostic setting. +func (client SettingsCategoryClient) Get(ctx context.Context, resourceURI string, name string) (result SettingsCategoryResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SettingsCategoryClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceURI, name) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.SettingsCategoryClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "diagnostics.SettingsCategoryClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.SettingsCategoryClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SettingsCategoryClient) GetPreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceUri": resourceURI, + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SettingsCategoryClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SettingsCategoryClient) GetResponder(resp *http.Response) (result SettingsCategoryResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists the diagnostic settings categories for the specified resource. +// Parameters: +// resourceURI - the identifier of the resource. +func (client SettingsCategoryClient) List(ctx context.Context, resourceURI string) (result SettingsCategoryResourceCollection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SettingsCategoryClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, resourceURI) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.SettingsCategoryClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "diagnostics.SettingsCategoryClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.SettingsCategoryClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SettingsCategoryClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceUri": resourceURI, + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SettingsCategoryClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SettingsCategoryClient) ListResponder(resp *http.Response) (result SettingsCategoryResourceCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/subscriptiondiagnosticsettings.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/subscriptiondiagnosticsettings.go new file mode 100644 index 000000000000..6cd0e6339d1d --- /dev/null +++ b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/subscriptiondiagnosticsettings.go @@ -0,0 +1,353 @@ +package diagnostics + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for 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 ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SubscriptionDiagnosticSettingsClient is the monitor Management Client +type SubscriptionDiagnosticSettingsClient struct { + BaseClient +} + +// NewSubscriptionDiagnosticSettingsClient creates an instance of the SubscriptionDiagnosticSettingsClient client. +func NewSubscriptionDiagnosticSettingsClient(subscriptionID string) SubscriptionDiagnosticSettingsClient { + return NewSubscriptionDiagnosticSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSubscriptionDiagnosticSettingsClientWithBaseURI creates an instance of the SubscriptionDiagnosticSettingsClient +// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI +// (sovereign clouds, Azure stack). +func NewSubscriptionDiagnosticSettingsClientWithBaseURI(baseURI string, subscriptionID string) SubscriptionDiagnosticSettingsClient { + return SubscriptionDiagnosticSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates subscription diagnostic settings for the specified resource. +// Parameters: +// parameters - parameters supplied to the operation. +// name - the name of the diagnostic setting. +func (client SubscriptionDiagnosticSettingsClient) CreateOrUpdate(ctx context.Context, parameters SubscriptionDiagnosticSettingsResource, name string) (result SubscriptionDiagnosticSettingsResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionDiagnosticSettingsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("diagnostics.SubscriptionDiagnosticSettingsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, parameters, name) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.SubscriptionDiagnosticSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "diagnostics.SubscriptionDiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.SubscriptionDiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SubscriptionDiagnosticSettingsClient) CreateOrUpdatePreparer(ctx context.Context, parameters SubscriptionDiagnosticSettingsResource, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SubscriptionDiagnosticSettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SubscriptionDiagnosticSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result SubscriptionDiagnosticSettingsResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes existing subscription diagnostic settings for the specified resource. +// Parameters: +// name - the name of the diagnostic setting. +func (client SubscriptionDiagnosticSettingsClient) Delete(ctx context.Context, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionDiagnosticSettingsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("diagnostics.SubscriptionDiagnosticSettingsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, name) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.SubscriptionDiagnosticSettingsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "diagnostics.SubscriptionDiagnosticSettingsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.SubscriptionDiagnosticSettingsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SubscriptionDiagnosticSettingsClient) DeletePreparer(ctx context.Context, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SubscriptionDiagnosticSettingsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SubscriptionDiagnosticSettingsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the active subscription diagnostic settings for the specified resource. +// Parameters: +// name - the name of the diagnostic setting. +func (client SubscriptionDiagnosticSettingsClient) Get(ctx context.Context, name string) (result SubscriptionDiagnosticSettingsResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionDiagnosticSettingsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("diagnostics.SubscriptionDiagnosticSettingsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, name) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.SubscriptionDiagnosticSettingsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "diagnostics.SubscriptionDiagnosticSettingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.SubscriptionDiagnosticSettingsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SubscriptionDiagnosticSettingsClient) GetPreparer(ctx context.Context, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SubscriptionDiagnosticSettingsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SubscriptionDiagnosticSettingsClient) GetResponder(resp *http.Response) (result SubscriptionDiagnosticSettingsResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets the active subscription diagnostic settings list for the specified subscriptionId. +func (client SubscriptionDiagnosticSettingsClient) List(ctx context.Context) (result SubscriptionDiagnosticSettingsResourceCollection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionDiagnosticSettingsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("diagnostics.SubscriptionDiagnosticSettingsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.SubscriptionDiagnosticSettingsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "diagnostics.SubscriptionDiagnosticSettingsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "diagnostics.SubscriptionDiagnosticSettingsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SubscriptionDiagnosticSettingsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SubscriptionDiagnosticSettingsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SubscriptionDiagnosticSettingsClient) ListResponder(resp *http.Response) (result SubscriptionDiagnosticSettingsResourceCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/version.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/version.go new file mode 100644 index 000000000000..e87c4a7dad45 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/version.go @@ -0,0 +1,19 @@ +package diagnostics + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " diagnostics/2021-05-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/monitor/mgmt/2021-05-01-preview/metrics/CHANGELOG.md b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/preview/monitor/mgmt/2021-05-01-preview/metrics/_meta.json b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/_meta.json new file mode 100644 index 000000000000..5a9992e17ad8 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "83f6c7b9ac240d3862e909245f0a61d70ae33908", + "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", + "tag": "package-2021-05-metrics", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-05-metrics --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/metricalerts.go b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/alerts.go similarity index 66% rename from services/preview/monitor/mgmt/2021-04-01-preview/insights/metricalerts.go rename to services/preview/monitor/mgmt/2021-05-01-preview/metrics/alerts.go index f9706664d9be..7666df96cdb2 100644 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/metricalerts.go +++ b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/alerts.go @@ -1,4 +1,4 @@ -package insights +package metrics // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -15,20 +15,20 @@ import ( "net/http" ) -// MetricAlertsClient is the monitor Management Client -type MetricAlertsClient struct { +// AlertsClient is the monitor Management Client +type AlertsClient struct { BaseClient } -// NewMetricAlertsClient creates an instance of the MetricAlertsClient client. -func NewMetricAlertsClient(subscriptionID string) MetricAlertsClient { - return NewMetricAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID) +// NewAlertsClient creates an instance of the AlertsClient client. +func NewAlertsClient(subscriptionID string) AlertsClient { + return NewAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// NewMetricAlertsClientWithBaseURI creates an instance of the MetricAlertsClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewMetricAlertsClientWithBaseURI(baseURI string, subscriptionID string) MetricAlertsClient { - return MetricAlertsClient{NewWithBaseURI(baseURI, subscriptionID)} +// NewAlertsClientWithBaseURI creates an instance of the AlertsClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAlertsClientWithBaseURI(baseURI string, subscriptionID string) AlertsClient { + return AlertsClient{NewWithBaseURI(baseURI, subscriptionID)} } // CreateOrUpdate create or update an metric alert definition. @@ -36,9 +36,9 @@ func NewMetricAlertsClientWithBaseURI(baseURI string, subscriptionID string) Met // resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to create or update. -func (client MetricAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource) (result MetricAlertResource, err error) { +func (client AlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertResource) (result AlertResource, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.CreateOrUpdate") + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.CreateOrUpdate") defer func() { sc := -1 if result.Response.Response != nil { @@ -54,32 +54,32 @@ func (client MetricAlertsClient) CreateOrUpdate(ctx context.Context, resourceGro Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.MetricAlertProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.MetricAlertProperties.Severity", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.Scopes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.EvaluationFrequency", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.WindowSize", Name: validation.Null, Rule: true, Chain: nil}, + Constraints: []validation.Constraint{{Target: "parameters.AlertProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.AlertProperties.Severity", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AlertProperties.Enabled", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AlertProperties.Scopes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AlertProperties.EvaluationFrequency", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AlertProperties.WindowSize", Name: validation.Null, Rule: true, Chain: nil}, }}}}}); err != nil { - return result, validation.NewError("insights.MetricAlertsClient", "CreateOrUpdate", err.Error()) + return result, validation.NewError("metrics.AlertsClient", "CreateOrUpdate", err.Error()) } req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "CreateOrUpdate", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "CreateOrUpdate", nil, "Failure preparing request") return } resp, err := client.CreateOrUpdateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "CreateOrUpdate", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "CreateOrUpdate", resp, "Failure sending request") return } result, err = client.CreateOrUpdateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "CreateOrUpdate", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "CreateOrUpdate", resp, "Failure responding to request") return } @@ -87,7 +87,7 @@ func (client MetricAlertsClient) CreateOrUpdate(ctx context.Context, resourceGro } // CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client MetricAlertsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource) (*http.Request, error) { +func (client AlertsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertResource) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "ruleName": autorest.Encode("path", ruleName), @@ -111,13 +111,13 @@ func (client MetricAlertsClient) CreateOrUpdatePreparer(ctx context.Context, res // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. -func (client MetricAlertsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { +func (client AlertsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. -func (client MetricAlertsClient) CreateOrUpdateResponder(resp *http.Response) (result MetricAlertResource, err error) { +func (client AlertsClient) CreateOrUpdateResponder(resp *http.Response) (result AlertResource, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -131,9 +131,9 @@ func (client MetricAlertsClient) CreateOrUpdateResponder(resp *http.Response) (r // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. -func (client MetricAlertsClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { +func (client AlertsClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.Delete") + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.Delete") defer func() { sc := -1 if result.Response != nil { @@ -148,25 +148,25 @@ func (client MetricAlertsClient) Delete(ctx context.Context, resourceGroupName s {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.MetricAlertsClient", "Delete", err.Error()) + return result, validation.NewError("metrics.AlertsClient", "Delete", err.Error()) } req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "Delete", nil, "Failure preparing request") return } resp, err := client.DeleteSender(req) if err != nil { result.Response = resp - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "Delete", resp, "Failure sending request") return } result, err = client.DeleteResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "Delete", resp, "Failure responding to request") return } @@ -174,7 +174,7 @@ func (client MetricAlertsClient) Delete(ctx context.Context, resourceGroupName s } // DeletePreparer prepares the Delete request. -func (client MetricAlertsClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { +func (client AlertsClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "ruleName": autorest.Encode("path", ruleName), @@ -196,13 +196,13 @@ func (client MetricAlertsClient) DeletePreparer(ctx context.Context, resourceGro // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. -func (client MetricAlertsClient) DeleteSender(req *http.Request) (*http.Response, error) { +func (client AlertsClient) DeleteSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. -func (client MetricAlertsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { +func (client AlertsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), @@ -215,9 +215,9 @@ func (client MetricAlertsClient) DeleteResponder(resp *http.Response) (result au // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. -func (client MetricAlertsClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertResource, err error) { +func (client AlertsClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result AlertResource, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.Get") + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.Get") defer func() { sc := -1 if result.Response.Response != nil { @@ -232,25 +232,25 @@ func (client MetricAlertsClient) Get(ctx context.Context, resourceGroupName stri {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.MetricAlertsClient", "Get", err.Error()) + return result, validation.NewError("metrics.AlertsClient", "Get", err.Error()) } req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Get", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "Get", nil, "Failure preparing request") return } resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Get", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "Get", resp, "Failure sending request") return } result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Get", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "Get", resp, "Failure responding to request") return } @@ -258,7 +258,7 @@ func (client MetricAlertsClient) Get(ctx context.Context, resourceGroupName stri } // GetPreparer prepares the Get request. -func (client MetricAlertsClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { +func (client AlertsClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "ruleName": autorest.Encode("path", ruleName), @@ -280,13 +280,13 @@ func (client MetricAlertsClient) GetPreparer(ctx context.Context, resourceGroupN // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. -func (client MetricAlertsClient) GetSender(req *http.Request) (*http.Response, error) { +func (client AlertsClient) GetSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client MetricAlertsClient) GetResponder(resp *http.Response) (result MetricAlertResource, err error) { +func (client AlertsClient) GetResponder(resp *http.Response) (result AlertResource, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -299,9 +299,9 @@ func (client MetricAlertsClient) GetResponder(resp *http.Response) (result Metri // ListByResourceGroup retrieve alert rule definitions in a resource group. // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. -func (client MetricAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result MetricAlertResourceCollection, err error) { +func (client AlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AlertResourceCollection, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.ListByResourceGroup") + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.ListByResourceGroup") defer func() { sc := -1 if result.Response.Response != nil { @@ -316,25 +316,25 @@ func (client MetricAlertsClient) ListByResourceGroup(ctx context.Context, resour {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.MetricAlertsClient", "ListByResourceGroup", err.Error()) + return result, validation.NewError("metrics.AlertsClient", "ListByResourceGroup", err.Error()) } req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListByResourceGroup", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "ListByResourceGroup", nil, "Failure preparing request") return } resp, err := client.ListByResourceGroupSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListByResourceGroup", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "ListByResourceGroup", resp, "Failure sending request") return } result, err = client.ListByResourceGroupResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListByResourceGroup", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "ListByResourceGroup", resp, "Failure responding to request") return } @@ -342,7 +342,7 @@ func (client MetricAlertsClient) ListByResourceGroup(ctx context.Context, resour } // ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client MetricAlertsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { +func (client AlertsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), @@ -363,13 +363,13 @@ func (client MetricAlertsClient) ListByResourceGroupPreparer(ctx context.Context // ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the // http.Response Body if it receives an error. -func (client MetricAlertsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { +func (client AlertsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always // closes the http.Response Body. -func (client MetricAlertsClient) ListByResourceGroupResponder(resp *http.Response) (result MetricAlertResourceCollection, err error) { +func (client AlertsClient) ListByResourceGroupResponder(resp *http.Response) (result AlertResourceCollection, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -380,9 +380,9 @@ func (client MetricAlertsClient) ListByResourceGroupResponder(resp *http.Respons } // ListBySubscription retrieve alert rule definitions in a subscription. -func (client MetricAlertsClient) ListBySubscription(ctx context.Context) (result MetricAlertResourceCollection, err error) { +func (client AlertsClient) ListBySubscription(ctx context.Context) (result AlertResourceCollection, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.ListBySubscription") + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.ListBySubscription") defer func() { sc := -1 if result.Response.Response != nil { @@ -394,25 +394,25 @@ func (client MetricAlertsClient) ListBySubscription(ctx context.Context) (result if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.MetricAlertsClient", "ListBySubscription", err.Error()) + return result, validation.NewError("metrics.AlertsClient", "ListBySubscription", err.Error()) } req, err := client.ListBySubscriptionPreparer(ctx) if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "ListBySubscription", nil, "Failure preparing request") return } resp, err := client.ListBySubscriptionSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "ListBySubscription", resp, "Failure sending request") return } result, err = client.ListBySubscriptionResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "ListBySubscription", resp, "Failure responding to request") return } @@ -420,7 +420,7 @@ func (client MetricAlertsClient) ListBySubscription(ctx context.Context) (result } // ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client MetricAlertsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { +func (client AlertsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { pathParameters := map[string]interface{}{ "subscriptionId": autorest.Encode("path", client.SubscriptionID), } @@ -440,13 +440,13 @@ func (client MetricAlertsClient) ListBySubscriptionPreparer(ctx context.Context) // ListBySubscriptionSender sends the ListBySubscription request. The method will close the // http.Response Body if it receives an error. -func (client MetricAlertsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { +func (client AlertsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always // closes the http.Response Body. -func (client MetricAlertsClient) ListBySubscriptionResponder(resp *http.Response) (result MetricAlertResourceCollection, err error) { +func (client AlertsClient) ListBySubscriptionResponder(resp *http.Response) (result AlertResourceCollection, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -461,9 +461,9 @@ func (client MetricAlertsClient) ListBySubscriptionResponder(resp *http.Response // resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // parameters - the parameters of the rule to update. -func (client MetricAlertsClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch) (result MetricAlertResource, err error) { +func (client AlertsClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertResourcePatch) (result AlertResource, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.Update") + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.Update") defer func() { sc := -1 if result.Response.Response != nil { @@ -478,25 +478,25 @@ func (client MetricAlertsClient) Update(ctx context.Context, resourceGroupName s {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.MetricAlertsClient", "Update", err.Error()) + return result, validation.NewError("metrics.AlertsClient", "Update", err.Error()) } req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, parameters) if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Update", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "Update", nil, "Failure preparing request") return } resp, err := client.UpdateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Update", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "Update", resp, "Failure sending request") return } result, err = client.UpdateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Update", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "Update", resp, "Failure responding to request") return } @@ -504,7 +504,7 @@ func (client MetricAlertsClient) Update(ctx context.Context, resourceGroupName s } // UpdatePreparer prepares the Update request. -func (client MetricAlertsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch) (*http.Request, error) { +func (client AlertsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertResourcePatch) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "ruleName": autorest.Encode("path", ruleName), @@ -528,13 +528,13 @@ func (client MetricAlertsClient) UpdatePreparer(ctx context.Context, resourceGro // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. -func (client MetricAlertsClient) UpdateSender(req *http.Request) (*http.Response, error) { +func (client AlertsClient) UpdateSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. -func (client MetricAlertsClient) UpdateResponder(resp *http.Response) (result MetricAlertResource, err error) { +func (client AlertsClient) UpdateResponder(resp *http.Response) (result AlertResource, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/metricalertsstatus.go b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/alertsstatus.go similarity index 65% rename from services/preview/monitor/mgmt/2021-04-01-preview/insights/metricalertsstatus.go rename to services/preview/monitor/mgmt/2021-05-01-preview/metrics/alertsstatus.go index 4709142160be..b6af7a518498 100644 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/metricalertsstatus.go +++ b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/alertsstatus.go @@ -1,4 +1,4 @@ -package insights +package metrics // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -15,30 +15,29 @@ import ( "net/http" ) -// MetricAlertsStatusClient is the monitor Management Client -type MetricAlertsStatusClient struct { +// AlertsStatusClient is the monitor Management Client +type AlertsStatusClient struct { BaseClient } -// NewMetricAlertsStatusClient creates an instance of the MetricAlertsStatusClient client. -func NewMetricAlertsStatusClient(subscriptionID string) MetricAlertsStatusClient { - return NewMetricAlertsStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) +// NewAlertsStatusClient creates an instance of the AlertsStatusClient client. +func NewAlertsStatusClient(subscriptionID string) AlertsStatusClient { + return NewAlertsStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// NewMetricAlertsStatusClientWithBaseURI creates an instance of the MetricAlertsStatusClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewMetricAlertsStatusClientWithBaseURI(baseURI string, subscriptionID string) MetricAlertsStatusClient { - return MetricAlertsStatusClient{NewWithBaseURI(baseURI, subscriptionID)} +// NewAlertsStatusClientWithBaseURI creates an instance of the AlertsStatusClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAlertsStatusClientWithBaseURI(baseURI string, subscriptionID string) AlertsStatusClient { + return AlertsStatusClient{NewWithBaseURI(baseURI, subscriptionID)} } // List retrieve an alert rule status. // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. -func (client MetricAlertsStatusClient) List(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertStatusCollection, err error) { +func (client AlertsStatusClient) List(ctx context.Context, resourceGroupName string, ruleName string) (result AlertStatusCollection, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsStatusClient.List") + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsStatusClient.List") defer func() { sc := -1 if result.Response.Response != nil { @@ -53,25 +52,25 @@ func (client MetricAlertsStatusClient) List(ctx context.Context, resourceGroupNa {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.MetricAlertsStatusClient", "List", err.Error()) + return result, validation.NewError("metrics.AlertsStatusClient", "List", err.Error()) } req, err := client.ListPreparer(ctx, resourceGroupName, ruleName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "List", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "metrics.AlertsStatusClient", "List", nil, "Failure preparing request") return } resp, err := client.ListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "List", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "metrics.AlertsStatusClient", "List", resp, "Failure sending request") return } result, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "List", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "metrics.AlertsStatusClient", "List", resp, "Failure responding to request") return } @@ -79,7 +78,7 @@ func (client MetricAlertsStatusClient) List(ctx context.Context, resourceGroupNa } // ListPreparer prepares the List request. -func (client MetricAlertsStatusClient) ListPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { +func (client AlertsStatusClient) ListPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "ruleName": autorest.Encode("path", ruleName), @@ -101,13 +100,13 @@ func (client MetricAlertsStatusClient) ListPreparer(ctx context.Context, resourc // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. -func (client MetricAlertsStatusClient) ListSender(req *http.Request) (*http.Response, error) { +func (client AlertsStatusClient) ListSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // ListResponder handles the response to the List request. The method always // closes the http.Response Body. -func (client MetricAlertsStatusClient) ListResponder(resp *http.Response) (result MetricAlertStatusCollection, err error) { +func (client AlertsStatusClient) ListResponder(resp *http.Response) (result AlertStatusCollection, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -122,9 +121,9 @@ func (client MetricAlertsStatusClient) ListResponder(resp *http.Response) (resul // resourceGroupName - the name of the resource group. The name is case insensitive. // ruleName - the name of the rule. // statusName - the name of the status. -func (client MetricAlertsStatusClient) ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (result MetricAlertStatusCollection, err error) { +func (client AlertsStatusClient) ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (result AlertStatusCollection, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsStatusClient.ListByName") + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsStatusClient.ListByName") defer func() { sc := -1 if result.Response.Response != nil { @@ -139,25 +138,25 @@ func (client MetricAlertsStatusClient) ListByName(ctx context.Context, resourceG {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.MetricAlertsStatusClient", "ListByName", err.Error()) + return result, validation.NewError("metrics.AlertsStatusClient", "ListByName", err.Error()) } req, err := client.ListByNamePreparer(ctx, resourceGroupName, ruleName, statusName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "metrics.AlertsStatusClient", "ListByName", nil, "Failure preparing request") return } resp, err := client.ListByNameSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "metrics.AlertsStatusClient", "ListByName", resp, "Failure sending request") return } result, err = client.ListByNameResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "metrics.AlertsStatusClient", "ListByName", resp, "Failure responding to request") return } @@ -165,7 +164,7 @@ func (client MetricAlertsStatusClient) ListByName(ctx context.Context, resourceG } // ListByNamePreparer prepares the ListByName request. -func (client MetricAlertsStatusClient) ListByNamePreparer(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (*http.Request, error) { +func (client AlertsStatusClient) ListByNamePreparer(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "ruleName": autorest.Encode("path", ruleName), @@ -188,13 +187,13 @@ func (client MetricAlertsStatusClient) ListByNamePreparer(ctx context.Context, r // ListByNameSender sends the ListByName request. The method will close the // http.Response Body if it receives an error. -func (client MetricAlertsStatusClient) ListByNameSender(req *http.Request) (*http.Response, error) { +func (client AlertsStatusClient) ListByNameSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // ListByNameResponder handles the response to the ListByName request. The method always // closes the http.Response Body. -func (client MetricAlertsStatusClient) ListByNameResponder(resp *http.Response) (result MetricAlertStatusCollection, err error) { +func (client AlertsStatusClient) ListByNameResponder(resp *http.Response) (result AlertStatusCollection, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/metrics.go b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/baselines.go similarity index 56% rename from services/preview/monitor/mgmt/2021-04-01-preview/insights/metrics.go rename to services/preview/monitor/mgmt/2021-05-01-preview/metrics/baselines.go index 297183565d38..9ad5c9e5238a 100644 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/metrics.go +++ b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/baselines.go @@ -1,4 +1,4 @@ -package insights +package metrics // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,42 +10,36 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" "net/http" ) -// MetricsClient is the monitor Management Client -type MetricsClient struct { +// BaselinesClient is the monitor Management Client +type BaselinesClient struct { BaseClient } -// NewMetricsClient creates an instance of the MetricsClient client. -func NewMetricsClient(subscriptionID string) MetricsClient { - return NewMetricsClientWithBaseURI(DefaultBaseURI, subscriptionID) +// NewBaselinesClient creates an instance of the BaselinesClient client. +func NewBaselinesClient(subscriptionID string) BaselinesClient { + return NewBaselinesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// NewMetricsClientWithBaseURI creates an instance of the MetricsClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewMetricsClientWithBaseURI(baseURI string, subscriptionID string) MetricsClient { - return MetricsClient{NewWithBaseURI(baseURI, subscriptionID)} +// NewBaselinesClientWithBaseURI creates an instance of the BaselinesClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewBaselinesClientWithBaseURI(baseURI string, subscriptionID string) BaselinesClient { + return BaselinesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// List **Lists the metric values for a resource**. +// List **Lists the metric baseline values for a resource**. // Parameters: // resourceURI - the identifier of the resource. +// metricnames - the names of the metrics (comma separated) to retrieve. +// metricnamespace - metric namespace where the metrics you want reside. // timespan - the timespan of the query. It is a string with the following format // 'startDateTime_ISO/endDateTime_ISO'. // interval - the interval (i.e. timegrain) of the query. -// metricnames - the names of the metrics (comma separated) to retrieve. Special case: If a metricname itself -// has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be **'Metric%2Name1'** // aggregation - the list of aggregation types (comma separated) to retrieve. -// top - the maximum number of records to retrieve. -// Valid only if $filter is specified. -// Defaults to 10. -// orderby - the aggregation to use for sorting results and the direction of the sort. -// Only one order can be specified. -// Examples: sum asc. +// sensitivities - the list of sensitivities (comma separated) to retrieve. // 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 = @@ -56,12 +50,10 @@ func NewMetricsClientWithBaseURI(baseURI string, subscriptionID string) MetricsC // of using $filter= "dim (test) 1 eq '*' " use **$filter= "dim %2528test%2529 1 eq '*' "** When dimension name // is **dim (test) 3** and dimension value is **dim3 (test) val** Instead of using $filter= "dim (test) 3 eq // 'dim3 (test) val' " use **$filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "** -// resultType - reduces the set of data collected. The syntax allowed depends on the operation. See the -// operation's description for details. -// metricnamespace - metric namespace to query metric definitions for. -func (client MetricsClient) List(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType ResultType, metricnamespace string) (result Response, err error) { +// resultType - allows retrieving only metadata of the baseline. On data request all information is retrieved. +func (client BaselinesClient) List(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType ResultType) (result BaselinesResponse, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricsClient.List") + ctx = tracing.StartSpan(ctx, fqdn+"/BaselinesClient.List") defer func() { sc := -1 if result.Response.Response != nil { @@ -70,28 +62,22 @@ func (client MetricsClient) List(ctx context.Context, resourceURI string, timesp tracing.EndSpan(ctx, sc, err) }() } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceURI, - Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.MetricsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceURI, timespan, interval, metricnames, aggregation, top, orderby, filter, resultType, metricnamespace) + req, err := client.ListPreparer(ctx, resourceURI, metricnames, metricnamespace, timespan, interval, aggregation, sensitivities, filter, resultType) if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricsClient", "List", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "metrics.BaselinesClient", "List", nil, "Failure preparing request") return } resp, err := client.ListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricsClient", "List", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "metrics.BaselinesClient", "List", resp, "Failure sending request") return } result, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricsClient", "List", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "metrics.BaselinesClient", "List", resp, "Failure responding to request") return } @@ -99,32 +85,32 @@ func (client MetricsClient) List(ctx context.Context, resourceURI string, timesp } // ListPreparer prepares the List request. -func (client MetricsClient) ListPreparer(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType ResultType, metricnamespace string) (*http.Request, error) { +func (client BaselinesClient) ListPreparer(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType ResultType) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceUri": resourceURI, } - const APIVersion = "2018-01-01" + const APIVersion = "2019-03-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } + if len(metricnames) > 0 { + queryParameters["metricnames"] = autorest.Encode("query", metricnames) + } + if len(metricnamespace) > 0 { + queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) + } if len(timespan) > 0 { queryParameters["timespan"] = autorest.Encode("query", timespan) } if interval != nil { queryParameters["interval"] = autorest.Encode("query", *interval) } - if len(metricnames) > 0 { - queryParameters["metricnames"] = autorest.Encode("query", metricnames) - } if len(aggregation) > 0 { queryParameters["aggregation"] = autorest.Encode("query", aggregation) } - if top != nil { - queryParameters["top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["orderby"] = autorest.Encode("query", orderby) + if len(sensitivities) > 0 { + queryParameters["sensitivities"] = autorest.Encode("query", sensitivities) } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -132,27 +118,24 @@ func (client MetricsClient) ListPreparer(ctx context.Context, resourceURI string if len(string(resultType)) > 0 { queryParameters["resultType"] = autorest.Encode("query", resultType) } - if len(metricnamespace) > 0 { - queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) - } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metrics", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metricBaselines", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. -func (client MetricsClient) ListSender(req *http.Request) (*http.Response, error) { +func (client BaselinesClient) ListSender(req *http.Request) (*http.Response, error) { return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } // ListResponder handles the response to the List request. The method always // closes the http.Response Body. -func (client MetricsClient) ListResponder(resp *http.Response) (result Response, err error) { +func (client BaselinesClient) ListResponder(resp *http.Response) (result BaselinesResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/client.go b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/client.go similarity index 84% rename from services/preview/monitor/mgmt/2021-04-01-preview/insights/client.go rename to services/preview/monitor/mgmt/2021-05-01-preview/metrics/client.go index a777181b0785..5a64fd55cbc9 100644 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/client.go +++ b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/client.go @@ -1,7 +1,7 @@ -// Package insights implements the Azure ARM Insights service API version . +// Package metrics implements the Azure ARM Metrics service API version . // // Monitor Management Client -package insights +package metrics // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,11 +14,11 @@ import ( ) const ( - // DefaultBaseURI is the default URI used for the service Insights + // DefaultBaseURI is the default URI used for the service Metrics DefaultBaseURI = "https://management.azure.com" ) -// BaseClient is the base client for Insights. +// BaseClient is the base client for Metrics. type BaseClient struct { autorest.Client BaseURI string diff --git a/services/preview/monitor/mgmt/2021-05-01-preview/metrics/definitions.go b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/definitions.go new file mode 100644 index 000000000000..9e98238293bc --- /dev/null +++ b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/definitions.go @@ -0,0 +1,193 @@ +package metrics + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for 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 ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DefinitionsClient is the monitor Management Client +type DefinitionsClient struct { + BaseClient +} + +// NewDefinitionsClient creates an instance of the DefinitionsClient client. +func NewDefinitionsClient(subscriptionID string) DefinitionsClient { + return NewDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDefinitionsClientWithBaseURI creates an instance of the DefinitionsClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) DefinitionsClient { + return DefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists the metric definitions for the resource. +// Parameters: +// resourceURI - the identifier of the resource. +// metricnamespace - metric namespace where the metrics you want reside. +func (client DefinitionsClient) List(ctx context.Context, resourceURI string, metricnamespace string) (result DefinitionCollection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DefinitionsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, resourceURI, metricnamespace) + if err != nil { + err = autorest.NewErrorWithError(err, "metrics.DefinitionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "metrics.DefinitionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "metrics.DefinitionsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client DefinitionsClient) ListPreparer(ctx context.Context, resourceURI string, metricnamespace string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceUri": resourceURI, + } + + const APIVersion = "2021-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(metricnamespace) > 0 { + queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metricDefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DefinitionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DefinitionsClient) ListResponder(resp *http.Response) (result DefinitionCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAtSubscriptionScope lists the metric definitions for the subscription. +// Parameters: +// region - the region where the metrics you want reside. +// metricnamespace - metric namespace where the metrics you want reside. +func (client DefinitionsClient) ListAtSubscriptionScope(ctx context.Context, region string, metricnamespace string) (result SubscriptionScopeMetricDefinitionCollection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DefinitionsClient.ListAtSubscriptionScope") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("metrics.DefinitionsClient", "ListAtSubscriptionScope", err.Error()) + } + + req, err := client.ListAtSubscriptionScopePreparer(ctx, region, metricnamespace) + if err != nil { + err = autorest.NewErrorWithError(err, "metrics.DefinitionsClient", "ListAtSubscriptionScope", nil, "Failure preparing request") + return + } + + resp, err := client.ListAtSubscriptionScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "metrics.DefinitionsClient", "ListAtSubscriptionScope", resp, "Failure sending request") + return + } + + result, err = client.ListAtSubscriptionScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "metrics.DefinitionsClient", "ListAtSubscriptionScope", resp, "Failure responding to request") + return + } + + return +} + +// ListAtSubscriptionScopePreparer prepares the ListAtSubscriptionScope request. +func (client DefinitionsClient) ListAtSubscriptionScopePreparer(ctx context.Context, region string, metricnamespace string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "region": autorest.Encode("query", region), + } + if len(metricnamespace) > 0 { + queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricDefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAtSubscriptionScopeSender sends the ListAtSubscriptionScope request. The method will close the +// http.Response Body if it receives an error. +func (client DefinitionsClient) ListAtSubscriptionScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAtSubscriptionScopeResponder handles the response to the ListAtSubscriptionScope request. The method always +// closes the http.Response Body. +func (client DefinitionsClient) ListAtSubscriptionScopeResponder(resp *http.Response) (result SubscriptionScopeMetricDefinitionCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/monitor/mgmt/2021-05-01-preview/metrics/enums.go b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/enums.go new file mode 100644 index 000000000000..d2f00438a4d4 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/enums.go @@ -0,0 +1,324 @@ +package metrics + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// AggregationType enumerates the values for aggregation type. +type AggregationType string + +const ( + // Average ... + Average AggregationType = "Average" + // Count ... + Count AggregationType = "Count" + // Maximum ... + Maximum AggregationType = "Maximum" + // Minimum ... + Minimum AggregationType = "Minimum" + // None ... + None AggregationType = "None" + // Total ... + Total AggregationType = "Total" +) + +// PossibleAggregationTypeValues returns an array of possible values for the AggregationType const type. +func PossibleAggregationTypeValues() []AggregationType { + return []AggregationType{Average, Count, Maximum, Minimum, None, Total} +} + +// AggregationTypeEnum enumerates the values for aggregation type enum. +type AggregationTypeEnum string + +const ( + // AggregationTypeEnumAverage ... + AggregationTypeEnumAverage AggregationTypeEnum = "Average" + // AggregationTypeEnumCount ... + AggregationTypeEnumCount AggregationTypeEnum = "Count" + // AggregationTypeEnumMaximum ... + AggregationTypeEnumMaximum AggregationTypeEnum = "Maximum" + // AggregationTypeEnumMinimum ... + AggregationTypeEnumMinimum AggregationTypeEnum = "Minimum" + // AggregationTypeEnumTotal ... + AggregationTypeEnumTotal AggregationTypeEnum = "Total" +) + +// PossibleAggregationTypeEnumValues returns an array of possible values for the AggregationTypeEnum const type. +func PossibleAggregationTypeEnumValues() []AggregationTypeEnum { + return []AggregationTypeEnum{AggregationTypeEnumAverage, AggregationTypeEnumCount, AggregationTypeEnumMaximum, AggregationTypeEnumMinimum, AggregationTypeEnumTotal} +} + +// BaselineSensitivity enumerates the values for baseline sensitivity. +type BaselineSensitivity string + +const ( + // High ... + High BaselineSensitivity = "High" + // Low ... + Low BaselineSensitivity = "Low" + // Medium ... + Medium BaselineSensitivity = "Medium" +) + +// PossibleBaselineSensitivityValues returns an array of possible values for the BaselineSensitivity const type. +func PossibleBaselineSensitivityValues() []BaselineSensitivity { + return []BaselineSensitivity{High, Low, Medium} +} + +// CriterionType enumerates the values for criterion type. +type CriterionType string + +const ( + // CriterionTypeDynamicThresholdCriterion ... + CriterionTypeDynamicThresholdCriterion CriterionType = "DynamicThresholdCriterion" + // CriterionTypeMultiMetricCriteria ... + CriterionTypeMultiMetricCriteria CriterionType = "MultiMetricCriteria" + // CriterionTypeStaticThresholdCriterion ... + CriterionTypeStaticThresholdCriterion CriterionType = "StaticThresholdCriterion" +) + +// PossibleCriterionTypeValues returns an array of possible values for the CriterionType const type. +func PossibleCriterionTypeValues() []CriterionType { + return []CriterionType{CriterionTypeDynamicThresholdCriterion, CriterionTypeMultiMetricCriteria, CriterionTypeStaticThresholdCriterion} +} + +// DynamicThresholdOperator enumerates the values for dynamic threshold operator. +type DynamicThresholdOperator string + +const ( + // GreaterOrLessThan ... + GreaterOrLessThan DynamicThresholdOperator = "GreaterOrLessThan" + // GreaterThan ... + GreaterThan DynamicThresholdOperator = "GreaterThan" + // LessThan ... + LessThan DynamicThresholdOperator = "LessThan" +) + +// PossibleDynamicThresholdOperatorValues returns an array of possible values for the DynamicThresholdOperator const type. +func PossibleDynamicThresholdOperatorValues() []DynamicThresholdOperator { + return []DynamicThresholdOperator{GreaterOrLessThan, GreaterThan, LessThan} +} + +// DynamicThresholdSensitivity enumerates the values for dynamic threshold sensitivity. +type DynamicThresholdSensitivity string + +const ( + // DynamicThresholdSensitivityHigh ... + DynamicThresholdSensitivityHigh DynamicThresholdSensitivity = "High" + // DynamicThresholdSensitivityLow ... + DynamicThresholdSensitivityLow DynamicThresholdSensitivity = "Low" + // DynamicThresholdSensitivityMedium ... + DynamicThresholdSensitivityMedium DynamicThresholdSensitivity = "Medium" +) + +// PossibleDynamicThresholdSensitivityValues returns an array of possible values for the DynamicThresholdSensitivity const type. +func PossibleDynamicThresholdSensitivityValues() []DynamicThresholdSensitivity { + return []DynamicThresholdSensitivity{DynamicThresholdSensitivityHigh, DynamicThresholdSensitivityLow, DynamicThresholdSensitivityMedium} +} + +// MetricAggregationType enumerates the values for metric aggregation type. +type MetricAggregationType string + +const ( + // MetricAggregationTypeAverage ... + MetricAggregationTypeAverage MetricAggregationType = "Average" + // MetricAggregationTypeCount ... + MetricAggregationTypeCount MetricAggregationType = "Count" + // MetricAggregationTypeMaximum ... + MetricAggregationTypeMaximum MetricAggregationType = "Maximum" + // MetricAggregationTypeMinimum ... + MetricAggregationTypeMinimum MetricAggregationType = "Minimum" + // MetricAggregationTypeNone ... + MetricAggregationTypeNone MetricAggregationType = "None" + // MetricAggregationTypeTotal ... + MetricAggregationTypeTotal MetricAggregationType = "Total" +) + +// PossibleMetricAggregationTypeValues returns an array of possible values for the MetricAggregationType const type. +func PossibleMetricAggregationTypeValues() []MetricAggregationType { + return []MetricAggregationType{MetricAggregationTypeAverage, MetricAggregationTypeCount, MetricAggregationTypeMaximum, MetricAggregationTypeMinimum, MetricAggregationTypeNone, MetricAggregationTypeTotal} +} + +// MetricClass enumerates the values for metric class. +type MetricClass string + +const ( + // MetricClassAvailability ... + MetricClassAvailability MetricClass = "Availability" + // MetricClassErrors ... + MetricClassErrors MetricClass = "Errors" + // MetricClassLatency ... + MetricClassLatency MetricClass = "Latency" + // MetricClassSaturation ... + MetricClassSaturation MetricClass = "Saturation" + // MetricClassTransactions ... + MetricClassTransactions MetricClass = "Transactions" +) + +// PossibleMetricClassValues returns an array of possible values for the MetricClass const type. +func PossibleMetricClassValues() []MetricClass { + return []MetricClass{MetricClassAvailability, MetricClassErrors, MetricClassLatency, MetricClassSaturation, MetricClassTransactions} +} + +// MetricResultType enumerates the values for metric result type. +type MetricResultType string + +const ( + // Data ... + Data MetricResultType = "Data" + // Metadata ... + Metadata MetricResultType = "Metadata" +) + +// PossibleMetricResultTypeValues returns an array of possible values for the MetricResultType const type. +func PossibleMetricResultTypeValues() []MetricResultType { + return []MetricResultType{Data, Metadata} +} + +// MetricUnit enumerates the values for metric unit. +type MetricUnit string + +const ( + // MetricUnitBitsPerSecond ... + MetricUnitBitsPerSecond MetricUnit = "BitsPerSecond" + // MetricUnitBytes ... + MetricUnitBytes MetricUnit = "Bytes" + // MetricUnitByteSeconds ... + MetricUnitByteSeconds MetricUnit = "ByteSeconds" + // MetricUnitBytesPerSecond ... + MetricUnitBytesPerSecond MetricUnit = "BytesPerSecond" + // MetricUnitCores ... + MetricUnitCores MetricUnit = "Cores" + // MetricUnitCount ... + MetricUnitCount MetricUnit = "Count" + // MetricUnitCountPerSecond ... + MetricUnitCountPerSecond MetricUnit = "CountPerSecond" + // MetricUnitMilliCores ... + MetricUnitMilliCores MetricUnit = "MilliCores" + // MetricUnitMilliSeconds ... + MetricUnitMilliSeconds MetricUnit = "MilliSeconds" + // MetricUnitNanoCores ... + MetricUnitNanoCores MetricUnit = "NanoCores" + // MetricUnitPercent ... + MetricUnitPercent MetricUnit = "Percent" + // MetricUnitSeconds ... + MetricUnitSeconds MetricUnit = "Seconds" + // MetricUnitUnspecified ... + MetricUnitUnspecified MetricUnit = "Unspecified" +) + +// PossibleMetricUnitValues returns an array of possible values for the MetricUnit const type. +func PossibleMetricUnitValues() []MetricUnit { + return []MetricUnit{MetricUnitBitsPerSecond, MetricUnitBytes, MetricUnitByteSeconds, MetricUnitBytesPerSecond, MetricUnitCores, MetricUnitCount, MetricUnitCountPerSecond, MetricUnitMilliCores, MetricUnitMilliSeconds, MetricUnitNanoCores, MetricUnitPercent, MetricUnitSeconds, MetricUnitUnspecified} +} + +// NamespaceClassification enumerates the values for namespace classification. +type NamespaceClassification string + +const ( + // Custom ... + Custom NamespaceClassification = "Custom" + // Platform ... + Platform NamespaceClassification = "Platform" + // Qos ... + Qos NamespaceClassification = "Qos" +) + +// PossibleNamespaceClassificationValues returns an array of possible values for the NamespaceClassification const type. +func PossibleNamespaceClassificationValues() []NamespaceClassification { + return []NamespaceClassification{Custom, Platform, Qos} +} + +// OdataType enumerates the values for odata type. +type OdataType string + +const ( + // OdataTypeMetricAlertCriteria ... + OdataTypeMetricAlertCriteria OdataType = "MetricAlertCriteria" + // OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria ... + OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria OdataType = "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria" + // OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria ... + OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria OdataType = "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria" + // OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria ... + OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria OdataType = "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria" +) + +// PossibleOdataTypeValues returns an array of possible values for the OdataType const type. +func PossibleOdataTypeValues() []OdataType { + return []OdataType{OdataTypeMetricAlertCriteria, OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria, OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria, OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria} +} + +// Operator enumerates the values for operator. +type Operator string + +const ( + // OperatorEquals ... + OperatorEquals Operator = "Equals" + // OperatorGreaterThan ... + OperatorGreaterThan Operator = "GreaterThan" + // OperatorGreaterThanOrEqual ... + OperatorGreaterThanOrEqual Operator = "GreaterThanOrEqual" + // OperatorLessThan ... + OperatorLessThan Operator = "LessThan" + // OperatorLessThanOrEqual ... + OperatorLessThanOrEqual Operator = "LessThanOrEqual" +) + +// PossibleOperatorValues returns an array of possible values for the Operator const type. +func PossibleOperatorValues() []Operator { + return []Operator{OperatorEquals, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorLessThan, OperatorLessThanOrEqual} +} + +// ResultType enumerates the values for result type. +type ResultType string + +const ( + // ResultTypeData ... + ResultTypeData ResultType = "Data" + // ResultTypeMetadata ... + ResultTypeMetadata ResultType = "Metadata" +) + +// PossibleResultTypeValues returns an array of possible values for the ResultType const type. +func PossibleResultTypeValues() []ResultType { + return []ResultType{ResultTypeData, ResultTypeMetadata} +} + +// Unit enumerates the values for unit. +type Unit string + +const ( + // UnitBitsPerSecond ... + UnitBitsPerSecond Unit = "BitsPerSecond" + // UnitBytes ... + UnitBytes Unit = "Bytes" + // UnitByteSeconds ... + UnitByteSeconds Unit = "ByteSeconds" + // UnitBytesPerSecond ... + UnitBytesPerSecond Unit = "BytesPerSecond" + // UnitCores ... + UnitCores Unit = "Cores" + // UnitCount ... + UnitCount Unit = "Count" + // UnitCountPerSecond ... + UnitCountPerSecond Unit = "CountPerSecond" + // UnitMilliCores ... + UnitMilliCores Unit = "MilliCores" + // UnitMilliSeconds ... + UnitMilliSeconds Unit = "MilliSeconds" + // UnitNanoCores ... + UnitNanoCores Unit = "NanoCores" + // UnitPercent ... + UnitPercent Unit = "Percent" + // UnitSeconds ... + UnitSeconds Unit = "Seconds" + // UnitUnspecified ... + UnitUnspecified Unit = "Unspecified" +) + +// PossibleUnitValues returns an array of possible values for the Unit const type. +func PossibleUnitValues() []Unit { + return []Unit{UnitBitsPerSecond, UnitBytes, UnitByteSeconds, UnitBytesPerSecond, UnitCores, UnitCount, UnitCountPerSecond, UnitMilliCores, UnitMilliSeconds, UnitNanoCores, UnitPercent, UnitSeconds, UnitUnspecified} +} diff --git a/services/preview/monitor/mgmt/2021-05-01-preview/metrics/metrics.go b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/metrics.go new file mode 100644 index 000000000000..f6839198ed00 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/metrics.go @@ -0,0 +1,449 @@ +package metrics + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for 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 ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// Client is the monitor Management Client +type Client struct { + BaseClient +} + +// NewClient creates an instance of the Client client. +func NewClient(subscriptionID string) Client { + return NewClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClientWithBaseURI creates an instance of the Client client using a custom endpoint. Use this when interacting +// with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewClientWithBaseURI(baseURI string, subscriptionID string) Client { + return Client{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List **Lists the metric values for a resource**. +// Parameters: +// resourceURI - the identifier of the resource. +// timespan - the timespan of the query. It is a string with the following format +// 'startDateTime_ISO/endDateTime_ISO'. +// interval - the interval (i.e. timegrain) of the query. +// metricnames - the names of the metrics (comma separated) to retrieve. +// aggregation - the list of aggregation types (comma separated) to retrieve. +// top - the maximum number of records to retrieve. +// Valid only if $filter is specified. +// Defaults to 10. +// orderby - the aggregation to use for sorting results and the direction of the sort. +// Only one order can be specified. +// Examples: sum asc. +// 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 +// ‘*’**. +// resultType - reduces the set of data collected. The syntax allowed depends on the operation. See the +// operation's description for details. +// metricnamespace - metric namespace where the metrics you want reside. +// autoAdjustTimegrain - when set to true, if the timespan passed in is not supported by this metric, the API +// will return the result using the closest supported timespan. When set to false, an error is returned for +// invalid timespan parameters. Defaults to false. +// validateDimensions - when set to false, invalid filter parameter values will be ignored. When set to true, +// an error is returned for invalid filter parameters. Defaults to true. +func (client Client) List(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType ResultType, metricnamespace string, autoAdjustTimegrain *bool, validateDimensions *bool) (result Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, resourceURI, timespan, interval, metricnames, aggregation, top, orderby, filter, resultType, metricnamespace, autoAdjustTimegrain, validateDimensions) + if err != nil { + err = autorest.NewErrorWithError(err, "metrics.Client", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "metrics.Client", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "metrics.Client", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client Client) ListPreparer(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType ResultType, metricnamespace string, autoAdjustTimegrain *bool, validateDimensions *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceUri": resourceURI, + } + + const APIVersion = "2021-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(timespan) > 0 { + queryParameters["timespan"] = autorest.Encode("query", timespan) + } + if interval != nil { + queryParameters["interval"] = autorest.Encode("query", *interval) + } + if len(metricnames) > 0 { + queryParameters["metricnames"] = autorest.Encode("query", metricnames) + } + if len(aggregation) > 0 { + queryParameters["aggregation"] = autorest.Encode("query", aggregation) + } + if top != nil { + queryParameters["top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["orderby"] = autorest.Encode("query", orderby) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(string(resultType)) > 0 { + queryParameters["resultType"] = autorest.Encode("query", resultType) + } + if len(metricnamespace) > 0 { + queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) + } + if autoAdjustTimegrain != nil { + queryParameters["AutoAdjustTimegrain"] = autorest.Encode("query", *autoAdjustTimegrain) + } + if validateDimensions != nil { + queryParameters["ValidateDimensions"] = autorest.Encode("query", *validateDimensions) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client Client) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client Client) ListResponder(resp *http.Response) (result Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAtSubscriptionScope **Lists the metric data for a subscription**. +// Parameters: +// region - the region where the metrics you want reside. +// timespan - the timespan of the query. It is a string with the following format +// 'startDateTime_ISO/endDateTime_ISO'. +// interval - the interval (i.e. timegrain) of the query. +// metricnames - the names of the metrics (comma separated) to retrieve. +// aggregation - the list of aggregation types (comma separated) to retrieve. +// top - the maximum number of records to retrieve. +// Valid only if $filter is specified. +// Defaults to 10. +// orderby - the aggregation to use for sorting results and the direction of the sort. +// Only one order can be specified. +// Examples: sum asc. +// 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 +// ‘*’**. +// resultType - reduces the set of data collected. The syntax allowed depends on the operation. See the +// operation's description for details. +// metricnamespace - metric namespace where the metrics you want reside. +// autoAdjustTimegrain - when set to true, if the timespan passed in is not supported by this metric, the API +// will return the result using the closest supported timespan. When set to false, an error is returned for +// invalid timespan parameters. Defaults to false. +// validateDimensions - when set to false, invalid filter parameter values will be ignored. When set to true, +// an error is returned for invalid filter parameters. Defaults to true. +func (client Client) ListAtSubscriptionScope(ctx context.Context, region string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType MetricResultType, metricnamespace string, autoAdjustTimegrain *bool, validateDimensions *bool) (result SubscriptionScopeMetricResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListAtSubscriptionScope") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("metrics.Client", "ListAtSubscriptionScope", err.Error()) + } + + req, err := client.ListAtSubscriptionScopePreparer(ctx, region, timespan, interval, metricnames, aggregation, top, orderby, filter, resultType, metricnamespace, autoAdjustTimegrain, validateDimensions) + if err != nil { + err = autorest.NewErrorWithError(err, "metrics.Client", "ListAtSubscriptionScope", nil, "Failure preparing request") + return + } + + resp, err := client.ListAtSubscriptionScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "metrics.Client", "ListAtSubscriptionScope", resp, "Failure sending request") + return + } + + result, err = client.ListAtSubscriptionScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "metrics.Client", "ListAtSubscriptionScope", resp, "Failure responding to request") + return + } + + return +} + +// ListAtSubscriptionScopePreparer prepares the ListAtSubscriptionScope request. +func (client Client) ListAtSubscriptionScopePreparer(ctx context.Context, region string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType MetricResultType, metricnamespace string, autoAdjustTimegrain *bool, validateDimensions *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "region": autorest.Encode("query", region), + } + if len(timespan) > 0 { + queryParameters["timespan"] = autorest.Encode("query", timespan) + } + if interval != nil { + queryParameters["interval"] = autorest.Encode("query", *interval) + } + if len(metricnames) > 0 { + queryParameters["metricnames"] = autorest.Encode("query", metricnames) + } + if len(aggregation) > 0 { + queryParameters["aggregation"] = autorest.Encode("query", aggregation) + } + if top != nil { + queryParameters["top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["orderby"] = autorest.Encode("query", orderby) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(string(resultType)) > 0 { + queryParameters["resultType"] = autorest.Encode("query", resultType) + } + if len(metricnamespace) > 0 { + queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) + } + if autoAdjustTimegrain != nil { + queryParameters["AutoAdjustTimegrain"] = autorest.Encode("query", *autoAdjustTimegrain) + } + if validateDimensions != nil { + queryParameters["ValidateDimensions"] = autorest.Encode("query", *validateDimensions) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAtSubscriptionScopeSender sends the ListAtSubscriptionScope request. The method will close the +// http.Response Body if it receives an error. +func (client Client) ListAtSubscriptionScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAtSubscriptionScopeResponder handles the response to the ListAtSubscriptionScope request. The method always +// closes the http.Response Body. +func (client Client) ListAtSubscriptionScopeResponder(resp *http.Response) (result SubscriptionScopeMetricResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAtSubscriptionScopePost **Lists the metric data for a subscription**. Parameters can be specified on either +// query params or the body. +// Parameters: +// region - the region where the metrics you want reside. +// timespan - the timespan of the query. It is a string with the following format +// 'startDateTime_ISO/endDateTime_ISO'. +// interval - the interval (i.e. timegrain) of the query. +// metricnames - the names of the metrics (comma separated) to retrieve. +// aggregation - the list of aggregation types (comma separated) to retrieve. +// top - the maximum number of records to retrieve. +// Valid only if $filter is specified. +// Defaults to 10. +// orderby - the aggregation to use for sorting results and the direction of the sort. +// Only one order can be specified. +// Examples: sum asc. +// 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 +// ‘*’**. +// resultType - reduces the set of data collected. The syntax allowed depends on the operation. See the +// operation's description for details. +// metricnamespace - metric namespace where the metrics you want reside. +// autoAdjustTimegrain - when set to true, if the timespan passed in is not supported by this metric, the API +// will return the result using the closest supported timespan. When set to false, an error is returned for +// invalid timespan parameters. Defaults to false. +// validateDimensions - when set to false, invalid filter parameter values will be ignored. When set to true, +// an error is returned for invalid filter parameters. Defaults to true. +// body - parameters serialized in the body +func (client Client) ListAtSubscriptionScopePost(ctx context.Context, region string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType MetricResultType, metricnamespace string, autoAdjustTimegrain *bool, validateDimensions *bool, body *SubscriptionScopeMetricsRequestBodyParameters) (result SubscriptionScopeMetricResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListAtSubscriptionScopePost") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("metrics.Client", "ListAtSubscriptionScopePost", err.Error()) + } + + req, err := client.ListAtSubscriptionScopePostPreparer(ctx, region, timespan, interval, metricnames, aggregation, top, orderby, filter, resultType, metricnamespace, autoAdjustTimegrain, validateDimensions, body) + if err != nil { + err = autorest.NewErrorWithError(err, "metrics.Client", "ListAtSubscriptionScopePost", nil, "Failure preparing request") + return + } + + resp, err := client.ListAtSubscriptionScopePostSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "metrics.Client", "ListAtSubscriptionScopePost", resp, "Failure sending request") + return + } + + result, err = client.ListAtSubscriptionScopePostResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "metrics.Client", "ListAtSubscriptionScopePost", resp, "Failure responding to request") + return + } + + return +} + +// ListAtSubscriptionScopePostPreparer prepares the ListAtSubscriptionScopePost request. +func (client Client) ListAtSubscriptionScopePostPreparer(ctx context.Context, region string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType MetricResultType, metricnamespace string, autoAdjustTimegrain *bool, validateDimensions *bool, body *SubscriptionScopeMetricsRequestBodyParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "region": autorest.Encode("query", region), + } + if len(timespan) > 0 { + queryParameters["timespan"] = autorest.Encode("query", timespan) + } + if interval != nil { + queryParameters["interval"] = autorest.Encode("query", *interval) + } + if len(metricnames) > 0 { + queryParameters["metricnames"] = autorest.Encode("query", metricnames) + } + if len(aggregation) > 0 { + queryParameters["aggregation"] = autorest.Encode("query", aggregation) + } + if top != nil { + queryParameters["top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["orderby"] = autorest.Encode("query", orderby) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(string(resultType)) > 0 { + queryParameters["resultType"] = autorest.Encode("query", resultType) + } + if len(metricnamespace) > 0 { + queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) + } + if autoAdjustTimegrain != nil { + queryParameters["AutoAdjustTimegrain"] = autorest.Encode("query", *autoAdjustTimegrain) + } + if validateDimensions != nil { + queryParameters["ValidateDimensions"] = autorest.Encode("query", *validateDimensions) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if body != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(body)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAtSubscriptionScopePostSender sends the ListAtSubscriptionScopePost request. The method will close the +// http.Response Body if it receives an error. +func (client Client) ListAtSubscriptionScopePostSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAtSubscriptionScopePostResponder handles the response to the ListAtSubscriptionScopePost request. The method always +// closes the http.Response Body. +func (client Client) ListAtSubscriptionScopePostResponder(resp *http.Response) (result SubscriptionScopeMetricResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/monitor/mgmt/2021-05-01-preview/metrics/metricsapi/interfaces.go b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/metricsapi/interfaces.go new file mode 100644 index 000000000000..2c42fd2db71f --- /dev/null +++ b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/metricsapi/interfaces.go @@ -0,0 +1,71 @@ +package metricsapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for 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 ( + "context" + "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-05-01-preview/metrics" + "github.com/Azure/go-autorest/autorest" +) + +// NamespacesClientAPI contains the set of methods on the NamespacesClient type. +type NamespacesClientAPI interface { + List(ctx context.Context, resourceURI string, startTime string) (result metrics.NamespaceCollection, err error) +} + +var _ NamespacesClientAPI = (*metrics.NamespacesClient)(nil) + +// AlertsClientAPI contains the set of methods on the AlertsClient type. +type AlertsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters metrics.AlertResource) (result metrics.AlertResource, err error) + Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, ruleName string) (result metrics.AlertResource, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result metrics.AlertResourceCollection, err error) + ListBySubscription(ctx context.Context) (result metrics.AlertResourceCollection, err error) + Update(ctx context.Context, resourceGroupName string, ruleName string, parameters metrics.AlertResourcePatch) (result metrics.AlertResource, err error) +} + +var _ AlertsClientAPI = (*metrics.AlertsClient)(nil) + +// AlertsStatusClientAPI contains the set of methods on the AlertsStatusClient type. +type AlertsStatusClientAPI interface { + List(ctx context.Context, resourceGroupName string, ruleName string) (result metrics.AlertStatusCollection, err error) + ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (result metrics.AlertStatusCollection, err error) +} + +var _ AlertsStatusClientAPI = (*metrics.AlertsStatusClient)(nil) + +// BaselinesClientAPI contains the set of methods on the BaselinesClient type. +type BaselinesClientAPI interface { + List(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType metrics.ResultType) (result metrics.BaselinesResponse, err error) +} + +var _ BaselinesClientAPI = (*metrics.BaselinesClient)(nil) + +// DefinitionsClientAPI contains the set of methods on the DefinitionsClient type. +type DefinitionsClientAPI interface { + List(ctx context.Context, resourceURI string, metricnamespace string) (result metrics.DefinitionCollection, err error) + ListAtSubscriptionScope(ctx context.Context, region string, metricnamespace string) (result metrics.SubscriptionScopeMetricDefinitionCollection, err error) +} + +var _ DefinitionsClientAPI = (*metrics.DefinitionsClient)(nil) + +// ClientAPI contains the set of methods on the Client type. +type ClientAPI interface { + List(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType metrics.ResultType, metricnamespace string, autoAdjustTimegrain *bool, validateDimensions *bool) (result metrics.Response, err error) + ListAtSubscriptionScope(ctx context.Context, region string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType metrics.MetricResultType, metricnamespace string, autoAdjustTimegrain *bool, validateDimensions *bool) (result metrics.SubscriptionScopeMetricResponse, err error) + ListAtSubscriptionScopePost(ctx context.Context, region string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType metrics.MetricResultType, metricnamespace string, autoAdjustTimegrain *bool, validateDimensions *bool, body *metrics.SubscriptionScopeMetricsRequestBodyParameters) (result metrics.SubscriptionScopeMetricResponse, err error) +} + +var _ ClientAPI = (*metrics.Client)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result metrics.OperationListResult, err error) +} + +var _ OperationsClientAPI = (*metrics.OperationsClient)(nil) diff --git a/services/preview/monitor/mgmt/2021-05-01-preview/metrics/models.go b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/models.go new file mode 100644 index 000000000000..dfdd0bf50f5d --- /dev/null +++ b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/models.go @@ -0,0 +1,2336 @@ +package metrics + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for 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 ( + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-05-01-preview/metrics" + +// AlertAction an alert action. +type AlertAction struct { + // ActionGroupID - the id of the action group to use. + ActionGroupID *string `json:"actionGroupId,omitempty"` + // WebHookProperties - This field allows specifying custom properties, which would be appended to the alert payload sent as input to the webhook. + WebHookProperties map[string]*string `json:"webHookProperties"` +} + +// MarshalJSON is the custom marshaler for AlertAction. +func (aa AlertAction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aa.ActionGroupID != nil { + objectMap["actionGroupId"] = aa.ActionGroupID + } + if aa.WebHookProperties != nil { + objectMap["webHookProperties"] = aa.WebHookProperties + } + return json.Marshal(objectMap) +} + +// BasicAlertCriteria the rule criteria that defines the conditions of the alert rule. +type BasicAlertCriteria interface { + AsAlertSingleResourceMultipleMetricCriteria() (*AlertSingleResourceMultipleMetricCriteria, bool) + AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) + AsAlertMultipleResourceMultipleMetricCriteria() (*AlertMultipleResourceMultipleMetricCriteria, bool) + AsAlertCriteria() (*AlertCriteria, bool) +} + +// AlertCriteria the rule criteria that defines the conditions of the alert rule. +type AlertCriteria struct { + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' + OdataType OdataType `json:"odata.type,omitempty"` +} + +func unmarshalBasicAlertCriteria(body []byte) (BasicAlertCriteria, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["odata.type"] { + case string(OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria): + var asrmmc AlertSingleResourceMultipleMetricCriteria + err := json.Unmarshal(body, &asrmmc) + return asrmmc, err + case string(OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria): + var wlac WebtestLocationAvailabilityCriteria + err := json.Unmarshal(body, &wlac) + return wlac, err + case string(OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria): + var amrmmc AlertMultipleResourceMultipleMetricCriteria + err := json.Unmarshal(body, &amrmmc) + return amrmmc, err + default: + var ac AlertCriteria + err := json.Unmarshal(body, &ac) + return ac, err + } +} +func unmarshalBasicAlertCriteriaArray(body []byte) ([]BasicAlertCriteria, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + acArray := make([]BasicAlertCriteria, len(rawMessages)) + + for index, rawMessage := range rawMessages { + ac, err := unmarshalBasicAlertCriteria(*rawMessage) + if err != nil { + return nil, err + } + acArray[index] = ac + } + return acArray, nil +} + +// MarshalJSON is the custom marshaler for AlertCriteria. +func (ac AlertCriteria) MarshalJSON() ([]byte, error) { + ac.OdataType = OdataTypeMetricAlertCriteria + objectMap := make(map[string]interface{}) + if ac.OdataType != "" { + objectMap["odata.type"] = ac.OdataType + } + for k, v := range ac.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// AsAlertSingleResourceMultipleMetricCriteria is the BasicAlertCriteria implementation for AlertCriteria. +func (ac AlertCriteria) AsAlertSingleResourceMultipleMetricCriteria() (*AlertSingleResourceMultipleMetricCriteria, bool) { + return nil, false +} + +// AsWebtestLocationAvailabilityCriteria is the BasicAlertCriteria implementation for AlertCriteria. +func (ac AlertCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { + return nil, false +} + +// AsAlertMultipleResourceMultipleMetricCriteria is the BasicAlertCriteria implementation for AlertCriteria. +func (ac AlertCriteria) AsAlertMultipleResourceMultipleMetricCriteria() (*AlertMultipleResourceMultipleMetricCriteria, bool) { + return nil, false +} + +// AsAlertCriteria is the BasicAlertCriteria implementation for AlertCriteria. +func (ac AlertCriteria) AsAlertCriteria() (*AlertCriteria, bool) { + return &ac, true +} + +// AsBasicAlertCriteria is the BasicAlertCriteria implementation for AlertCriteria. +func (ac AlertCriteria) AsBasicAlertCriteria() (BasicAlertCriteria, bool) { + return &ac, true +} + +// UnmarshalJSON is the custom unmarshaler for AlertCriteria struct. +func (ac *AlertCriteria) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + default: + if v != nil { + var additionalProperties interface{} + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if ac.AdditionalProperties == nil { + ac.AdditionalProperties = make(map[string]interface{}) + } + ac.AdditionalProperties[k] = additionalProperties + } + case "odata.type": + if v != nil { + var odataType OdataType + err = json.Unmarshal(*v, &odataType) + if err != nil { + return err + } + ac.OdataType = odataType + } + } + } + + return nil +} + +// AlertMultipleResourceMultipleMetricCriteria specifies the metric alert criteria for multiple resource +// that has multiple metric criteria. +type AlertMultipleResourceMultipleMetricCriteria struct { + // AllOf - the list of multiple metric criteria for this 'all of' operation. + AllOf *[]BasicMultiMetricCriteria `json:"allOf,omitempty"` + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' + OdataType OdataType `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AlertMultipleResourceMultipleMetricCriteria. +func (amrmmc AlertMultipleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { + amrmmc.OdataType = OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria + objectMap := make(map[string]interface{}) + if amrmmc.AllOf != nil { + objectMap["allOf"] = amrmmc.AllOf + } + if amrmmc.OdataType != "" { + objectMap["odata.type"] = amrmmc.OdataType + } + for k, v := range amrmmc.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// AsAlertSingleResourceMultipleMetricCriteria is the BasicAlertCriteria implementation for AlertMultipleResourceMultipleMetricCriteria. +func (amrmmc AlertMultipleResourceMultipleMetricCriteria) AsAlertSingleResourceMultipleMetricCriteria() (*AlertSingleResourceMultipleMetricCriteria, bool) { + return nil, false +} + +// AsWebtestLocationAvailabilityCriteria is the BasicAlertCriteria implementation for AlertMultipleResourceMultipleMetricCriteria. +func (amrmmc AlertMultipleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { + return nil, false +} + +// AsAlertMultipleResourceMultipleMetricCriteria is the BasicAlertCriteria implementation for AlertMultipleResourceMultipleMetricCriteria. +func (amrmmc AlertMultipleResourceMultipleMetricCriteria) AsAlertMultipleResourceMultipleMetricCriteria() (*AlertMultipleResourceMultipleMetricCriteria, bool) { + return &amrmmc, true +} + +// AsAlertCriteria is the BasicAlertCriteria implementation for AlertMultipleResourceMultipleMetricCriteria. +func (amrmmc AlertMultipleResourceMultipleMetricCriteria) AsAlertCriteria() (*AlertCriteria, bool) { + return nil, false +} + +// AsBasicAlertCriteria is the BasicAlertCriteria implementation for AlertMultipleResourceMultipleMetricCriteria. +func (amrmmc AlertMultipleResourceMultipleMetricCriteria) AsBasicAlertCriteria() (BasicAlertCriteria, bool) { + return &amrmmc, true +} + +// UnmarshalJSON is the custom unmarshaler for AlertMultipleResourceMultipleMetricCriteria struct. +func (amrmmc *AlertMultipleResourceMultipleMetricCriteria) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "allOf": + if v != nil { + allOf, err := unmarshalBasicMultiMetricCriteriaArray(*v) + if err != nil { + return err + } + amrmmc.AllOf = &allOf + } + default: + if v != nil { + var additionalProperties interface{} + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if amrmmc.AdditionalProperties == nil { + amrmmc.AdditionalProperties = make(map[string]interface{}) + } + amrmmc.AdditionalProperties[k] = additionalProperties + } + case "odata.type": + if v != nil { + var odataType OdataType + err = json.Unmarshal(*v, &odataType) + if err != nil { + return err + } + amrmmc.OdataType = odataType + } + } + } + + return nil +} + +// AlertProperties an alert rule. +type AlertProperties struct { + // Description - the description of the metric alert that will be included in the alert email. + Description *string `json:"description,omitempty"` + // Severity - Alert severity {0, 1, 2, 3, 4} + Severity *int32 `json:"severity,omitempty"` + // Enabled - the flag that indicates whether the metric alert is enabled. + Enabled *bool `json:"enabled,omitempty"` + // Scopes - the list of resource id's that this metric alert is scoped to. + Scopes *[]string `json:"scopes,omitempty"` + // EvaluationFrequency - how often the metric alert is evaluated represented in ISO 8601 duration format. + EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` + // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. + WindowSize *string `json:"windowSize,omitempty"` + // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource. + TargetResourceType *string `json:"targetResourceType,omitempty"` + // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource. + TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` + // Criteria - defines the specific alert criteria information. + Criteria BasicAlertCriteria `json:"criteria,omitempty"` + // AutoMitigate - the flag that indicates whether the alert should be auto resolved or not. The default is true. + AutoMitigate *bool `json:"autoMitigate,omitempty"` + // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + Actions *[]AlertAction `json:"actions,omitempty"` + // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. + LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` + // IsMigrated - READ-ONLY; the value indicating whether this alert rule is migrated. + IsMigrated *bool `json:"isMigrated,omitempty"` +} + +// MarshalJSON is the custom marshaler for AlertProperties. +func (ap AlertProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ap.Description != nil { + objectMap["description"] = ap.Description + } + if ap.Severity != nil { + objectMap["severity"] = ap.Severity + } + if ap.Enabled != nil { + objectMap["enabled"] = ap.Enabled + } + if ap.Scopes != nil { + objectMap["scopes"] = ap.Scopes + } + if ap.EvaluationFrequency != nil { + objectMap["evaluationFrequency"] = ap.EvaluationFrequency + } + if ap.WindowSize != nil { + objectMap["windowSize"] = ap.WindowSize + } + if ap.TargetResourceType != nil { + objectMap["targetResourceType"] = ap.TargetResourceType + } + if ap.TargetResourceRegion != nil { + objectMap["targetResourceRegion"] = ap.TargetResourceRegion + } + objectMap["criteria"] = ap.Criteria + if ap.AutoMitigate != nil { + objectMap["autoMitigate"] = ap.AutoMitigate + } + if ap.Actions != nil { + objectMap["actions"] = ap.Actions + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AlertProperties struct. +func (ap *AlertProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + ap.Description = &description + } + case "severity": + if v != nil { + var severity int32 + err = json.Unmarshal(*v, &severity) + if err != nil { + return err + } + ap.Severity = &severity + } + case "enabled": + if v != nil { + var enabled bool + err = json.Unmarshal(*v, &enabled) + if err != nil { + return err + } + ap.Enabled = &enabled + } + case "scopes": + if v != nil { + var scopes []string + err = json.Unmarshal(*v, &scopes) + if err != nil { + return err + } + ap.Scopes = &scopes + } + case "evaluationFrequency": + if v != nil { + var evaluationFrequency string + err = json.Unmarshal(*v, &evaluationFrequency) + if err != nil { + return err + } + ap.EvaluationFrequency = &evaluationFrequency + } + case "windowSize": + if v != nil { + var windowSize string + err = json.Unmarshal(*v, &windowSize) + if err != nil { + return err + } + ap.WindowSize = &windowSize + } + case "targetResourceType": + if v != nil { + var targetResourceType string + err = json.Unmarshal(*v, &targetResourceType) + if err != nil { + return err + } + ap.TargetResourceType = &targetResourceType + } + case "targetResourceRegion": + if v != nil { + var targetResourceRegion string + err = json.Unmarshal(*v, &targetResourceRegion) + if err != nil { + return err + } + ap.TargetResourceRegion = &targetResourceRegion + } + case "criteria": + if v != nil { + criteria, err := unmarshalBasicAlertCriteria(*v) + if err != nil { + return err + } + ap.Criteria = criteria + } + case "autoMitigate": + if v != nil { + var autoMitigate bool + err = json.Unmarshal(*v, &autoMitigate) + if err != nil { + return err + } + ap.AutoMitigate = &autoMitigate + } + case "actions": + if v != nil { + var actions []AlertAction + err = json.Unmarshal(*v, &actions) + if err != nil { + return err + } + ap.Actions = &actions + } + case "lastUpdatedTime": + if v != nil { + var lastUpdatedTime date.Time + err = json.Unmarshal(*v, &lastUpdatedTime) + if err != nil { + return err + } + ap.LastUpdatedTime = &lastUpdatedTime + } + case "isMigrated": + if v != nil { + var isMigrated bool + err = json.Unmarshal(*v, &isMigrated) + if err != nil { + return err + } + ap.IsMigrated = &isMigrated + } + } + } + + return nil +} + +// AlertPropertiesPatch an alert rule properties for patch. +type AlertPropertiesPatch struct { + // Description - the description of the metric alert that will be included in the alert email. + Description *string `json:"description,omitempty"` + // Severity - Alert severity {0, 1, 2, 3, 4} + Severity *int32 `json:"severity,omitempty"` + // Enabled - the flag that indicates whether the metric alert is enabled. + Enabled *bool `json:"enabled,omitempty"` + // Scopes - the list of resource id's that this metric alert is scoped to. + Scopes *[]string `json:"scopes,omitempty"` + // EvaluationFrequency - how often the metric alert is evaluated represented in ISO 8601 duration format. + EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` + // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. + WindowSize *string `json:"windowSize,omitempty"` + // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + TargetResourceType *string `json:"targetResourceType,omitempty"` + // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` + // Criteria - defines the specific alert criteria information. + Criteria BasicAlertCriteria `json:"criteria,omitempty"` + // AutoMitigate - the flag that indicates whether the alert should be auto resolved or not. The default is true. + AutoMitigate *bool `json:"autoMitigate,omitempty"` + // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + Actions *[]AlertAction `json:"actions,omitempty"` + // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. + LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` + // IsMigrated - READ-ONLY; the value indicating whether this alert rule is migrated. + IsMigrated *bool `json:"isMigrated,omitempty"` +} + +// MarshalJSON is the custom marshaler for AlertPropertiesPatch. +func (app AlertPropertiesPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if app.Description != nil { + objectMap["description"] = app.Description + } + if app.Severity != nil { + objectMap["severity"] = app.Severity + } + if app.Enabled != nil { + objectMap["enabled"] = app.Enabled + } + if app.Scopes != nil { + objectMap["scopes"] = app.Scopes + } + if app.EvaluationFrequency != nil { + objectMap["evaluationFrequency"] = app.EvaluationFrequency + } + if app.WindowSize != nil { + objectMap["windowSize"] = app.WindowSize + } + if app.TargetResourceType != nil { + objectMap["targetResourceType"] = app.TargetResourceType + } + if app.TargetResourceRegion != nil { + objectMap["targetResourceRegion"] = app.TargetResourceRegion + } + objectMap["criteria"] = app.Criteria + if app.AutoMitigate != nil { + objectMap["autoMitigate"] = app.AutoMitigate + } + if app.Actions != nil { + objectMap["actions"] = app.Actions + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AlertPropertiesPatch struct. +func (app *AlertPropertiesPatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + app.Description = &description + } + case "severity": + if v != nil { + var severity int32 + err = json.Unmarshal(*v, &severity) + if err != nil { + return err + } + app.Severity = &severity + } + case "enabled": + if v != nil { + var enabled bool + err = json.Unmarshal(*v, &enabled) + if err != nil { + return err + } + app.Enabled = &enabled + } + case "scopes": + if v != nil { + var scopes []string + err = json.Unmarshal(*v, &scopes) + if err != nil { + return err + } + app.Scopes = &scopes + } + case "evaluationFrequency": + if v != nil { + var evaluationFrequency string + err = json.Unmarshal(*v, &evaluationFrequency) + if err != nil { + return err + } + app.EvaluationFrequency = &evaluationFrequency + } + case "windowSize": + if v != nil { + var windowSize string + err = json.Unmarshal(*v, &windowSize) + if err != nil { + return err + } + app.WindowSize = &windowSize + } + case "targetResourceType": + if v != nil { + var targetResourceType string + err = json.Unmarshal(*v, &targetResourceType) + if err != nil { + return err + } + app.TargetResourceType = &targetResourceType + } + case "targetResourceRegion": + if v != nil { + var targetResourceRegion string + err = json.Unmarshal(*v, &targetResourceRegion) + if err != nil { + return err + } + app.TargetResourceRegion = &targetResourceRegion + } + case "criteria": + if v != nil { + criteria, err := unmarshalBasicAlertCriteria(*v) + if err != nil { + return err + } + app.Criteria = criteria + } + case "autoMitigate": + if v != nil { + var autoMitigate bool + err = json.Unmarshal(*v, &autoMitigate) + if err != nil { + return err + } + app.AutoMitigate = &autoMitigate + } + case "actions": + if v != nil { + var actions []AlertAction + err = json.Unmarshal(*v, &actions) + if err != nil { + return err + } + app.Actions = &actions + } + case "lastUpdatedTime": + if v != nil { + var lastUpdatedTime date.Time + err = json.Unmarshal(*v, &lastUpdatedTime) + if err != nil { + return err + } + app.LastUpdatedTime = &lastUpdatedTime + } + case "isMigrated": + if v != nil { + var isMigrated bool + err = json.Unmarshal(*v, &isMigrated) + if err != nil { + return err + } + app.IsMigrated = &isMigrated + } + } + } + + return nil +} + +// AlertResource the metric alert resource. +type AlertResource struct { + autorest.Response `json:"-"` + // AlertProperties - The alert rule properties of the resource. + *AlertProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for AlertResource. +func (ar AlertResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ar.AlertProperties != nil { + objectMap["properties"] = ar.AlertProperties + } + if ar.Location != nil { + objectMap["location"] = ar.Location + } + if ar.Tags != nil { + objectMap["tags"] = ar.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AlertResource struct. +func (ar *AlertResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var alertProperties AlertProperties + err = json.Unmarshal(*v, &alertProperties) + if err != nil { + return err + } + ar.AlertProperties = &alertProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ar.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ar.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ar.Tags = tags + } + } + } + + return nil +} + +// AlertResourceCollection represents a collection of alert rule resources. +type AlertResourceCollection struct { + autorest.Response `json:"-"` + // Value - the values for the alert rule resources. + Value *[]AlertResource `json:"value,omitempty"` +} + +// AlertResourcePatch the metric alert resource for patch operations. +type AlertResourcePatch struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // AlertPropertiesPatch - The alert rule properties of the resource. + *AlertPropertiesPatch `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AlertResourcePatch. +func (arp AlertResourcePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if arp.Tags != nil { + objectMap["tags"] = arp.Tags + } + if arp.AlertPropertiesPatch != nil { + objectMap["properties"] = arp.AlertPropertiesPatch + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AlertResourcePatch struct. +func (arp *AlertResourcePatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + arp.Tags = tags + } + case "properties": + if v != nil { + var alertPropertiesPatch AlertPropertiesPatch + err = json.Unmarshal(*v, &alertPropertiesPatch) + if err != nil { + return err + } + arp.AlertPropertiesPatch = &alertPropertiesPatch + } + } + } + + return nil +} + +// AlertSingleResourceMultipleMetricCriteria specifies the metric alert criteria for a single resource that +// has multiple metric criteria. +type AlertSingleResourceMultipleMetricCriteria struct { + // AllOf - The list of metric criteria for this 'all of' operation. + AllOf *[]Criteria `json:"allOf,omitempty"` + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' + OdataType OdataType `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AlertSingleResourceMultipleMetricCriteria. +func (asrmmc AlertSingleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { + asrmmc.OdataType = OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria + objectMap := make(map[string]interface{}) + if asrmmc.AllOf != nil { + objectMap["allOf"] = asrmmc.AllOf + } + if asrmmc.OdataType != "" { + objectMap["odata.type"] = asrmmc.OdataType + } + for k, v := range asrmmc.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// AsAlertSingleResourceMultipleMetricCriteria is the BasicAlertCriteria implementation for AlertSingleResourceMultipleMetricCriteria. +func (asrmmc AlertSingleResourceMultipleMetricCriteria) AsAlertSingleResourceMultipleMetricCriteria() (*AlertSingleResourceMultipleMetricCriteria, bool) { + return &asrmmc, true +} + +// AsWebtestLocationAvailabilityCriteria is the BasicAlertCriteria implementation for AlertSingleResourceMultipleMetricCriteria. +func (asrmmc AlertSingleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { + return nil, false +} + +// AsAlertMultipleResourceMultipleMetricCriteria is the BasicAlertCriteria implementation for AlertSingleResourceMultipleMetricCriteria. +func (asrmmc AlertSingleResourceMultipleMetricCriteria) AsAlertMultipleResourceMultipleMetricCriteria() (*AlertMultipleResourceMultipleMetricCriteria, bool) { + return nil, false +} + +// AsAlertCriteria is the BasicAlertCriteria implementation for AlertSingleResourceMultipleMetricCriteria. +func (asrmmc AlertSingleResourceMultipleMetricCriteria) AsAlertCriteria() (*AlertCriteria, bool) { + return nil, false +} + +// AsBasicAlertCriteria is the BasicAlertCriteria implementation for AlertSingleResourceMultipleMetricCriteria. +func (asrmmc AlertSingleResourceMultipleMetricCriteria) AsBasicAlertCriteria() (BasicAlertCriteria, bool) { + return &asrmmc, true +} + +// UnmarshalJSON is the custom unmarshaler for AlertSingleResourceMultipleMetricCriteria struct. +func (asrmmc *AlertSingleResourceMultipleMetricCriteria) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "allOf": + if v != nil { + var allOf []Criteria + err = json.Unmarshal(*v, &allOf) + if err != nil { + return err + } + asrmmc.AllOf = &allOf + } + default: + if v != nil { + var additionalProperties interface{} + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if asrmmc.AdditionalProperties == nil { + asrmmc.AdditionalProperties = make(map[string]interface{}) + } + asrmmc.AdditionalProperties[k] = additionalProperties + } + case "odata.type": + if v != nil { + var odataType OdataType + err = json.Unmarshal(*v, &odataType) + if err != nil { + return err + } + asrmmc.OdataType = odataType + } + } + } + + return nil +} + +// AlertStatus an alert status. +type AlertStatus struct { + // Name - The status name. + Name *string `json:"name,omitempty"` + // ID - The alert rule arm id. + ID *string `json:"id,omitempty"` + // Type - The extended resource type name. + Type *string `json:"type,omitempty"` + // Properties - The alert status properties of the metric alert status. + Properties *AlertStatusProperties `json:"properties,omitempty"` +} + +// AlertStatusCollection represents a collection of alert rule resources. +type AlertStatusCollection struct { + autorest.Response `json:"-"` + // Value - the values for the alert rule resources. + Value *[]AlertStatus `json:"value,omitempty"` +} + +// AlertStatusProperties an alert status properties. +type AlertStatusProperties struct { + // Dimensions - An object describing the type of the dimensions. + Dimensions map[string]*string `json:"dimensions"` + // Status - status value + Status *string `json:"status,omitempty"` + // Timestamp - UTC time when the status was checked. + Timestamp *date.Time `json:"timestamp,omitempty"` +} + +// MarshalJSON is the custom marshaler for AlertStatusProperties. +func (asp AlertStatusProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asp.Dimensions != nil { + objectMap["dimensions"] = asp.Dimensions + } + if asp.Status != nil { + objectMap["status"] = asp.Status + } + if asp.Timestamp != nil { + objectMap["timestamp"] = asp.Timestamp + } + return json.Marshal(objectMap) +} + +// Availability metric availability specifies the time grain (aggregation interval or frequency) and the +// retention period for that time grain. +type Availability struct { + // TimeGrain - the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. + TimeGrain *string `json:"timeGrain,omitempty"` + // Retention - the retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. + Retention *string `json:"retention,omitempty"` +} + +// BaselineMetadata represents a baseline metadata value. +type BaselineMetadata struct { + // Name - Name of the baseline metadata. + Name *string `json:"name,omitempty"` + // Value - Value of the baseline metadata. + Value *string `json:"value,omitempty"` +} + +// BaselinesProperties the response to a metric baselines query. +type BaselinesProperties struct { + // 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. + Timespan *string `json:"timespan,omitempty"` + // 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. + Interval *string `json:"interval,omitempty"` + // Namespace - The namespace of the metrics been queried. + Namespace *string `json:"namespace,omitempty"` + // Baselines - The baseline for each time series that was queried. + Baselines *[]TimeSeriesBaseline `json:"baselines,omitempty"` +} + +// BaselinesResponse a list of metric baselines. +type BaselinesResponse struct { + autorest.Response `json:"-"` + // Value - The list of metric baselines. + Value *[]SingleMetricBaseline `json:"value,omitempty"` +} + +// Criteria criterion to filter metrics. +type Criteria struct { + // Operator - the criteria operator. Possible values include: 'OperatorEquals', 'OperatorGreaterThan', 'OperatorGreaterThanOrEqual', 'OperatorLessThan', 'OperatorLessThanOrEqual' + Operator Operator `json:"operator,omitempty"` + // Threshold - the criteria threshold value that activates the alert. + Threshold *float64 `json:"threshold,omitempty"` + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + // Name - Name of the criteria. + Name *string `json:"name,omitempty"` + // MetricName - Name of the metric. + MetricName *string `json:"metricName,omitempty"` + // MetricNamespace - Namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` + // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' + TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` + // Dimensions - List of dimension conditions. + Dimensions *[]Dimension `json:"dimensions,omitempty"` + // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. + SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` + // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' + CriterionType CriterionType `json:"criterionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for Criteria. +func (c Criteria) MarshalJSON() ([]byte, error) { + c.CriterionType = CriterionTypeStaticThresholdCriterion + objectMap := make(map[string]interface{}) + if c.Operator != "" { + objectMap["operator"] = c.Operator + } + if c.Threshold != nil { + objectMap["threshold"] = c.Threshold + } + if c.Name != nil { + objectMap["name"] = c.Name + } + if c.MetricName != nil { + objectMap["metricName"] = c.MetricName + } + if c.MetricNamespace != nil { + objectMap["metricNamespace"] = c.MetricNamespace + } + if c.TimeAggregation != "" { + objectMap["timeAggregation"] = c.TimeAggregation + } + if c.Dimensions != nil { + objectMap["dimensions"] = c.Dimensions + } + if c.SkipMetricValidation != nil { + objectMap["skipMetricValidation"] = c.SkipMetricValidation + } + if c.CriterionType != "" { + objectMap["criterionType"] = c.CriterionType + } + for k, v := range c.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// AsCriteria is the BasicMultiMetricCriteria implementation for Criteria. +func (c Criteria) AsCriteria() (*Criteria, bool) { + return &c, true +} + +// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for Criteria. +func (c Criteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { + return nil, false +} + +// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for Criteria. +func (c Criteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { + return nil, false +} + +// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for Criteria. +func (c Criteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { + return &c, true +} + +// UnmarshalJSON is the custom unmarshaler for Criteria struct. +func (c *Criteria) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "operator": + if v != nil { + var operator Operator + err = json.Unmarshal(*v, &operator) + if err != nil { + return err + } + c.Operator = operator + } + case "threshold": + if v != nil { + var threshold float64 + err = json.Unmarshal(*v, &threshold) + if err != nil { + return err + } + c.Threshold = &threshold + } + default: + if v != nil { + var additionalProperties interface{} + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if c.AdditionalProperties == nil { + c.AdditionalProperties = make(map[string]interface{}) + } + c.AdditionalProperties[k] = additionalProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + c.Name = &name + } + case "metricName": + if v != nil { + var metricName string + err = json.Unmarshal(*v, &metricName) + if err != nil { + return err + } + c.MetricName = &metricName + } + case "metricNamespace": + if v != nil { + var metricNamespace string + err = json.Unmarshal(*v, &metricNamespace) + if err != nil { + return err + } + c.MetricNamespace = &metricNamespace + } + case "timeAggregation": + if v != nil { + var timeAggregation AggregationTypeEnum + err = json.Unmarshal(*v, &timeAggregation) + if err != nil { + return err + } + c.TimeAggregation = timeAggregation + } + case "dimensions": + if v != nil { + var dimensions []Dimension + err = json.Unmarshal(*v, &dimensions) + if err != nil { + return err + } + c.Dimensions = &dimensions + } + case "skipMetricValidation": + if v != nil { + var skipMetricValidation bool + err = json.Unmarshal(*v, &skipMetricValidation) + if err != nil { + return err + } + c.SkipMetricValidation = &skipMetricValidation + } + case "criterionType": + if v != nil { + var criterionType CriterionType + err = json.Unmarshal(*v, &criterionType) + if err != nil { + return err + } + c.CriterionType = criterionType + } + } + } + + return nil +} + +// Definition metric definition class specifies the metadata for a metric. +type Definition struct { + // IsDimensionRequired - Flag to indicate whether the dimension is required. + IsDimensionRequired *bool `json:"isDimensionRequired,omitempty"` + // ResourceID - the resource identifier of the resource that emitted the metric. + ResourceID *string `json:"resourceId,omitempty"` + // Namespace - the namespace the metric belongs to. + Namespace *string `json:"namespace,omitempty"` + // Name - the name and the display name of the metric, i.e. it is a localizable string. + Name *LocalizableString `json:"name,omitempty"` + // DisplayDescription - Detailed description of this metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + // Category - Custom category name for this metric. + Category *string `json:"category,omitempty"` + // MetricClass - The class of the metric. Possible values include: 'MetricClassAvailability', 'MetricClassTransactions', 'MetricClassErrors', 'MetricClassLatency', 'MetricClassSaturation' + MetricClass MetricClass `json:"metricClass,omitempty"` + // Unit - the unit of the metric. Possible values include: 'MetricUnitCount', 'MetricUnitBytes', 'MetricUnitSeconds', 'MetricUnitCountPerSecond', 'MetricUnitBytesPerSecond', 'MetricUnitPercent', 'MetricUnitMilliSeconds', 'MetricUnitByteSeconds', 'MetricUnitUnspecified', 'MetricUnitCores', 'MetricUnitMilliCores', 'MetricUnitNanoCores', 'MetricUnitBitsPerSecond' + Unit MetricUnit `json:"unit,omitempty"` + // PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' + PrimaryAggregationType AggregationType `json:"primaryAggregationType,omitempty"` + // SupportedAggregationTypes - the collection of what aggregation types are supported. + SupportedAggregationTypes *[]AggregationType `json:"supportedAggregationTypes,omitempty"` + // MetricAvailabilities - the collection of what aggregation intervals are available to be queried. + MetricAvailabilities *[]Availability `json:"metricAvailabilities,omitempty"` + // ID - the resource identifier of the metric definition. + ID *string `json:"id,omitempty"` + // Dimensions - the name and the display name of the dimension, i.e. it is a localizable string. + Dimensions *[]LocalizableString `json:"dimensions,omitempty"` +} + +// DefinitionCollection represents collection of metric definitions. +type DefinitionCollection struct { + autorest.Response `json:"-"` + // Value - the values for the metric definitions. + Value *[]Definition `json:"value,omitempty"` +} + +// Dimension specifies a metric dimension. +type Dimension struct { + // Name - Name of the dimension. + Name *string `json:"name,omitempty"` + // Operator - the dimension operator. Only 'Include' and 'Exclude' are supported + Operator *string `json:"operator,omitempty"` + // Values - list of dimension values. + Values *[]string `json:"values,omitempty"` +} + +// DimensionProperties type of operation: get, read, delete, etc. +type DimensionProperties struct { + // Name - Name of dimension. + Name *string `json:"name,omitempty"` + // DisplayName - Display name of dimension. + DisplayName *string `json:"displayName,omitempty"` + // ToBeExportedForShoebox - Legacy usage, should not set. + ToBeExportedForShoebox *bool `json:"toBeExportedForShoebox,omitempty"` + // IsHidden - When set, the dimension is hidden from the customer, used in conjunction with the defaultDimensionValues field below + IsHidden *bool `json:"isHidden,omitempty"` + // DefaultDimensionValues - Default dimension value to be sent down for the hidden dimension during query + DefaultDimensionValues interface{} `json:"defaultDimensionValues,omitempty"` +} + +// DynamicMetricCriteria criterion for dynamic threshold. +type DynamicMetricCriteria struct { + // Operator - The operator used to compare the metric value against the threshold. Possible values include: 'GreaterThan', 'LessThan', 'GreaterOrLessThan' + Operator DynamicThresholdOperator `json:"operator,omitempty"` + // AlertSensitivity - The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern. Possible values include: 'DynamicThresholdSensitivityLow', 'DynamicThresholdSensitivityMedium', 'DynamicThresholdSensitivityHigh' + AlertSensitivity DynamicThresholdSensitivity `json:"alertSensitivity,omitempty"` + // FailingPeriods - The minimum number of violations required within the selected lookback time window required to raise an alert. + FailingPeriods *DynamicThresholdFailingPeriods `json:"failingPeriods,omitempty"` + // IgnoreDataBefore - Use this option to set the date from which to start learning the metric historical data and calculate the dynamic thresholds (in ISO8601 format) + IgnoreDataBefore *date.Time `json:"ignoreDataBefore,omitempty"` + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + // Name - Name of the criteria. + Name *string `json:"name,omitempty"` + // MetricName - Name of the metric. + MetricName *string `json:"metricName,omitempty"` + // MetricNamespace - Namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` + // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' + TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` + // Dimensions - List of dimension conditions. + Dimensions *[]Dimension `json:"dimensions,omitempty"` + // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. + SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` + // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' + CriterionType CriterionType `json:"criterionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for DynamicMetricCriteria. +func (dmc DynamicMetricCriteria) MarshalJSON() ([]byte, error) { + dmc.CriterionType = CriterionTypeDynamicThresholdCriterion + objectMap := make(map[string]interface{}) + if dmc.Operator != "" { + objectMap["operator"] = dmc.Operator + } + if dmc.AlertSensitivity != "" { + objectMap["alertSensitivity"] = dmc.AlertSensitivity + } + if dmc.FailingPeriods != nil { + objectMap["failingPeriods"] = dmc.FailingPeriods + } + if dmc.IgnoreDataBefore != nil { + objectMap["ignoreDataBefore"] = dmc.IgnoreDataBefore + } + if dmc.Name != nil { + objectMap["name"] = dmc.Name + } + if dmc.MetricName != nil { + objectMap["metricName"] = dmc.MetricName + } + if dmc.MetricNamespace != nil { + objectMap["metricNamespace"] = dmc.MetricNamespace + } + if dmc.TimeAggregation != "" { + objectMap["timeAggregation"] = dmc.TimeAggregation + } + if dmc.Dimensions != nil { + objectMap["dimensions"] = dmc.Dimensions + } + if dmc.SkipMetricValidation != nil { + objectMap["skipMetricValidation"] = dmc.SkipMetricValidation + } + if dmc.CriterionType != "" { + objectMap["criterionType"] = dmc.CriterionType + } + for k, v := range dmc.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// AsCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. +func (dmc DynamicMetricCriteria) AsCriteria() (*Criteria, bool) { + return nil, false +} + +// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. +func (dmc DynamicMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { + return &dmc, true +} + +// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. +func (dmc DynamicMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { + return nil, false +} + +// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. +func (dmc DynamicMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { + return &dmc, true +} + +// UnmarshalJSON is the custom unmarshaler for DynamicMetricCriteria struct. +func (dmc *DynamicMetricCriteria) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "operator": + if v != nil { + var operator DynamicThresholdOperator + err = json.Unmarshal(*v, &operator) + if err != nil { + return err + } + dmc.Operator = operator + } + case "alertSensitivity": + if v != nil { + var alertSensitivity DynamicThresholdSensitivity + err = json.Unmarshal(*v, &alertSensitivity) + if err != nil { + return err + } + dmc.AlertSensitivity = alertSensitivity + } + case "failingPeriods": + if v != nil { + var failingPeriods DynamicThresholdFailingPeriods + err = json.Unmarshal(*v, &failingPeriods) + if err != nil { + return err + } + dmc.FailingPeriods = &failingPeriods + } + case "ignoreDataBefore": + if v != nil { + var ignoreDataBefore date.Time + err = json.Unmarshal(*v, &ignoreDataBefore) + if err != nil { + return err + } + dmc.IgnoreDataBefore = &ignoreDataBefore + } + default: + if v != nil { + var additionalProperties interface{} + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if dmc.AdditionalProperties == nil { + dmc.AdditionalProperties = make(map[string]interface{}) + } + dmc.AdditionalProperties[k] = additionalProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dmc.Name = &name + } + case "metricName": + if v != nil { + var metricName string + err = json.Unmarshal(*v, &metricName) + if err != nil { + return err + } + dmc.MetricName = &metricName + } + case "metricNamespace": + if v != nil { + var metricNamespace string + err = json.Unmarshal(*v, &metricNamespace) + if err != nil { + return err + } + dmc.MetricNamespace = &metricNamespace + } + case "timeAggregation": + if v != nil { + var timeAggregation AggregationTypeEnum + err = json.Unmarshal(*v, &timeAggregation) + if err != nil { + return err + } + dmc.TimeAggregation = timeAggregation + } + case "dimensions": + if v != nil { + var dimensions []Dimension + err = json.Unmarshal(*v, &dimensions) + if err != nil { + return err + } + dmc.Dimensions = &dimensions + } + case "skipMetricValidation": + if v != nil { + var skipMetricValidation bool + err = json.Unmarshal(*v, &skipMetricValidation) + if err != nil { + return err + } + dmc.SkipMetricValidation = &skipMetricValidation + } + case "criterionType": + if v != nil { + var criterionType CriterionType + err = json.Unmarshal(*v, &criterionType) + if err != nil { + return err + } + dmc.CriterionType = criterionType + } + } + } + + return nil +} + +// DynamicThresholdFailingPeriods the minimum number of violations required within the selected lookback +// time window required to raise an alert. +type DynamicThresholdFailingPeriods struct { + // NumberOfEvaluationPeriods - 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. + NumberOfEvaluationPeriods *float64 `json:"numberOfEvaluationPeriods,omitempty"` + // MinFailingPeriodsToAlert - The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. + MinFailingPeriodsToAlert *float64 `json:"minFailingPeriodsToAlert,omitempty"` +} + +// ErrorContract common error response for all Azure Resource Manager APIs to return error details for +// failed operations. (This also follows the OData error response format.) +type ErrorContract struct { + // Error - The error object. + Error *ErrorResponse `json:"error,omitempty"` +} + +// ErrorResponse describes the format of Error response. +type ErrorResponse struct { + // Code - Error code + Code *string `json:"code,omitempty"` + // Message - Error message indicating why the operation failed. + Message *string `json:"message,omitempty"` +} + +// LocalizableString the localizable string class. +type LocalizableString struct { + // Value - the invariant value. + Value *string `json:"value,omitempty"` + // LocalizedValue - the locale specific value. + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// LogSpecification log specification of operation. +type LogSpecification struct { + // Name - Name of log specification. + Name *string `json:"name,omitempty"` + // DisplayName - Display name of log specification. + DisplayName *string `json:"displayName,omitempty"` + // BlobDuration - Blob duration of specification. + BlobDuration *string `json:"blobDuration,omitempty"` +} + +// MetadataValue represents a metric metadata value. +type MetadataValue struct { + // Name - the name of the metadata. + Name *LocalizableString `json:"name,omitempty"` + // Value - the value of the metadata. + Value *string `json:"value,omitempty"` +} + +// Metric the result data of a query. +type Metric struct { + // ID - the metric Id. + ID *string `json:"id,omitempty"` + // Type - the resource type of the metric resource. + Type *string `json:"type,omitempty"` + // Name - the name and the display name of the metric, i.e. it is localizable string. + Name *LocalizableString `json:"name,omitempty"` + // DisplayDescription - Detailed description of this metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + // ErrorCode - 'Success' or the error details on query failures for this metric. + ErrorCode *string `json:"errorCode,omitempty"` + // ErrorMessage - Error message encountered querying this specific metric. + ErrorMessage *string `json:"errorMessage,omitempty"` + // Unit - The unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' + Unit Unit `json:"unit,omitempty"` + // Timeseries - the time series returned when a data query is performed. + Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"` +} + +// BasicMultiMetricCriteria the types of conditions for a multi resource alert. +type BasicMultiMetricCriteria interface { + AsCriteria() (*Criteria, bool) + AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) + AsMultiMetricCriteria() (*MultiMetricCriteria, bool) +} + +// MultiMetricCriteria the types of conditions for a multi resource alert. +type MultiMetricCriteria struct { + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + // Name - Name of the criteria. + Name *string `json:"name,omitempty"` + // MetricName - Name of the metric. + MetricName *string `json:"metricName,omitempty"` + // MetricNamespace - Namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` + // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' + TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` + // Dimensions - List of dimension conditions. + Dimensions *[]Dimension `json:"dimensions,omitempty"` + // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. + SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` + // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' + CriterionType CriterionType `json:"criterionType,omitempty"` +} + +func unmarshalBasicMultiMetricCriteria(body []byte) (BasicMultiMetricCriteria, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["criterionType"] { + case string(CriterionTypeStaticThresholdCriterion): + var c Criteria + err := json.Unmarshal(body, &c) + return c, err + case string(CriterionTypeDynamicThresholdCriterion): + var dmc DynamicMetricCriteria + err := json.Unmarshal(body, &dmc) + return dmc, err + default: + var mmc MultiMetricCriteria + err := json.Unmarshal(body, &mmc) + return mmc, err + } +} +func unmarshalBasicMultiMetricCriteriaArray(body []byte) ([]BasicMultiMetricCriteria, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + mmcArray := make([]BasicMultiMetricCriteria, len(rawMessages)) + + for index, rawMessage := range rawMessages { + mmc, err := unmarshalBasicMultiMetricCriteria(*rawMessage) + if err != nil { + return nil, err + } + mmcArray[index] = mmc + } + return mmcArray, nil +} + +// MarshalJSON is the custom marshaler for MultiMetricCriteria. +func (mmc MultiMetricCriteria) MarshalJSON() ([]byte, error) { + mmc.CriterionType = CriterionTypeMultiMetricCriteria + objectMap := make(map[string]interface{}) + if mmc.Name != nil { + objectMap["name"] = mmc.Name + } + if mmc.MetricName != nil { + objectMap["metricName"] = mmc.MetricName + } + if mmc.MetricNamespace != nil { + objectMap["metricNamespace"] = mmc.MetricNamespace + } + if mmc.TimeAggregation != "" { + objectMap["timeAggregation"] = mmc.TimeAggregation + } + if mmc.Dimensions != nil { + objectMap["dimensions"] = mmc.Dimensions + } + if mmc.SkipMetricValidation != nil { + objectMap["skipMetricValidation"] = mmc.SkipMetricValidation + } + if mmc.CriterionType != "" { + objectMap["criterionType"] = mmc.CriterionType + } + for k, v := range mmc.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// AsCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. +func (mmc MultiMetricCriteria) AsCriteria() (*Criteria, bool) { + return nil, false +} + +// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. +func (mmc MultiMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { + return nil, false +} + +// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. +func (mmc MultiMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { + return &mmc, true +} + +// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. +func (mmc MultiMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { + return &mmc, true +} + +// UnmarshalJSON is the custom unmarshaler for MultiMetricCriteria struct. +func (mmc *MultiMetricCriteria) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + default: + if v != nil { + var additionalProperties interface{} + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if mmc.AdditionalProperties == nil { + mmc.AdditionalProperties = make(map[string]interface{}) + } + mmc.AdditionalProperties[k] = additionalProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mmc.Name = &name + } + case "metricName": + if v != nil { + var metricName string + err = json.Unmarshal(*v, &metricName) + if err != nil { + return err + } + mmc.MetricName = &metricName + } + case "metricNamespace": + if v != nil { + var metricNamespace string + err = json.Unmarshal(*v, &metricNamespace) + if err != nil { + return err + } + mmc.MetricNamespace = &metricNamespace + } + case "timeAggregation": + if v != nil { + var timeAggregation AggregationTypeEnum + err = json.Unmarshal(*v, &timeAggregation) + if err != nil { + return err + } + mmc.TimeAggregation = timeAggregation + } + case "dimensions": + if v != nil { + var dimensions []Dimension + err = json.Unmarshal(*v, &dimensions) + if err != nil { + return err + } + mmc.Dimensions = &dimensions + } + case "skipMetricValidation": + if v != nil { + var skipMetricValidation bool + err = json.Unmarshal(*v, &skipMetricValidation) + if err != nil { + return err + } + mmc.SkipMetricValidation = &skipMetricValidation + } + case "criterionType": + if v != nil { + var criterionType CriterionType + err = json.Unmarshal(*v, &criterionType) + if err != nil { + return err + } + mmc.CriterionType = criterionType + } + } + } + + return nil +} + +// Namespace metric namespace class specifies the metadata for a metric namespace. +type Namespace struct { + // ID - The ID of the metric namespace. + ID *string `json:"id,omitempty"` + // Type - The type of the namespace. + Type *string `json:"type,omitempty"` + // Name - The escaped name of the namespace. + Name *string `json:"name,omitempty"` + // Classification - Kind of namespace. Possible values include: 'Platform', 'Custom', 'Qos' + Classification NamespaceClassification `json:"classification,omitempty"` + // Properties - Properties which include the fully qualified namespace name. + Properties *NamespaceName `json:"properties,omitempty"` +} + +// NamespaceCollection represents collection of metric namespaces. +type NamespaceCollection struct { + autorest.Response `json:"-"` + // Value - The values for the metric namespaces. + Value *[]Namespace `json:"value,omitempty"` +} + +// NamespaceName the fully qualified metric namespace name. +type NamespaceName struct { + // MetricNamespaceName - The metric namespace name. + MetricNamespaceName *string `json:"metricNamespaceName,omitempty"` +} + +// Operation microsoft Insights API operation definition. +type Operation struct { + // Name - Operation name: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // IsDataAction - Property to specify whether the action is a data action. + IsDataAction *bool `json:"isDataAction,omitempty"` + // Display - Display metadata associated with the operation. + Display *OperationDisplay `json:"display,omitempty"` + // OperationProperties - Properties of operation, include metric specifications. + *OperationProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if o.Name != nil { + objectMap["name"] = o.Name + } + if o.IsDataAction != nil { + objectMap["isDataAction"] = o.IsDataAction + } + if o.Display != nil { + objectMap["display"] = o.Display + } + if o.OperationProperties != nil { + objectMap["properties"] = o.OperationProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Operation struct. +func (o *Operation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + o.Name = &name + } + case "isDataAction": + if v != nil { + var isDataAction bool + err = json.Unmarshal(*v, &isDataAction) + if err != nil { + return err + } + o.IsDataAction = &isDataAction + } + case "display": + if v != nil { + var display OperationDisplay + err = json.Unmarshal(*v, &display) + if err != nil { + return err + } + o.Display = &display + } + case "properties": + if v != nil { + var operationProperties OperationProperties + err = json.Unmarshal(*v, &operationProperties) + if err != nil { + return err + } + o.OperationProperties = &operationProperties + } + } + } + + return nil +} + +// OperationDisplay display metadata associated with the operation. +type OperationDisplay struct { + // Publisher - The publisher of this operation. + Publisher *string `json:"publisher,omitempty"` + // Provider - Service provider: Microsoft.Insights + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed: AlertRules, Autoscale, etc. + Resource *string `json:"resource,omitempty"` + // Operation - Operation type: Read, write, delete, etc. + Operation *string `json:"operation,omitempty"` + // Description - The description of the operation. + Description *string `json:"description,omitempty"` +} + +// OperationListResult 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. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - List of operations supported by the Microsoft.Insights provider. + Value *[]Operation `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationProperties properties of operation, include metric specifications. +type OperationProperties struct { + // ServiceSpecification - One property of operation, include metric specifications. + ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` +} + +// Resource an azure resource object +type Resource struct { + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.Location != nil { + objectMap["location"] = r.Location + } + if r.Tags != nil { + objectMap["tags"] = r.Tags + } + return json.Marshal(objectMap) +} + +// Response the response to a metrics query. +type Response struct { + autorest.Response `json:"-"` + // Cost - The integer value representing the relative cost of the query. + Cost *float64 `json:"cost,omitempty"` + // 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. + Timespan *string `json:"timespan,omitempty"` + // 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. + Interval *string `json:"interval,omitempty"` + // Namespace - The namespace of the metrics being queried + Namespace *string `json:"namespace,omitempty"` + // Resourceregion - The region of the resource being queried for metrics. + Resourceregion *string `json:"resourceregion,omitempty"` + // Value - the value of the collection. + Value *[]Metric `json:"value,omitempty"` +} + +// ServiceSpecification one property of operation, include log specifications. +type ServiceSpecification struct { + // LogSpecifications - Log specifications of operation. + LogSpecifications *[]LogSpecification `json:"logSpecifications,omitempty"` + // MetricSpecifications - Metric specifications of operation. + MetricSpecifications *[]Specification `json:"metricSpecifications,omitempty"` + // LegacyMetricSpecifications - Legacy Metric specifications for operation. Deprecated, do not use. + LegacyMetricSpecifications interface{} `json:"legacyMetricSpecifications,omitempty"` +} + +// SingleBaseline the baseline values for a single sensitivity value. +type SingleBaseline struct { + // Sensitivity - the sensitivity of the baseline. Possible values include: 'Low', 'Medium', 'High' + Sensitivity BaselineSensitivity `json:"sensitivity,omitempty"` + // LowThresholds - The low thresholds of the baseline. + LowThresholds *[]float64 `json:"lowThresholds,omitempty"` + // HighThresholds - The high thresholds of the baseline. + HighThresholds *[]float64 `json:"highThresholds,omitempty"` +} + +// SingleDimension the metric dimension name and value. +type SingleDimension struct { + // Name - Name of the dimension. + Name *string `json:"name,omitempty"` + // Value - Value of the dimension. + Value *string `json:"value,omitempty"` +} + +// SingleMetricBaseline the baseline results of a single metric. +type SingleMetricBaseline struct { + // ID - The metric baseline Id. + ID *string `json:"id,omitempty"` + // Type - The resource type of the metric baseline resource. + Type *string `json:"type,omitempty"` + // Name - The name of the metric for which the baselines were retrieved. + Name *string `json:"name,omitempty"` + // BaselinesProperties - The metric baseline properties of the metric. + *BaselinesProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for SingleMetricBaseline. +func (smb SingleMetricBaseline) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if smb.ID != nil { + objectMap["id"] = smb.ID + } + if smb.Type != nil { + objectMap["type"] = smb.Type + } + if smb.Name != nil { + objectMap["name"] = smb.Name + } + if smb.BaselinesProperties != nil { + objectMap["properties"] = smb.BaselinesProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SingleMetricBaseline struct. +func (smb *SingleMetricBaseline) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + smb.ID = &ID + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + smb.Type = &typeVar + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + smb.Name = &name + } + case "properties": + if v != nil { + var baselinesProperties BaselinesProperties + err = json.Unmarshal(*v, &baselinesProperties) + if err != nil { + return err + } + smb.BaselinesProperties = &baselinesProperties + } + } + } + + return nil +} + +// Specification metric specification of operation. +type Specification struct { + // Name - The name of the metric. + Name *string `json:"name,omitempty"` + // DisplayName - Display name of the metric. + DisplayName *string `json:"displayName,omitempty"` + // DisplayDescription - Display description of the metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + // Unit - The metric unit. Possible values include: Count,Bytes,Seconds,Percent,CountPerSecond,BytesPerSecond,MilliSeconds,ByteSeconds,Unspecified,BitsPerSecond,Cores,MilliCores,NanoCores + Unit *string `json:"unit,omitempty"` + // AggregationType - The default metric aggregation type. Possible values include: Total,Average,Maximum,Minimum,Count + AggregationType *string `json:"aggregationType,omitempty"` + // SupportedAggregationTypes - The supported aggregation types for the metrics. + SupportedAggregationTypes *[]string `json:"supportedAggregationTypes,omitempty"` + // SupportedTimeGrainTypes - The supported time grain types for the metrics. + SupportedTimeGrainTypes *[]string `json:"supportedTimeGrainTypes,omitempty"` + // Availabilities - The supported time grain types for the metrics. + Availabilities *[]string `json:"availabilities,omitempty"` + // LockAggregationType - The metric lock aggregation type. + LockAggregationType *string `json:"lockAggregationType,omitempty"` + // Category - Category or type of metric. + Category *string `json:"category,omitempty"` + // Dimensions - The dimensions of metric. + Dimensions *[]DimensionProperties `json:"dimensions,omitempty"` + // FillGapWithZero - Property to specify whether to fill empty gaps with zero. + FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` + // InternalMetricName - The internal metric name. + InternalMetricName *string `json:"internalMetricName,omitempty"` +} + +// SubscriptionScopeMetric the result data of a query. +type SubscriptionScopeMetric struct { + // ID - the metric Id. + ID *string `json:"id,omitempty"` + // Type - the resource type of the metric resource. + Type *string `json:"type,omitempty"` + // Name - the name and the display name of the metric, i.e. it is localizable string. + Name *LocalizableString `json:"name,omitempty"` + // DisplayDescription - Detailed description of this metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + // ErrorCode - 'Success' or the error details on query failures for this metric. + ErrorCode *string `json:"errorCode,omitempty"` + // ErrorMessage - Error message encountered querying this specific metric. + ErrorMessage *string `json:"errorMessage,omitempty"` + // Unit - The unit of the metric. Possible values include: 'MetricUnitCount', 'MetricUnitBytes', 'MetricUnitSeconds', 'MetricUnitCountPerSecond', 'MetricUnitBytesPerSecond', 'MetricUnitPercent', 'MetricUnitMilliSeconds', 'MetricUnitByteSeconds', 'MetricUnitUnspecified', 'MetricUnitCores', 'MetricUnitMilliCores', 'MetricUnitNanoCores', 'MetricUnitBitsPerSecond' + Unit MetricUnit `json:"unit,omitempty"` + // Timeseries - the time series returned when a data query is performed. + Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"` +} + +// SubscriptionScopeMetricDefinition metric definition class specifies the metadata for a metric. +type SubscriptionScopeMetricDefinition struct { + // IsDimensionRequired - Flag to indicate whether the dimension is required. + IsDimensionRequired *bool `json:"isDimensionRequired,omitempty"` + // ResourceID - the resource identifier of the resource that emitted the metric. + ResourceID *string `json:"resourceId,omitempty"` + // Namespace - the namespace the metric belongs to. + Namespace *string `json:"namespace,omitempty"` + // Name - the name and the display name of the metric, i.e. it is a localizable string. + Name *LocalizableString `json:"name,omitempty"` + // DisplayDescription - Detailed description of this metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + // Category - Custom category name for this metric. + Category *string `json:"category,omitempty"` + // MetricClass - The class of the metric. Possible values include: 'MetricClassAvailability', 'MetricClassTransactions', 'MetricClassErrors', 'MetricClassLatency', 'MetricClassSaturation' + MetricClass MetricClass `json:"metricClass,omitempty"` + // Unit - the unit of the metric. Possible values include: 'MetricUnitCount', 'MetricUnitBytes', 'MetricUnitSeconds', 'MetricUnitCountPerSecond', 'MetricUnitBytesPerSecond', 'MetricUnitPercent', 'MetricUnitMilliSeconds', 'MetricUnitByteSeconds', 'MetricUnitUnspecified', 'MetricUnitCores', 'MetricUnitMilliCores', 'MetricUnitNanoCores', 'MetricUnitBitsPerSecond' + Unit MetricUnit `json:"unit,omitempty"` + // PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'MetricAggregationTypeNone', 'MetricAggregationTypeAverage', 'MetricAggregationTypeCount', 'MetricAggregationTypeMinimum', 'MetricAggregationTypeMaximum', 'MetricAggregationTypeTotal' + PrimaryAggregationType MetricAggregationType `json:"primaryAggregationType,omitempty"` + // SupportedAggregationTypes - the collection of what aggregation types are supported. + SupportedAggregationTypes *[]MetricAggregationType `json:"supportedAggregationTypes,omitempty"` + // MetricAvailabilities - the collection of what aggregation intervals are available to be queried. + MetricAvailabilities *[]Availability `json:"metricAvailabilities,omitempty"` + // ID - the resource identifier of the metric definition. + ID *string `json:"id,omitempty"` + // Dimensions - the name and the display name of the dimension, i.e. it is a localizable string. + Dimensions *[]LocalizableString `json:"dimensions,omitempty"` +} + +// SubscriptionScopeMetricDefinitionCollection represents collection of metric definitions. +type SubscriptionScopeMetricDefinitionCollection struct { + autorest.Response `json:"-"` + // Value - The values for the metric definitions. + Value *[]SubscriptionScopeMetricDefinition `json:"value,omitempty"` +} + +// SubscriptionScopeMetricResponse the response to a subscription scope metrics query. +type SubscriptionScopeMetricResponse struct { + autorest.Response `json:"-"` + // Cost - The integer value representing the relative cost of the query. + Cost *float64 `json:"cost,omitempty"` + // 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. + Timespan *string `json:"timespan,omitempty"` + // 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. + Interval *string `json:"interval,omitempty"` + // Namespace - The namespace of the metrics being queried + Namespace *string `json:"namespace,omitempty"` + // Resourceregion - The region of the resource being queried for metrics. + Resourceregion *string `json:"resourceregion,omitempty"` + // Value - the value of the collection. + Value *[]SubscriptionScopeMetric `json:"value,omitempty"` +} + +// SubscriptionScopeMetricsRequestBodyParameters query parameters can also be specified in the body, +// specifying the same parameter in both the body and query parameters will result in an error. +type SubscriptionScopeMetricsRequestBodyParameters struct { + // Timespan - The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + Timespan *string `json:"timespan,omitempty"` + // Interval - The interval (i.e. timegrain) of the query. + Interval *string `json:"interval,omitempty"` + // MetricNames - The names of the metrics (comma separated) to retrieve. + MetricNames *string `json:"metricNames,omitempty"` + // Aggregation - The list of aggregation types (comma separated) to retrieve. + Aggregation *string `json:"aggregation,omitempty"` + // 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 ‘*’**. + Filter *string `json:"filter,omitempty"` + // Top - The maximum number of records to retrieve. + // Valid only if $filter is specified. + // Defaults to 10. + Top *int32 `json:"top,omitempty"` + // OrderBy - The aggregation to use for sorting results and the direction of the sort. + // Only one order can be specified. + // Examples: sum asc. + OrderBy *string `json:"orderBy,omitempty"` + // RollUpBy - Dimension name(s) to rollup results by. For example if you only want to see metric values with a filter like 'City eq Seattle or City eq Tacoma' but don't want to see separate values for each city, you can specify 'RollUpBy=City' to see the results for Seattle and Tacoma rolled up into one timeseries. + RollUpBy *string `json:"rollUpBy,omitempty"` + // ResultType - 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' + ResultType MetricResultType `json:"resultType,omitempty"` + // MetricNamespace - Metric namespace where the metrics you want reside. + MetricNamespace *string `json:"metricNamespace,omitempty"` + // AutoAdjustTimegrain - When set to true, if the timespan passed in is not supported by this metric, the API will return the result using the closest supported timespan. When set to false, an error is returned for invalid timespan parameters. Defaults to false. + AutoAdjustTimegrain *bool `json:"autoAdjustTimegrain,omitempty"` + // ValidateDimensions - When set to false, invalid filter parameter values will be ignored. When set to true, an error is returned for invalid filter parameters. Defaults to true. + ValidateDimensions *bool `json:"validateDimensions,omitempty"` +} + +// TimeSeriesBaseline the baseline values for a single time series. +type TimeSeriesBaseline struct { + // Aggregation - The aggregation type of the metric. + Aggregation *string `json:"aggregation,omitempty"` + // Dimensions - The dimensions of this time series. + Dimensions *[]SingleDimension `json:"dimensions,omitempty"` + // Timestamps - The list of timestamps of the baselines. + Timestamps *[]date.Time `json:"timestamps,omitempty"` + // Data - The baseline values for each sensitivity. + Data *[]SingleBaseline `json:"data,omitempty"` + // MetadataValues - The baseline metadata values. + MetadataValues *[]BaselineMetadata `json:"metadataValues,omitempty"` +} + +// TimeSeriesElement a time series result type. The discriminator value is always TimeSeries in this case. +type TimeSeriesElement struct { + // Metadatavalues - the metadata values returned if $filter was specified in the call. + Metadatavalues *[]MetadataValue `json:"metadatavalues,omitempty"` + // Data - An array of data points representing the metric values. This is only returned if a result type of data is specified. + Data *[]Value `json:"data,omitempty"` +} + +// Value represents a metric value. +type Value struct { + // TimeStamp - the timestamp for the metric value in ISO 8601 format. + TimeStamp *date.Time `json:"timeStamp,omitempty"` + // Average - the average value in the time range. + Average *float64 `json:"average,omitempty"` + // Minimum - the least value in the time range. + Minimum *float64 `json:"minimum,omitempty"` + // Maximum - the greatest value in the time range. + Maximum *float64 `json:"maximum,omitempty"` + // Total - the sum of all of the values in the time range. + Total *float64 `json:"total,omitempty"` + // Count - the number of samples in the time range. Can be used to determine the number of values that contributed to the average value. + Count *float64 `json:"count,omitempty"` +} + +// WebtestLocationAvailabilityCriteria specifies the metric alert rule criteria for a web test resource. +type WebtestLocationAvailabilityCriteria struct { + // WebTestID - The Application Insights web test Id. + WebTestID *string `json:"webTestId,omitempty"` + // ComponentID - The Application Insights resource Id. + ComponentID *string `json:"componentId,omitempty"` + // FailedLocationCount - The number of failed locations. + FailedLocationCount *float64 `json:"failedLocationCount,omitempty"` + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' + OdataType OdataType `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebtestLocationAvailabilityCriteria. +func (wlac WebtestLocationAvailabilityCriteria) MarshalJSON() ([]byte, error) { + wlac.OdataType = OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria + objectMap := make(map[string]interface{}) + if wlac.WebTestID != nil { + objectMap["webTestId"] = wlac.WebTestID + } + if wlac.ComponentID != nil { + objectMap["componentId"] = wlac.ComponentID + } + if wlac.FailedLocationCount != nil { + objectMap["failedLocationCount"] = wlac.FailedLocationCount + } + if wlac.OdataType != "" { + objectMap["odata.type"] = wlac.OdataType + } + for k, v := range wlac.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// AsAlertSingleResourceMultipleMetricCriteria is the BasicAlertCriteria implementation for WebtestLocationAvailabilityCriteria. +func (wlac WebtestLocationAvailabilityCriteria) AsAlertSingleResourceMultipleMetricCriteria() (*AlertSingleResourceMultipleMetricCriteria, bool) { + return nil, false +} + +// AsWebtestLocationAvailabilityCriteria is the BasicAlertCriteria implementation for WebtestLocationAvailabilityCriteria. +func (wlac WebtestLocationAvailabilityCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { + return &wlac, true +} + +// AsAlertMultipleResourceMultipleMetricCriteria is the BasicAlertCriteria implementation for WebtestLocationAvailabilityCriteria. +func (wlac WebtestLocationAvailabilityCriteria) AsAlertMultipleResourceMultipleMetricCriteria() (*AlertMultipleResourceMultipleMetricCriteria, bool) { + return nil, false +} + +// AsAlertCriteria is the BasicAlertCriteria implementation for WebtestLocationAvailabilityCriteria. +func (wlac WebtestLocationAvailabilityCriteria) AsAlertCriteria() (*AlertCriteria, bool) { + return nil, false +} + +// AsBasicAlertCriteria is the BasicAlertCriteria implementation for WebtestLocationAvailabilityCriteria. +func (wlac WebtestLocationAvailabilityCriteria) AsBasicAlertCriteria() (BasicAlertCriteria, bool) { + return &wlac, true +} + +// UnmarshalJSON is the custom unmarshaler for WebtestLocationAvailabilityCriteria struct. +func (wlac *WebtestLocationAvailabilityCriteria) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "webTestId": + if v != nil { + var webTestID string + err = json.Unmarshal(*v, &webTestID) + if err != nil { + return err + } + wlac.WebTestID = &webTestID + } + case "componentId": + if v != nil { + var componentID string + err = json.Unmarshal(*v, &componentID) + if err != nil { + return err + } + wlac.ComponentID = &componentID + } + case "failedLocationCount": + if v != nil { + var failedLocationCount float64 + err = json.Unmarshal(*v, &failedLocationCount) + if err != nil { + return err + } + wlac.FailedLocationCount = &failedLocationCount + } + default: + if v != nil { + var additionalProperties interface{} + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if wlac.AdditionalProperties == nil { + wlac.AdditionalProperties = make(map[string]interface{}) + } + wlac.AdditionalProperties[k] = additionalProperties + } + case "odata.type": + if v != nil { + var odataType OdataType + err = json.Unmarshal(*v, &odataType) + if err != nil { + return err + } + wlac.OdataType = odataType + } + } + } + + return nil +} diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/metricnamespaces.go b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/namespaces.go similarity index 58% rename from services/preview/monitor/mgmt/2018-09-01/insights/metricnamespaces.go rename to services/preview/monitor/mgmt/2021-05-01-preview/metrics/namespaces.go index f2ef47baf802..9fb796b2a49a 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/metricnamespaces.go +++ b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/namespaces.go @@ -1,4 +1,4 @@ -package insights +package metrics // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,30 +14,29 @@ import ( "net/http" ) -// MetricNamespacesClient is the monitor Management Client -type MetricNamespacesClient struct { +// NamespacesClient is the monitor Management Client +type NamespacesClient struct { BaseClient } -// NewMetricNamespacesClient creates an instance of the MetricNamespacesClient client. -func NewMetricNamespacesClient(subscriptionID string) MetricNamespacesClient { - return NewMetricNamespacesClientWithBaseURI(DefaultBaseURI, subscriptionID) +// NewNamespacesClient creates an instance of the NamespacesClient client. +func NewNamespacesClient(subscriptionID string) NamespacesClient { + return NewNamespacesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// NewMetricNamespacesClientWithBaseURI creates an instance of the MetricNamespacesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewMetricNamespacesClientWithBaseURI(baseURI string, subscriptionID string) MetricNamespacesClient { - return MetricNamespacesClient{NewWithBaseURI(baseURI, subscriptionID)} +// NewNamespacesClientWithBaseURI creates an instance of the NamespacesClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewNamespacesClientWithBaseURI(baseURI string, subscriptionID string) NamespacesClient { + return NamespacesClient{NewWithBaseURI(baseURI, subscriptionID)} } // List lists the metric namespaces for the resource. // Parameters: // resourceURI - the identifier of the resource. // startTime - the ISO 8601 conform Date start time from which to query for metric namespaces. -func (client MetricNamespacesClient) List(ctx context.Context, resourceURI string, startTime string) (result MetricNamespaceCollection, err error) { +func (client NamespacesClient) List(ctx context.Context, resourceURI string, startTime string) (result NamespaceCollection, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricNamespacesClient.List") + ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.List") defer func() { sc := -1 if result.Response.Response != nil { @@ -48,20 +47,20 @@ func (client MetricNamespacesClient) List(ctx context.Context, resourceURI strin } req, err := client.ListPreparer(ctx, resourceURI, startTime) if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricNamespacesClient", "List", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "metrics.NamespacesClient", "List", nil, "Failure preparing request") return } resp, err := client.ListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricNamespacesClient", "List", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "metrics.NamespacesClient", "List", resp, "Failure sending request") return } result, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricNamespacesClient", "List", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "metrics.NamespacesClient", "List", resp, "Failure responding to request") return } @@ -69,7 +68,7 @@ func (client MetricNamespacesClient) List(ctx context.Context, resourceURI strin } // ListPreparer prepares the List request. -func (client MetricNamespacesClient) ListPreparer(ctx context.Context, resourceURI string, startTime string) (*http.Request, error) { +func (client NamespacesClient) ListPreparer(ctx context.Context, resourceURI string, startTime string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceUri": resourceURI, } @@ -92,13 +91,13 @@ func (client MetricNamespacesClient) ListPreparer(ctx context.Context, resourceU // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. -func (client MetricNamespacesClient) ListSender(req *http.Request) (*http.Response, error) { +func (client NamespacesClient) ListSender(req *http.Request) (*http.Response, error) { return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } // ListResponder handles the response to the List request. The method always // closes the http.Response Body. -func (client MetricNamespacesClient) ListResponder(resp *http.Response) (result MetricNamespaceCollection, err error) { +func (client NamespacesClient) ListResponder(resp *http.Response) (result NamespaceCollection, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/operations.go b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/operations.go similarity index 87% rename from services/preview/monitor/mgmt/2021-04-01-preview/insights/operations.go rename to services/preview/monitor/mgmt/2021-05-01-preview/metrics/operations.go index 3f82351c7f23..5d2fa1380c84 100644 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/operations.go +++ b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/operations.go @@ -1,4 +1,4 @@ -package insights +package metrics // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -44,20 +44,20 @@ func (client OperationsClient) List(ctx context.Context) (result OperationListRe } req, err := client.ListPreparer(ctx) if err != nil { - err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "metrics.OperationsClient", "List", nil, "Failure preparing request") return } resp, err := client.ListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "metrics.OperationsClient", "List", resp, "Failure sending request") return } result, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "metrics.OperationsClient", "List", resp, "Failure responding to request") return } @@ -66,7 +66,7 @@ func (client OperationsClient) List(ctx context.Context) (result OperationListRe // ListPreparer prepares the List request. func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2015-04-01" + const APIVersion = "2021-05-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -74,7 +74,7 @@ func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/operations"), + autorest.WithPath("/providers/Microsoft.Insights/operations"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2021-05-01-preview/metrics/version.go b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/version.go new file mode 100644 index 000000000000..446ac7a0345c --- /dev/null +++ b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/version.go @@ -0,0 +1,19 @@ +package metrics + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " metrics/2021-05-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/monitor/mgmt/2021-07-01-preview/insights/CHANGELOG.md b/services/preview/monitor/mgmt/2021-07-01-preview/insights/CHANGELOG.md index 52911e4cc5e4..b79d9d634b9a 100644 --- a/services/preview/monitor/mgmt/2021-07-01-preview/insights/CHANGELOG.md +++ b/services/preview/monitor/mgmt/2021-07-01-preview/insights/CHANGELOG.md @@ -1,2 +1,7 @@ -# Change History +# Unreleased +## Breaking Changes + +### Removed Constants + +1. Operator.OperatorNotEquals diff --git a/services/preview/monitor/mgmt/2021-07-01-preview/insights/_meta.json b/services/preview/monitor/mgmt/2021-07-01-preview/insights/_meta.json index c550ff8bc061..7a79e85cc859 100644 --- a/services/preview/monitor/mgmt/2021-07-01-preview/insights/_meta.json +++ b/services/preview/monitor/mgmt/2021-07-01-preview/insights/_meta.json @@ -1,5 +1,5 @@ { - "commit": "111fbceeeb7c2c4905b80fe2ab760e5564b3458a", + "commit": "83f6c7b9ac240d3862e909245f0a61d70ae33908", "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", "tag": "package-2021-07", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/monitor/mgmt/2021-07-01-preview/insights/enums.go b/services/preview/monitor/mgmt/2021-07-01-preview/insights/enums.go index 45ab019f4e7a..eff6f3788f50 100644 --- a/services/preview/monitor/mgmt/2021-07-01-preview/insights/enums.go +++ b/services/preview/monitor/mgmt/2021-07-01-preview/insights/enums.go @@ -797,13 +797,11 @@ const ( OperatorLessThan Operator = "LessThan" // OperatorLessThanOrEqual ... OperatorLessThanOrEqual Operator = "LessThanOrEqual" - // OperatorNotEquals ... - OperatorNotEquals Operator = "NotEquals" ) // PossibleOperatorValues returns an array of possible values for the Operator const type. func PossibleOperatorValues() []Operator { - return []Operator{OperatorEquals, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorLessThan, OperatorLessThanOrEqual, OperatorNotEquals} + return []Operator{OperatorEquals, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorLessThan, OperatorLessThanOrEqual} } // ProvisioningState enumerates the values for provisioning state. diff --git a/services/preview/monitor/mgmt/2021-07-01-preview/insights/models.go b/services/preview/monitor/mgmt/2021-07-01-preview/insights/models.go index 03deec015c32..21b0a86489fd 100644 --- a/services/preview/monitor/mgmt/2021-07-01-preview/insights/models.go +++ b/services/preview/monitor/mgmt/2021-07-01-preview/insights/models.go @@ -5812,7 +5812,7 @@ type MetricBaselinesResponse struct { // MetricCriteria criterion to filter metrics. type MetricCriteria struct { - // Operator - the criteria operator. Possible values include: 'OperatorEquals', 'OperatorNotEquals', 'OperatorGreaterThan', 'OperatorGreaterThanOrEqual', 'OperatorLessThan', 'OperatorLessThanOrEqual' + // Operator - the criteria operator. Possible values include: 'OperatorEquals', 'OperatorGreaterThan', 'OperatorGreaterThanOrEqual', 'OperatorLessThan', 'OperatorLessThanOrEqual' Operator Operator `json:"operator,omitempty"` // Threshold - the criteria threshold value that activates the alert. Threshold *float64 `json:"threshold,omitempty"` diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/datacollection/CHANGELOG.md b/services/preview/monitor/mgmt/2021-09-01-preview/datacollection/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/datacollection/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/datacollection/_meta.json b/services/preview/monitor/mgmt/2021-09-01-preview/datacollection/_meta.json new file mode 100644 index 000000000000..c22e10402119 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/datacollection/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "83f6c7b9ac240d3862e909245f0a61d70ae33908", + "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", + "tag": "package-2022-02-01-preview-only", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2022-02-01-preview-only --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/datacollection/client.go b/services/preview/monitor/mgmt/2021-09-01-preview/datacollection/client.go new file mode 100644 index 000000000000..480692dff0c4 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/datacollection/client.go @@ -0,0 +1,41 @@ +// Package datacollection implements the Azure ARM Datacollection service API version 2021-09-01-preview. +// +// Monitor Management Client +package datacollection + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for 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 ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Datacollection + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Datacollection. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/datacollection/datacollectionapi/interfaces.go b/services/preview/monitor/mgmt/2021-09-01-preview/datacollection/datacollectionapi/interfaces.go new file mode 100644 index 000000000000..9ea26695f529 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/datacollection/datacollectionapi/interfaces.go @@ -0,0 +1,56 @@ +package datacollectionapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for 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 ( + "context" + "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-09-01-preview/datacollection" + "github.com/Azure/go-autorest/autorest" +) + +// EndpointsClientAPI contains the set of methods on the EndpointsClient type. +type EndpointsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body *datacollection.EndpointResource) (result datacollection.EndpointResource, err error) + Delete(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string) (result datacollection.EndpointResource, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result datacollection.EndpointResourceListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result datacollection.EndpointResourceListResultIterator, err error) + ListBySubscription(ctx context.Context) (result datacollection.EndpointResourceListResultPage, err error) + ListBySubscriptionComplete(ctx context.Context) (result datacollection.EndpointResourceListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body *datacollection.ResourceForUpdate) (result datacollection.EndpointResource, err error) +} + +var _ EndpointsClientAPI = (*datacollection.EndpointsClient)(nil) + +// RuleAssociationsClientAPI contains the set of methods on the RuleAssociationsClient type. +type RuleAssociationsClientAPI interface { + Create(ctx context.Context, resourceURI string, associationName string, body *datacollection.RuleAssociationProxyOnlyResource) (result datacollection.RuleAssociationProxyOnlyResource, err error) + Delete(ctx context.Context, resourceURI string, associationName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceURI string, associationName string) (result datacollection.RuleAssociationProxyOnlyResource, err error) + ListByDataCollectionEndpoint(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string) (result datacollection.RuleAssociationProxyOnlyResourceListResultPage, err error) + ListByDataCollectionEndpointComplete(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string) (result datacollection.RuleAssociationProxyOnlyResourceListResultIterator, err error) + ListByResource(ctx context.Context, resourceURI string) (result datacollection.RuleAssociationProxyOnlyResourceListResultPage, err error) + ListByResourceComplete(ctx context.Context, resourceURI string) (result datacollection.RuleAssociationProxyOnlyResourceListResultIterator, err error) + ListByRule(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result datacollection.RuleAssociationProxyOnlyResourceListResultPage, err error) + ListByRuleComplete(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result datacollection.RuleAssociationProxyOnlyResourceListResultIterator, err error) +} + +var _ RuleAssociationsClientAPI = (*datacollection.RuleAssociationsClient)(nil) + +// RulesClientAPI contains the set of methods on the RulesClient type. +type RulesClientAPI interface { + Create(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body *datacollection.RuleResource) (result datacollection.RuleResource, err error) + Delete(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result datacollection.RuleResource, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result datacollection.RuleResourceListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result datacollection.RuleResourceListResultIterator, err error) + ListBySubscription(ctx context.Context) (result datacollection.RuleResourceListResultPage, err error) + ListBySubscriptionComplete(ctx context.Context) (result datacollection.RuleResourceListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body *datacollection.ResourceForUpdate) (result datacollection.RuleResource, err error) +} + +var _ RulesClientAPI = (*datacollection.RulesClient)(nil) diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/datacollectionendpoints.go b/services/preview/monitor/mgmt/2021-09-01-preview/datacollection/endpoints.go similarity index 61% rename from services/preview/monitor/mgmt/2021-04-01-preview/insights/datacollectionendpoints.go rename to services/preview/monitor/mgmt/2021-09-01-preview/datacollection/endpoints.go index 7369932edf27..9bfba155cbb1 100644 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/datacollectionendpoints.go +++ b/services/preview/monitor/mgmt/2021-09-01-preview/datacollection/endpoints.go @@ -1,4 +1,4 @@ -package insights +package datacollection // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -15,21 +15,20 @@ import ( "net/http" ) -// DataCollectionEndpointsClient is the monitor Management Client -type DataCollectionEndpointsClient struct { +// EndpointsClient is the monitor Management Client +type EndpointsClient struct { BaseClient } -// NewDataCollectionEndpointsClient creates an instance of the DataCollectionEndpointsClient client. -func NewDataCollectionEndpointsClient(subscriptionID string) DataCollectionEndpointsClient { - return NewDataCollectionEndpointsClientWithBaseURI(DefaultBaseURI, subscriptionID) +// NewEndpointsClient creates an instance of the EndpointsClient client. +func NewEndpointsClient(subscriptionID string) EndpointsClient { + return NewEndpointsClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// NewDataCollectionEndpointsClientWithBaseURI creates an instance of the DataCollectionEndpointsClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewDataCollectionEndpointsClientWithBaseURI(baseURI string, subscriptionID string) DataCollectionEndpointsClient { - return DataCollectionEndpointsClient{NewWithBaseURI(baseURI, subscriptionID)} +// NewEndpointsClientWithBaseURI creates an instance of the EndpointsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewEndpointsClientWithBaseURI(baseURI string, subscriptionID string) EndpointsClient { + return EndpointsClient{NewWithBaseURI(baseURI, subscriptionID)} } // Create sends the create request. @@ -37,9 +36,9 @@ func NewDataCollectionEndpointsClientWithBaseURI(baseURI string, subscriptionID // resourceGroupName - the name of the resource group. The name is case insensitive. // dataCollectionEndpointName - the name of the data collection endpoint. The name is case insensitive. // body - the payload -func (client DataCollectionEndpointsClient) Create(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body *DataCollectionEndpointResource) (result DataCollectionEndpointResource, err error) { +func (client EndpointsClient) Create(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body *EndpointResource) (result EndpointResource, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointsClient.Create") + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.Create") defer func() { sc := -1 if result.Response.Response != nil { @@ -57,25 +56,25 @@ func (client DataCollectionEndpointsClient) Create(ctx context.Context, resource {TargetValue: body, Constraints: []validation.Constraint{{Target: "body", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("insights.DataCollectionEndpointsClient", "Create", err.Error()) + return result, validation.NewError("datacollection.EndpointsClient", "Create", err.Error()) } req, err := client.CreatePreparer(ctx, resourceGroupName, dataCollectionEndpointName, body) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Create", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "datacollection.EndpointsClient", "Create", nil, "Failure preparing request") return } resp, err := client.CreateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Create", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "datacollection.EndpointsClient", "Create", resp, "Failure sending request") return } result, err = client.CreateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Create", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "datacollection.EndpointsClient", "Create", resp, "Failure responding to request") return } @@ -83,14 +82,14 @@ func (client DataCollectionEndpointsClient) Create(ctx context.Context, resource } // CreatePreparer prepares the Create request. -func (client DataCollectionEndpointsClient) CreatePreparer(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body *DataCollectionEndpointResource) (*http.Request, error) { +func (client EndpointsClient) CreatePreparer(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body *EndpointResource) (*http.Request, error) { pathParameters := map[string]interface{}{ "dataCollectionEndpointName": autorest.Encode("path", dataCollectionEndpointName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -115,13 +114,13 @@ func (client DataCollectionEndpointsClient) CreatePreparer(ctx context.Context, // CreateSender sends the Create request. The method will close the // http.Response Body if it receives an error. -func (client DataCollectionEndpointsClient) CreateSender(req *http.Request) (*http.Response, error) { +func (client EndpointsClient) CreateSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // CreateResponder handles the response to the Create request. The method always // closes the http.Response Body. -func (client DataCollectionEndpointsClient) CreateResponder(resp *http.Response) (result DataCollectionEndpointResource, err error) { +func (client EndpointsClient) CreateResponder(resp *http.Response) (result EndpointResource, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), @@ -135,9 +134,9 @@ func (client DataCollectionEndpointsClient) CreateResponder(resp *http.Response) // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. // dataCollectionEndpointName - the name of the data collection endpoint. The name is case insensitive. -func (client DataCollectionEndpointsClient) Delete(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string) (result autorest.Response, err error) { +func (client EndpointsClient) Delete(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string) (result autorest.Response, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointsClient.Delete") + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.Delete") defer func() { sc := -1 if result.Response != nil { @@ -152,25 +151,25 @@ func (client DataCollectionEndpointsClient) Delete(ctx context.Context, resource {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DataCollectionEndpointsClient", "Delete", err.Error()) + return result, validation.NewError("datacollection.EndpointsClient", "Delete", err.Error()) } req, err := client.DeletePreparer(ctx, resourceGroupName, dataCollectionEndpointName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Delete", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "datacollection.EndpointsClient", "Delete", nil, "Failure preparing request") return } resp, err := client.DeleteSender(req) if err != nil { result.Response = resp - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Delete", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "datacollection.EndpointsClient", "Delete", resp, "Failure sending request") return } result, err = client.DeleteResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Delete", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "datacollection.EndpointsClient", "Delete", resp, "Failure responding to request") return } @@ -178,14 +177,14 @@ func (client DataCollectionEndpointsClient) Delete(ctx context.Context, resource } // DeletePreparer prepares the Delete request. -func (client DataCollectionEndpointsClient) DeletePreparer(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string) (*http.Request, error) { +func (client EndpointsClient) DeletePreparer(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "dataCollectionEndpointName": autorest.Encode("path", dataCollectionEndpointName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -200,13 +199,13 @@ func (client DataCollectionEndpointsClient) DeletePreparer(ctx context.Context, // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. -func (client DataCollectionEndpointsClient) DeleteSender(req *http.Request) (*http.Response, error) { +func (client EndpointsClient) DeleteSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. -func (client DataCollectionEndpointsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { +func (client EndpointsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), @@ -219,9 +218,9 @@ func (client DataCollectionEndpointsClient) DeleteResponder(resp *http.Response) // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. // dataCollectionEndpointName - the name of the data collection endpoint. The name is case insensitive. -func (client DataCollectionEndpointsClient) Get(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string) (result DataCollectionEndpointResource, err error) { +func (client EndpointsClient) Get(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string) (result EndpointResource, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointsClient.Get") + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.Get") defer func() { sc := -1 if result.Response.Response != nil { @@ -236,25 +235,25 @@ func (client DataCollectionEndpointsClient) Get(ctx context.Context, resourceGro {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DataCollectionEndpointsClient", "Get", err.Error()) + return result, validation.NewError("datacollection.EndpointsClient", "Get", err.Error()) } req, err := client.GetPreparer(ctx, resourceGroupName, dataCollectionEndpointName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Get", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "datacollection.EndpointsClient", "Get", nil, "Failure preparing request") return } resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Get", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "datacollection.EndpointsClient", "Get", resp, "Failure sending request") return } result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Get", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "datacollection.EndpointsClient", "Get", resp, "Failure responding to request") return } @@ -262,14 +261,14 @@ func (client DataCollectionEndpointsClient) Get(ctx context.Context, resourceGro } // GetPreparer prepares the Get request. -func (client DataCollectionEndpointsClient) GetPreparer(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string) (*http.Request, error) { +func (client EndpointsClient) GetPreparer(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "dataCollectionEndpointName": autorest.Encode("path", dataCollectionEndpointName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -284,13 +283,13 @@ func (client DataCollectionEndpointsClient) GetPreparer(ctx context.Context, res // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. -func (client DataCollectionEndpointsClient) GetSender(req *http.Request) (*http.Response, error) { +func (client EndpointsClient) GetSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client DataCollectionEndpointsClient) GetResponder(resp *http.Response) (result DataCollectionEndpointResource, err error) { +func (client EndpointsClient) GetResponder(resp *http.Response) (result EndpointResource, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -303,13 +302,13 @@ func (client DataCollectionEndpointsClient) GetResponder(resp *http.Response) (r // ListByResourceGroup sends the list by resource group request. // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. -func (client DataCollectionEndpointsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DataCollectionEndpointResourceListResultPage, err error) { +func (client EndpointsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result EndpointResourceListResultPage, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointsClient.ListByResourceGroup") + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.ListByResourceGroup") defer func() { sc := -1 - if result.dcerlr.Response.Response != nil { - sc = result.dcerlr.Response.Response.StatusCode + if result.erlr.Response.Response != nil { + sc = result.erlr.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() @@ -320,29 +319,29 @@ func (client DataCollectionEndpointsClient) ListByResourceGroup(ctx context.Cont {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DataCollectionEndpointsClient", "ListByResourceGroup", err.Error()) + return result, validation.NewError("datacollection.EndpointsClient", "ListByResourceGroup", err.Error()) } result.fn = client.listByResourceGroupNextResults req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "ListByResourceGroup", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "datacollection.EndpointsClient", "ListByResourceGroup", nil, "Failure preparing request") return } resp, err := client.ListByResourceGroupSender(req) if err != nil { - result.dcerlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "ListByResourceGroup", resp, "Failure sending request") + result.erlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datacollection.EndpointsClient", "ListByResourceGroup", resp, "Failure sending request") return } - result.dcerlr, err = client.ListByResourceGroupResponder(resp) + result.erlr, err = client.ListByResourceGroupResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "ListByResourceGroup", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "datacollection.EndpointsClient", "ListByResourceGroup", resp, "Failure responding to request") return } - if result.dcerlr.hasNextLink() && result.dcerlr.IsEmpty() { + if result.erlr.hasNextLink() && result.erlr.IsEmpty() { err = result.NextWithContext(ctx) return } @@ -351,13 +350,13 @@ func (client DataCollectionEndpointsClient) ListByResourceGroup(ctx context.Cont } // ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client DataCollectionEndpointsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { +func (client EndpointsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -372,13 +371,13 @@ func (client DataCollectionEndpointsClient) ListByResourceGroupPreparer(ctx cont // ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the // http.Response Body if it receives an error. -func (client DataCollectionEndpointsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { +func (client EndpointsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always // closes the http.Response Body. -func (client DataCollectionEndpointsClient) ListByResourceGroupResponder(resp *http.Response) (result DataCollectionEndpointResourceListResult, err error) { +func (client EndpointsClient) ListByResourceGroupResponder(resp *http.Response) (result EndpointResourceListResult, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -389,10 +388,10 @@ func (client DataCollectionEndpointsClient) ListByResourceGroupResponder(resp *h } // listByResourceGroupNextResults retrieves the next set of results, if any. -func (client DataCollectionEndpointsClient) listByResourceGroupNextResults(ctx context.Context, lastResults DataCollectionEndpointResourceListResult) (result DataCollectionEndpointResourceListResult, err error) { - req, err := lastResults.dataCollectionEndpointResourceListResultPreparer(ctx) +func (client EndpointsClient) listByResourceGroupNextResults(ctx context.Context, lastResults EndpointResourceListResult) (result EndpointResourceListResult, err error) { + req, err := lastResults.endpointResourceListResultPreparer(ctx) if err != nil { - return result, autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "datacollection.EndpointsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") } if req == nil { return @@ -400,19 +399,19 @@ func (client DataCollectionEndpointsClient) listByResourceGroupNextResults(ctx c resp, err := client.ListByResourceGroupSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "datacollection.EndpointsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") } result, err = client.ListByResourceGroupResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "datacollection.EndpointsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") } return } // ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client DataCollectionEndpointsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result DataCollectionEndpointResourceListResultIterator, err error) { +func (client EndpointsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result EndpointResourceListResultIterator, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointsClient.ListByResourceGroup") + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.ListByResourceGroup") defer func() { sc := -1 if result.Response().Response.Response != nil { @@ -426,13 +425,13 @@ func (client DataCollectionEndpointsClient) ListByResourceGroupComplete(ctx cont } // ListBySubscription sends the list by subscription request. -func (client DataCollectionEndpointsClient) ListBySubscription(ctx context.Context) (result DataCollectionEndpointResourceListResultPage, err error) { +func (client EndpointsClient) ListBySubscription(ctx context.Context) (result EndpointResourceListResultPage, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointsClient.ListBySubscription") + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.ListBySubscription") defer func() { sc := -1 - if result.dcerlr.Response.Response != nil { - sc = result.dcerlr.Response.Response.StatusCode + if result.erlr.Response.Response != nil { + sc = result.erlr.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() @@ -440,29 +439,29 @@ func (client DataCollectionEndpointsClient) ListBySubscription(ctx context.Conte if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DataCollectionEndpointsClient", "ListBySubscription", err.Error()) + return result, validation.NewError("datacollection.EndpointsClient", "ListBySubscription", err.Error()) } result.fn = client.listBySubscriptionNextResults req, err := client.ListBySubscriptionPreparer(ctx) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "ListBySubscription", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "datacollection.EndpointsClient", "ListBySubscription", nil, "Failure preparing request") return } resp, err := client.ListBySubscriptionSender(req) if err != nil { - result.dcerlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "ListBySubscription", resp, "Failure sending request") + result.erlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datacollection.EndpointsClient", "ListBySubscription", resp, "Failure sending request") return } - result.dcerlr, err = client.ListBySubscriptionResponder(resp) + result.erlr, err = client.ListBySubscriptionResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "ListBySubscription", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "datacollection.EndpointsClient", "ListBySubscription", resp, "Failure responding to request") return } - if result.dcerlr.hasNextLink() && result.dcerlr.IsEmpty() { + if result.erlr.hasNextLink() && result.erlr.IsEmpty() { err = result.NextWithContext(ctx) return } @@ -471,12 +470,12 @@ func (client DataCollectionEndpointsClient) ListBySubscription(ctx context.Conte } // ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client DataCollectionEndpointsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { +func (client EndpointsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { pathParameters := map[string]interface{}{ "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -491,13 +490,13 @@ func (client DataCollectionEndpointsClient) ListBySubscriptionPreparer(ctx conte // ListBySubscriptionSender sends the ListBySubscription request. The method will close the // http.Response Body if it receives an error. -func (client DataCollectionEndpointsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { +func (client EndpointsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always // closes the http.Response Body. -func (client DataCollectionEndpointsClient) ListBySubscriptionResponder(resp *http.Response) (result DataCollectionEndpointResourceListResult, err error) { +func (client EndpointsClient) ListBySubscriptionResponder(resp *http.Response) (result EndpointResourceListResult, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -508,10 +507,10 @@ func (client DataCollectionEndpointsClient) ListBySubscriptionResponder(resp *ht } // listBySubscriptionNextResults retrieves the next set of results, if any. -func (client DataCollectionEndpointsClient) listBySubscriptionNextResults(ctx context.Context, lastResults DataCollectionEndpointResourceListResult) (result DataCollectionEndpointResourceListResult, err error) { - req, err := lastResults.dataCollectionEndpointResourceListResultPreparer(ctx) +func (client EndpointsClient) listBySubscriptionNextResults(ctx context.Context, lastResults EndpointResourceListResult) (result EndpointResourceListResult, err error) { + req, err := lastResults.endpointResourceListResultPreparer(ctx) if err != nil { - return result, autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "datacollection.EndpointsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") } if req == nil { return @@ -519,19 +518,19 @@ func (client DataCollectionEndpointsClient) listBySubscriptionNextResults(ctx co resp, err := client.ListBySubscriptionSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "datacollection.EndpointsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") } result, err = client.ListBySubscriptionResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "datacollection.EndpointsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") } return } // ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client DataCollectionEndpointsClient) ListBySubscriptionComplete(ctx context.Context) (result DataCollectionEndpointResourceListResultIterator, err error) { +func (client EndpointsClient) ListBySubscriptionComplete(ctx context.Context) (result EndpointResourceListResultIterator, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointsClient.ListBySubscription") + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.ListBySubscription") defer func() { sc := -1 if result.Response().Response.Response != nil { @@ -549,9 +548,9 @@ func (client DataCollectionEndpointsClient) ListBySubscriptionComplete(ctx conte // resourceGroupName - the name of the resource group. The name is case insensitive. // dataCollectionEndpointName - the name of the data collection endpoint. The name is case insensitive. // body - the payload -func (client DataCollectionEndpointsClient) Update(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body *ResourceForUpdate) (result DataCollectionEndpointResource, err error) { +func (client EndpointsClient) Update(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body *ResourceForUpdate) (result EndpointResource, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointsClient.Update") + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.Update") defer func() { sc := -1 if result.Response.Response != nil { @@ -566,25 +565,25 @@ func (client DataCollectionEndpointsClient) Update(ctx context.Context, resource {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DataCollectionEndpointsClient", "Update", err.Error()) + return result, validation.NewError("datacollection.EndpointsClient", "Update", err.Error()) } req, err := client.UpdatePreparer(ctx, resourceGroupName, dataCollectionEndpointName, body) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Update", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "datacollection.EndpointsClient", "Update", nil, "Failure preparing request") return } resp, err := client.UpdateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Update", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "datacollection.EndpointsClient", "Update", resp, "Failure sending request") return } result, err = client.UpdateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Update", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "datacollection.EndpointsClient", "Update", resp, "Failure responding to request") return } @@ -592,14 +591,14 @@ func (client DataCollectionEndpointsClient) Update(ctx context.Context, resource } // UpdatePreparer prepares the Update request. -func (client DataCollectionEndpointsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body *ResourceForUpdate) (*http.Request, error) { +func (client EndpointsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body *ResourceForUpdate) (*http.Request, error) { pathParameters := map[string]interface{}{ "dataCollectionEndpointName": autorest.Encode("path", dataCollectionEndpointName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -619,13 +618,13 @@ func (client DataCollectionEndpointsClient) UpdatePreparer(ctx context.Context, // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. -func (client DataCollectionEndpointsClient) UpdateSender(req *http.Request) (*http.Response, error) { +func (client EndpointsClient) UpdateSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. -func (client DataCollectionEndpointsClient) UpdateResponder(resp *http.Response) (result DataCollectionEndpointResource, err error) { +func (client EndpointsClient) UpdateResponder(resp *http.Response) (result EndpointResource, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/datacollection/enums.go b/services/preview/monitor/mgmt/2021-09-01-preview/datacollection/enums.go new file mode 100644 index 000000000000..82c985b97fe0 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/datacollection/enums.go @@ -0,0 +1,360 @@ +package datacollection + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // Application ... + Application CreatedByType = "Application" + // Key ... + Key CreatedByType = "Key" + // ManagedIdentity ... + ManagedIdentity CreatedByType = "ManagedIdentity" + // User ... + User CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{Application, Key, ManagedIdentity, User} +} + +// KnownColumnDefinitionType enumerates the values for known column definition type. +type KnownColumnDefinitionType string + +const ( + // Boolean ... + Boolean KnownColumnDefinitionType = "boolean" + // Datetime ... + Datetime KnownColumnDefinitionType = "datetime" + // Dynamic ... + Dynamic KnownColumnDefinitionType = "dynamic" + // Int ... + Int KnownColumnDefinitionType = "int" + // Long ... + Long KnownColumnDefinitionType = "long" + // Real ... + Real KnownColumnDefinitionType = "real" + // String ... + String KnownColumnDefinitionType = "string" +) + +// PossibleKnownColumnDefinitionTypeValues returns an array of possible values for the KnownColumnDefinitionType const type. +func PossibleKnownColumnDefinitionTypeValues() []KnownColumnDefinitionType { + return []KnownColumnDefinitionType{Boolean, Datetime, Dynamic, Int, Long, Real, String} +} + +// KnownDataCollectionEndpointProvisioningState enumerates the values for known data collection endpoint +// provisioning state. +type KnownDataCollectionEndpointProvisioningState string + +const ( + // Creating ... + Creating KnownDataCollectionEndpointProvisioningState = "Creating" + // Deleting ... + Deleting KnownDataCollectionEndpointProvisioningState = "Deleting" + // Failed ... + Failed KnownDataCollectionEndpointProvisioningState = "Failed" + // Succeeded ... + Succeeded KnownDataCollectionEndpointProvisioningState = "Succeeded" + // Updating ... + Updating KnownDataCollectionEndpointProvisioningState = "Updating" +) + +// PossibleKnownDataCollectionEndpointProvisioningStateValues returns an array of possible values for the KnownDataCollectionEndpointProvisioningState const type. +func PossibleKnownDataCollectionEndpointProvisioningStateValues() []KnownDataCollectionEndpointProvisioningState { + return []KnownDataCollectionEndpointProvisioningState{Creating, Deleting, Failed, Succeeded, Updating} +} + +// KnownDataCollectionEndpointResourceKind enumerates the values for known data collection endpoint resource +// kind. +type KnownDataCollectionEndpointResourceKind string + +const ( + // Linux ... + Linux KnownDataCollectionEndpointResourceKind = "Linux" + // Windows ... + Windows KnownDataCollectionEndpointResourceKind = "Windows" +) + +// PossibleKnownDataCollectionEndpointResourceKindValues returns an array of possible values for the KnownDataCollectionEndpointResourceKind const type. +func PossibleKnownDataCollectionEndpointResourceKindValues() []KnownDataCollectionEndpointResourceKind { + return []KnownDataCollectionEndpointResourceKind{Linux, Windows} +} + +// KnownDataCollectionRuleAssociationProvisioningState enumerates the values for known data collection rule +// association provisioning state. +type KnownDataCollectionRuleAssociationProvisioningState string + +const ( + // KnownDataCollectionRuleAssociationProvisioningStateCreating ... + KnownDataCollectionRuleAssociationProvisioningStateCreating KnownDataCollectionRuleAssociationProvisioningState = "Creating" + // KnownDataCollectionRuleAssociationProvisioningStateDeleting ... + KnownDataCollectionRuleAssociationProvisioningStateDeleting KnownDataCollectionRuleAssociationProvisioningState = "Deleting" + // KnownDataCollectionRuleAssociationProvisioningStateFailed ... + KnownDataCollectionRuleAssociationProvisioningStateFailed KnownDataCollectionRuleAssociationProvisioningState = "Failed" + // KnownDataCollectionRuleAssociationProvisioningStateSucceeded ... + KnownDataCollectionRuleAssociationProvisioningStateSucceeded KnownDataCollectionRuleAssociationProvisioningState = "Succeeded" + // KnownDataCollectionRuleAssociationProvisioningStateUpdating ... + KnownDataCollectionRuleAssociationProvisioningStateUpdating KnownDataCollectionRuleAssociationProvisioningState = "Updating" +) + +// PossibleKnownDataCollectionRuleAssociationProvisioningStateValues returns an array of possible values for the KnownDataCollectionRuleAssociationProvisioningState const type. +func PossibleKnownDataCollectionRuleAssociationProvisioningStateValues() []KnownDataCollectionRuleAssociationProvisioningState { + return []KnownDataCollectionRuleAssociationProvisioningState{KnownDataCollectionRuleAssociationProvisioningStateCreating, KnownDataCollectionRuleAssociationProvisioningStateDeleting, KnownDataCollectionRuleAssociationProvisioningStateFailed, KnownDataCollectionRuleAssociationProvisioningStateSucceeded, KnownDataCollectionRuleAssociationProvisioningStateUpdating} +} + +// KnownDataCollectionRuleProvisioningState enumerates the values for known data collection rule provisioning +// state. +type KnownDataCollectionRuleProvisioningState string + +const ( + // KnownDataCollectionRuleProvisioningStateCreating ... + KnownDataCollectionRuleProvisioningStateCreating KnownDataCollectionRuleProvisioningState = "Creating" + // KnownDataCollectionRuleProvisioningStateDeleting ... + KnownDataCollectionRuleProvisioningStateDeleting KnownDataCollectionRuleProvisioningState = "Deleting" + // KnownDataCollectionRuleProvisioningStateFailed ... + KnownDataCollectionRuleProvisioningStateFailed KnownDataCollectionRuleProvisioningState = "Failed" + // KnownDataCollectionRuleProvisioningStateSucceeded ... + KnownDataCollectionRuleProvisioningStateSucceeded KnownDataCollectionRuleProvisioningState = "Succeeded" + // KnownDataCollectionRuleProvisioningStateUpdating ... + KnownDataCollectionRuleProvisioningStateUpdating KnownDataCollectionRuleProvisioningState = "Updating" +) + +// PossibleKnownDataCollectionRuleProvisioningStateValues returns an array of possible values for the KnownDataCollectionRuleProvisioningState const type. +func PossibleKnownDataCollectionRuleProvisioningStateValues() []KnownDataCollectionRuleProvisioningState { + return []KnownDataCollectionRuleProvisioningState{KnownDataCollectionRuleProvisioningStateCreating, KnownDataCollectionRuleProvisioningStateDeleting, KnownDataCollectionRuleProvisioningStateFailed, KnownDataCollectionRuleProvisioningStateSucceeded, KnownDataCollectionRuleProvisioningStateUpdating} +} + +// KnownDataCollectionRuleResourceKind enumerates the values for known data collection rule resource kind. +type KnownDataCollectionRuleResourceKind string + +const ( + // KnownDataCollectionRuleResourceKindLinux ... + KnownDataCollectionRuleResourceKindLinux KnownDataCollectionRuleResourceKind = "Linux" + // KnownDataCollectionRuleResourceKindWindows ... + KnownDataCollectionRuleResourceKindWindows KnownDataCollectionRuleResourceKind = "Windows" +) + +// PossibleKnownDataCollectionRuleResourceKindValues returns an array of possible values for the KnownDataCollectionRuleResourceKind const type. +func PossibleKnownDataCollectionRuleResourceKindValues() []KnownDataCollectionRuleResourceKind { + return []KnownDataCollectionRuleResourceKind{KnownDataCollectionRuleResourceKindLinux, KnownDataCollectionRuleResourceKindWindows} +} + +// KnownDataFlowStreams enumerates the values for known data flow streams. +type KnownDataFlowStreams string + +const ( + // MicrosoftEvent ... + MicrosoftEvent KnownDataFlowStreams = "Microsoft-Event" + // MicrosoftInsightsMetrics ... + MicrosoftInsightsMetrics KnownDataFlowStreams = "Microsoft-InsightsMetrics" + // MicrosoftPerf ... + MicrosoftPerf KnownDataFlowStreams = "Microsoft-Perf" + // MicrosoftSyslog ... + MicrosoftSyslog KnownDataFlowStreams = "Microsoft-Syslog" + // MicrosoftWindowsEvent ... + MicrosoftWindowsEvent KnownDataFlowStreams = "Microsoft-WindowsEvent" +) + +// PossibleKnownDataFlowStreamsValues returns an array of possible values for the KnownDataFlowStreams const type. +func PossibleKnownDataFlowStreamsValues() []KnownDataFlowStreams { + return []KnownDataFlowStreams{MicrosoftEvent, MicrosoftInsightsMetrics, MicrosoftPerf, MicrosoftSyslog, MicrosoftWindowsEvent} +} + +// KnownExtensionDataSourceStreams enumerates the values for known extension data source streams. +type KnownExtensionDataSourceStreams string + +const ( + // KnownExtensionDataSourceStreamsMicrosoftEvent ... + KnownExtensionDataSourceStreamsMicrosoftEvent KnownExtensionDataSourceStreams = "Microsoft-Event" + // KnownExtensionDataSourceStreamsMicrosoftInsightsMetrics ... + KnownExtensionDataSourceStreamsMicrosoftInsightsMetrics KnownExtensionDataSourceStreams = "Microsoft-InsightsMetrics" + // KnownExtensionDataSourceStreamsMicrosoftPerf ... + KnownExtensionDataSourceStreamsMicrosoftPerf KnownExtensionDataSourceStreams = "Microsoft-Perf" + // KnownExtensionDataSourceStreamsMicrosoftSyslog ... + KnownExtensionDataSourceStreamsMicrosoftSyslog KnownExtensionDataSourceStreams = "Microsoft-Syslog" + // KnownExtensionDataSourceStreamsMicrosoftWindowsEvent ... + KnownExtensionDataSourceStreamsMicrosoftWindowsEvent KnownExtensionDataSourceStreams = "Microsoft-WindowsEvent" +) + +// PossibleKnownExtensionDataSourceStreamsValues returns an array of possible values for the KnownExtensionDataSourceStreams const type. +func PossibleKnownExtensionDataSourceStreamsValues() []KnownExtensionDataSourceStreams { + return []KnownExtensionDataSourceStreams{KnownExtensionDataSourceStreamsMicrosoftEvent, KnownExtensionDataSourceStreamsMicrosoftInsightsMetrics, KnownExtensionDataSourceStreamsMicrosoftPerf, KnownExtensionDataSourceStreamsMicrosoftSyslog, KnownExtensionDataSourceStreamsMicrosoftWindowsEvent} +} + +// KnownLogFileTextSettingsRecordStartTimestampFormat enumerates the values for known log file text settings +// record start timestamp format. +type KnownLogFileTextSettingsRecordStartTimestampFormat string + +const ( + // DdMMMyyyyHHmmsszzz ... + DdMMMyyyyHHmmsszzz KnownLogFileTextSettingsRecordStartTimestampFormat = "dd/MMM/yyyy:HH:mm:ss zzz" + // DdMMyyHHmmss ... + DdMMyyHHmmss KnownLogFileTextSettingsRecordStartTimestampFormat = "ddMMyy HH:mm:ss" + // ISO8601 ... + ISO8601 KnownLogFileTextSettingsRecordStartTimestampFormat = "ISO 8601" + // MDYYYYHHMMSSAMPM ... + MDYYYYHHMMSSAMPM KnownLogFileTextSettingsRecordStartTimestampFormat = "M/D/YYYY HH:MM:SS AM/PM" + // MMMdhhmmss ... + MMMdhhmmss KnownLogFileTextSettingsRecordStartTimestampFormat = "MMM d hh:mm:ss" + // MonDDYYYYHHMMSS ... + MonDDYYYYHHMMSS KnownLogFileTextSettingsRecordStartTimestampFormat = "Mon DD, YYYY HH:MM:SS" + // YyMMddHHmmss ... + YyMMddHHmmss KnownLogFileTextSettingsRecordStartTimestampFormat = "yyMMdd HH:mm:ss" + // YYYYMMDDHHMMSS ... + YYYYMMDDHHMMSS KnownLogFileTextSettingsRecordStartTimestampFormat = "YYYY-MM-DD HH:MM:SS" + // YyyyMMDdTHHmmssK ... + YyyyMMDdTHHmmssK KnownLogFileTextSettingsRecordStartTimestampFormat = "yyyy-MM-ddTHH:mm:ssK" +) + +// PossibleKnownLogFileTextSettingsRecordStartTimestampFormatValues returns an array of possible values for the KnownLogFileTextSettingsRecordStartTimestampFormat const type. +func PossibleKnownLogFileTextSettingsRecordStartTimestampFormatValues() []KnownLogFileTextSettingsRecordStartTimestampFormat { + return []KnownLogFileTextSettingsRecordStartTimestampFormat{DdMMMyyyyHHmmsszzz, DdMMyyHHmmss, ISO8601, MDYYYYHHMMSSAMPM, MMMdhhmmss, MonDDYYYYHHMMSS, YyMMddHHmmss, YYYYMMDDHHMMSS, YyyyMMDdTHHmmssK} +} + +// KnownPerfCounterDataSourceStreams enumerates the values for known perf counter data source streams. +type KnownPerfCounterDataSourceStreams string + +const ( + // KnownPerfCounterDataSourceStreamsMicrosoftInsightsMetrics ... + KnownPerfCounterDataSourceStreamsMicrosoftInsightsMetrics KnownPerfCounterDataSourceStreams = "Microsoft-InsightsMetrics" + // KnownPerfCounterDataSourceStreamsMicrosoftPerf ... + KnownPerfCounterDataSourceStreamsMicrosoftPerf KnownPerfCounterDataSourceStreams = "Microsoft-Perf" +) + +// PossibleKnownPerfCounterDataSourceStreamsValues returns an array of possible values for the KnownPerfCounterDataSourceStreams const type. +func PossibleKnownPerfCounterDataSourceStreamsValues() []KnownPerfCounterDataSourceStreams { + return []KnownPerfCounterDataSourceStreams{KnownPerfCounterDataSourceStreamsMicrosoftInsightsMetrics, KnownPerfCounterDataSourceStreamsMicrosoftPerf} +} + +// KnownPublicNetworkAccessOptions enumerates the values for known public network access options. +type KnownPublicNetworkAccessOptions string + +const ( + // Disabled ... + Disabled KnownPublicNetworkAccessOptions = "Disabled" + // Enabled ... + Enabled KnownPublicNetworkAccessOptions = "Enabled" +) + +// PossibleKnownPublicNetworkAccessOptionsValues returns an array of possible values for the KnownPublicNetworkAccessOptions const type. +func PossibleKnownPublicNetworkAccessOptionsValues() []KnownPublicNetworkAccessOptions { + return []KnownPublicNetworkAccessOptions{Disabled, Enabled} +} + +// KnownSyslogDataSourceFacilityNames enumerates the values for known syslog data source facility names. +type KnownSyslogDataSourceFacilityNames string + +const ( + // KnownSyslogDataSourceFacilityNamesAsterisk ... + KnownSyslogDataSourceFacilityNamesAsterisk KnownSyslogDataSourceFacilityNames = "*" + // KnownSyslogDataSourceFacilityNamesAuth ... + KnownSyslogDataSourceFacilityNamesAuth KnownSyslogDataSourceFacilityNames = "auth" + // KnownSyslogDataSourceFacilityNamesAuthpriv ... + KnownSyslogDataSourceFacilityNamesAuthpriv KnownSyslogDataSourceFacilityNames = "authpriv" + // KnownSyslogDataSourceFacilityNamesCron ... + KnownSyslogDataSourceFacilityNamesCron KnownSyslogDataSourceFacilityNames = "cron" + // KnownSyslogDataSourceFacilityNamesDaemon ... + KnownSyslogDataSourceFacilityNamesDaemon KnownSyslogDataSourceFacilityNames = "daemon" + // KnownSyslogDataSourceFacilityNamesKern ... + KnownSyslogDataSourceFacilityNamesKern KnownSyslogDataSourceFacilityNames = "kern" + // KnownSyslogDataSourceFacilityNamesLocal0 ... + KnownSyslogDataSourceFacilityNamesLocal0 KnownSyslogDataSourceFacilityNames = "local0" + // KnownSyslogDataSourceFacilityNamesLocal1 ... + KnownSyslogDataSourceFacilityNamesLocal1 KnownSyslogDataSourceFacilityNames = "local1" + // KnownSyslogDataSourceFacilityNamesLocal2 ... + KnownSyslogDataSourceFacilityNamesLocal2 KnownSyslogDataSourceFacilityNames = "local2" + // KnownSyslogDataSourceFacilityNamesLocal3 ... + KnownSyslogDataSourceFacilityNamesLocal3 KnownSyslogDataSourceFacilityNames = "local3" + // KnownSyslogDataSourceFacilityNamesLocal4 ... + KnownSyslogDataSourceFacilityNamesLocal4 KnownSyslogDataSourceFacilityNames = "local4" + // KnownSyslogDataSourceFacilityNamesLocal5 ... + KnownSyslogDataSourceFacilityNamesLocal5 KnownSyslogDataSourceFacilityNames = "local5" + // KnownSyslogDataSourceFacilityNamesLocal6 ... + KnownSyslogDataSourceFacilityNamesLocal6 KnownSyslogDataSourceFacilityNames = "local6" + // KnownSyslogDataSourceFacilityNamesLocal7 ... + KnownSyslogDataSourceFacilityNamesLocal7 KnownSyslogDataSourceFacilityNames = "local7" + // KnownSyslogDataSourceFacilityNamesLpr ... + KnownSyslogDataSourceFacilityNamesLpr KnownSyslogDataSourceFacilityNames = "lpr" + // KnownSyslogDataSourceFacilityNamesMail ... + KnownSyslogDataSourceFacilityNamesMail KnownSyslogDataSourceFacilityNames = "mail" + // KnownSyslogDataSourceFacilityNamesMark ... + KnownSyslogDataSourceFacilityNamesMark KnownSyslogDataSourceFacilityNames = "mark" + // KnownSyslogDataSourceFacilityNamesNews ... + KnownSyslogDataSourceFacilityNamesNews KnownSyslogDataSourceFacilityNames = "news" + // KnownSyslogDataSourceFacilityNamesSyslog ... + KnownSyslogDataSourceFacilityNamesSyslog KnownSyslogDataSourceFacilityNames = "syslog" + // KnownSyslogDataSourceFacilityNamesUser ... + KnownSyslogDataSourceFacilityNamesUser KnownSyslogDataSourceFacilityNames = "user" + // KnownSyslogDataSourceFacilityNamesUucp ... + KnownSyslogDataSourceFacilityNamesUucp KnownSyslogDataSourceFacilityNames = "uucp" +) + +// PossibleKnownSyslogDataSourceFacilityNamesValues returns an array of possible values for the KnownSyslogDataSourceFacilityNames const type. +func PossibleKnownSyslogDataSourceFacilityNamesValues() []KnownSyslogDataSourceFacilityNames { + return []KnownSyslogDataSourceFacilityNames{KnownSyslogDataSourceFacilityNamesAsterisk, KnownSyslogDataSourceFacilityNamesAuth, KnownSyslogDataSourceFacilityNamesAuthpriv, KnownSyslogDataSourceFacilityNamesCron, KnownSyslogDataSourceFacilityNamesDaemon, KnownSyslogDataSourceFacilityNamesKern, KnownSyslogDataSourceFacilityNamesLocal0, KnownSyslogDataSourceFacilityNamesLocal1, KnownSyslogDataSourceFacilityNamesLocal2, KnownSyslogDataSourceFacilityNamesLocal3, KnownSyslogDataSourceFacilityNamesLocal4, KnownSyslogDataSourceFacilityNamesLocal5, KnownSyslogDataSourceFacilityNamesLocal6, KnownSyslogDataSourceFacilityNamesLocal7, KnownSyslogDataSourceFacilityNamesLpr, KnownSyslogDataSourceFacilityNamesMail, KnownSyslogDataSourceFacilityNamesMark, KnownSyslogDataSourceFacilityNamesNews, KnownSyslogDataSourceFacilityNamesSyslog, KnownSyslogDataSourceFacilityNamesUser, KnownSyslogDataSourceFacilityNamesUucp} +} + +// KnownSyslogDataSourceLogLevels enumerates the values for known syslog data source log levels. +type KnownSyslogDataSourceLogLevels string + +const ( + // Alert ... + Alert KnownSyslogDataSourceLogLevels = "Alert" + // Asterisk ... + Asterisk KnownSyslogDataSourceLogLevels = "*" + // Critical ... + Critical KnownSyslogDataSourceLogLevels = "Critical" + // Debug ... + Debug KnownSyslogDataSourceLogLevels = "Debug" + // Emergency ... + Emergency KnownSyslogDataSourceLogLevels = "Emergency" + // Error ... + Error KnownSyslogDataSourceLogLevels = "Error" + // Info ... + Info KnownSyslogDataSourceLogLevels = "Info" + // Notice ... + Notice KnownSyslogDataSourceLogLevels = "Notice" + // Warning ... + Warning KnownSyslogDataSourceLogLevels = "Warning" +) + +// PossibleKnownSyslogDataSourceLogLevelsValues returns an array of possible values for the KnownSyslogDataSourceLogLevels const type. +func PossibleKnownSyslogDataSourceLogLevelsValues() []KnownSyslogDataSourceLogLevels { + return []KnownSyslogDataSourceLogLevels{Alert, Asterisk, Critical, Debug, Emergency, Error, Info, Notice, Warning} +} + +// KnownSyslogDataSourceStreams enumerates the values for known syslog data source streams. +type KnownSyslogDataSourceStreams string + +const ( + // KnownSyslogDataSourceStreamsMicrosoftSyslog ... + KnownSyslogDataSourceStreamsMicrosoftSyslog KnownSyslogDataSourceStreams = "Microsoft-Syslog" +) + +// PossibleKnownSyslogDataSourceStreamsValues returns an array of possible values for the KnownSyslogDataSourceStreams const type. +func PossibleKnownSyslogDataSourceStreamsValues() []KnownSyslogDataSourceStreams { + return []KnownSyslogDataSourceStreams{KnownSyslogDataSourceStreamsMicrosoftSyslog} +} + +// KnownWindowsEventLogDataSourceStreams enumerates the values for known windows event log data source streams. +type KnownWindowsEventLogDataSourceStreams string + +const ( + // KnownWindowsEventLogDataSourceStreamsMicrosoftEvent ... + KnownWindowsEventLogDataSourceStreamsMicrosoftEvent KnownWindowsEventLogDataSourceStreams = "Microsoft-Event" + // KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent ... + KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent KnownWindowsEventLogDataSourceStreams = "Microsoft-WindowsEvent" +) + +// PossibleKnownWindowsEventLogDataSourceStreamsValues returns an array of possible values for the KnownWindowsEventLogDataSourceStreams const type. +func PossibleKnownWindowsEventLogDataSourceStreamsValues() []KnownWindowsEventLogDataSourceStreams { + return []KnownWindowsEventLogDataSourceStreams{KnownWindowsEventLogDataSourceStreamsMicrosoftEvent, KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent} +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/datacollection/models.go b/services/preview/monitor/mgmt/2021-09-01-preview/datacollection/models.go new file mode 100644 index 000000000000..3467baa3665a --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/datacollection/models.go @@ -0,0 +1,1540 @@ +package datacollection + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for 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 ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-09-01-preview/datacollection" + +// AzureMonitorMetricsDestination azure Monitor Metrics destination. +type AzureMonitorMetricsDestination struct { + // Name - A friendly name for the destination. + // This name should be unique across all destinations (regardless of type) within the data collection rule. + Name *string `json:"name,omitempty"` +} + +// ColumnDefinition definition of custom data column. +type ColumnDefinition struct { + // Name - The name of the column. + Name *string `json:"name,omitempty"` + // Type - The type of the column data. Possible values include: 'String', 'Int', 'Long', 'Real', 'Boolean', 'Datetime', 'Dynamic' + Type KnownColumnDefinitionType `json:"type,omitempty"` +} + +// ConfigurationAccessEndpointSpec definition of the endpoint used for accessing configuration. +type ConfigurationAccessEndpointSpec struct { + // Endpoint - READ-ONLY; The endpoint. This property is READ-ONLY. + Endpoint *string `json:"endpoint,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConfigurationAccessEndpointSpec. +func (caes ConfigurationAccessEndpointSpec) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DataFlow definition of which streams are sent to which destinations. +type DataFlow struct { + // Streams - List of streams for this data flow. + Streams *[]KnownDataFlowStreams `json:"streams,omitempty"` + // Destinations - List of destinations for this data flow. + Destinations *[]string `json:"destinations,omitempty"` + // TransformKql - The KQL query to transform stream data. + TransformKql *string `json:"transformKql,omitempty"` + // OutputStream - The output stream of the transform. Only required if the transform changes data to a different stream. + OutputStream *string `json:"outputStream,omitempty"` +} + +// DataSourcesSpec specification of data sources that will be collected. +type DataSourcesSpec struct { + // PerformanceCounters - The list of performance counter data source configurations. + PerformanceCounters *[]PerfCounterDataSource `json:"performanceCounters,omitempty"` + // WindowsEventLogs - The list of Windows Event Log data source configurations. + WindowsEventLogs *[]WindowsEventLogDataSource `json:"windowsEventLogs,omitempty"` + // Syslog - The list of Syslog data source configurations. + Syslog *[]SyslogDataSource `json:"syslog,omitempty"` + // Extensions - The list of Azure VM extension data source configurations. + Extensions *[]ExtensionDataSource `json:"extensions,omitempty"` + // LogFiles - The list of Log files source configurations. + LogFiles *[]LogFilesDataSource `json:"logFiles,omitempty"` + // IisLogs - The list of IIS logs source configurations. + IisLogs *[]IisLogsDataSource `json:"iisLogs,omitempty"` +} + +// DestinationsSpec specification of destinations that can be used in data flows. +type DestinationsSpec struct { + // LogAnalytics - List of Log Analytics destinations. + LogAnalytics *[]LogAnalyticsDestination `json:"logAnalytics,omitempty"` + // AzureMonitorMetrics - Azure Monitor Metrics destination. + AzureMonitorMetrics *DestinationsSpecAzureMonitorMetrics `json:"azureMonitorMetrics,omitempty"` +} + +// DestinationsSpecAzureMonitorMetrics azure Monitor Metrics destination. +type DestinationsSpecAzureMonitorMetrics struct { + // Name - A friendly name for the destination. + // This name should be unique across all destinations (regardless of type) within the data collection rule. + Name *string `json:"name,omitempty"` +} + +// Endpoint definition of data collection endpoint. +type Endpoint struct { + // Description - Description of the data collection endpoint. + Description *string `json:"description,omitempty"` + // ImmutableID - The immutable ID of this data collection endpoint resource. This property is READ-ONLY. + ImmutableID *string `json:"immutableId,omitempty"` + // ConfigurationAccess - The endpoint used by clients to access their configuration. + ConfigurationAccess *EndpointConfigurationAccess `json:"configurationAccess,omitempty"` + // LogsIngestion - The endpoint used by clients to ingest logs. + LogsIngestion *EndpointLogsIngestion `json:"logsIngestion,omitempty"` + // NetworkAcls - Network access control rules for the endpoints. + NetworkAcls *EndpointNetworkAcls `json:"networkAcls,omitempty"` + // ProvisioningState - READ-ONLY; The resource provisioning state. This property is READ-ONLY. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed' + ProvisioningState KnownDataCollectionEndpointProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for Endpoint. +func (e Endpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if e.Description != nil { + objectMap["description"] = e.Description + } + if e.ImmutableID != nil { + objectMap["immutableId"] = e.ImmutableID + } + if e.ConfigurationAccess != nil { + objectMap["configurationAccess"] = e.ConfigurationAccess + } + if e.LogsIngestion != nil { + objectMap["logsIngestion"] = e.LogsIngestion + } + if e.NetworkAcls != nil { + objectMap["networkAcls"] = e.NetworkAcls + } + return json.Marshal(objectMap) +} + +// EndpointConfigurationAccess the endpoint used by clients to access their configuration. +type EndpointConfigurationAccess struct { + // Endpoint - READ-ONLY; The endpoint. This property is READ-ONLY. + Endpoint *string `json:"endpoint,omitempty"` +} + +// MarshalJSON is the custom marshaler for EndpointConfigurationAccess. +func (eA EndpointConfigurationAccess) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// EndpointLogsIngestion the endpoint used by clients to ingest logs. +type EndpointLogsIngestion struct { + // Endpoint - READ-ONLY; The endpoint. This property is READ-ONLY. + Endpoint *string `json:"endpoint,omitempty"` +} + +// MarshalJSON is the custom marshaler for EndpointLogsIngestion. +func (eI EndpointLogsIngestion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// EndpointNetworkAcls network access control rules for the endpoints. +type EndpointNetworkAcls struct { + // PublicNetworkAccess - The configuration to set whether network access from public internet to the endpoints are allowed. Possible values include: 'Enabled', 'Disabled' + PublicNetworkAccess KnownPublicNetworkAccessOptions `json:"publicNetworkAccess,omitempty"` +} + +// EndpointResource definition of ARM tracked top level resource. +type EndpointResource struct { + autorest.Response `json:"-"` + // EndpointResourceProperties - Resource properties. + *EndpointResourceProperties `json:"properties,omitempty"` + // Location - The geo-location where the resource lives. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Kind - The kind of the resource. Possible values include: 'Linux', 'Windows' + Kind KnownDataCollectionEndpointResourceKind `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified ID of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; Resource entity tag (ETag). + Etag *string `json:"etag,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *EndpointResourceSystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for EndpointResource. +func (er EndpointResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if er.EndpointResourceProperties != nil { + objectMap["properties"] = er.EndpointResourceProperties + } + if er.Location != nil { + objectMap["location"] = er.Location + } + if er.Tags != nil { + objectMap["tags"] = er.Tags + } + if er.Kind != "" { + objectMap["kind"] = er.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for EndpointResource struct. +func (er *EndpointResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var endpointResourceProperties EndpointResourceProperties + err = json.Unmarshal(*v, &endpointResourceProperties) + if err != nil { + return err + } + er.EndpointResourceProperties = &endpointResourceProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + er.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + er.Tags = tags + } + case "kind": + if v != nil { + var kind KnownDataCollectionEndpointResourceKind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + er.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + er.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + er.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + er.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + er.Etag = &etag + } + case "systemData": + if v != nil { + var systemData EndpointResourceSystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + er.SystemData = &systemData + } + } + } + + return nil +} + +// EndpointResourceListResult a pageable list of resources. +type EndpointResourceListResult struct { + autorest.Response `json:"-"` + // Value - A list of resources. + Value *[]EndpointResource `json:"value,omitempty"` + // NextLink - The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// EndpointResourceListResultIterator provides access to a complete listing of EndpointResource values. +type EndpointResourceListResultIterator struct { + i int + page EndpointResourceListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *EndpointResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointResourceListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *EndpointResourceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter EndpointResourceListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter EndpointResourceListResultIterator) Response() EndpointResourceListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter EndpointResourceListResultIterator) Value() EndpointResource { + if !iter.page.NotDone() { + return EndpointResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the EndpointResourceListResultIterator type. +func NewEndpointResourceListResultIterator(page EndpointResourceListResultPage) EndpointResourceListResultIterator { + return EndpointResourceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (erlr EndpointResourceListResult) IsEmpty() bool { + return erlr.Value == nil || len(*erlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (erlr EndpointResourceListResult) hasNextLink() bool { + return erlr.NextLink != nil && len(*erlr.NextLink) != 0 +} + +// endpointResourceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (erlr EndpointResourceListResult) endpointResourceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !erlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(erlr.NextLink))) +} + +// EndpointResourceListResultPage contains a page of EndpointResource values. +type EndpointResourceListResultPage struct { + fn func(context.Context, EndpointResourceListResult) (EndpointResourceListResult, error) + erlr EndpointResourceListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *EndpointResourceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointResourceListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.erlr) + if err != nil { + return err + } + page.erlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *EndpointResourceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page EndpointResourceListResultPage) NotDone() bool { + return !page.erlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page EndpointResourceListResultPage) Response() EndpointResourceListResult { + return page.erlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page EndpointResourceListResultPage) Values() []EndpointResource { + if page.erlr.IsEmpty() { + return nil + } + return *page.erlr.Value +} + +// Creates a new instance of the EndpointResourceListResultPage type. +func NewEndpointResourceListResultPage(cur EndpointResourceListResult, getNextPage func(context.Context, EndpointResourceListResult) (EndpointResourceListResult, error)) EndpointResourceListResultPage { + return EndpointResourceListResultPage{ + fn: getNextPage, + erlr: cur, + } +} + +// EndpointResourceProperties resource properties. +type EndpointResourceProperties struct { + // Description - Description of the data collection endpoint. + Description *string `json:"description,omitempty"` + // ImmutableID - The immutable ID of this data collection endpoint resource. This property is READ-ONLY. + ImmutableID *string `json:"immutableId,omitempty"` + // ConfigurationAccess - The endpoint used by clients to access their configuration. + ConfigurationAccess *EndpointConfigurationAccess `json:"configurationAccess,omitempty"` + // LogsIngestion - The endpoint used by clients to ingest logs. + LogsIngestion *EndpointLogsIngestion `json:"logsIngestion,omitempty"` + // NetworkAcls - Network access control rules for the endpoints. + NetworkAcls *EndpointNetworkAcls `json:"networkAcls,omitempty"` + // ProvisioningState - READ-ONLY; The resource provisioning state. This property is READ-ONLY. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed' + ProvisioningState KnownDataCollectionEndpointProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for EndpointResourceProperties. +func (er EndpointResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if er.Description != nil { + objectMap["description"] = er.Description + } + if er.ImmutableID != nil { + objectMap["immutableId"] = er.ImmutableID + } + if er.ConfigurationAccess != nil { + objectMap["configurationAccess"] = er.ConfigurationAccess + } + if er.LogsIngestion != nil { + objectMap["logsIngestion"] = er.LogsIngestion + } + if er.NetworkAcls != nil { + objectMap["networkAcls"] = er.NetworkAcls + } + return json.Marshal(objectMap) +} + +// EndpointResourceSystemData metadata pertaining to creation and last modification of the resource. +type EndpointResourceSystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorDetail the error detail. +type ErrorDetail struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorDetail `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDetail. +func (ed ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponseCommonV2 common error response for all Azure Resource Manager APIs to return error details +// for failed operations. (This also follows the OData error response format.). +type ErrorResponseCommonV2 struct { + // Error - The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + +// ExtensionDataSource definition of which data will be collected from a separate VM extension that +// integrates with the Azure Monitor Agent. +// Collected from either Windows and Linux machines, depending on which extension is defined. +type ExtensionDataSource struct { + // Streams - List of streams that this data source will be sent to. + // A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. + Streams *[]KnownExtensionDataSourceStreams `json:"streams,omitempty"` + // ExtensionName - The name of the VM extension. + ExtensionName *string `json:"extensionName,omitempty"` + // ExtensionSettings - The extension settings. The format is specific for particular extension. + ExtensionSettings interface{} `json:"extensionSettings,omitempty"` + // InputDataSources - The list of data sources this extension needs data from. + InputDataSources *[]string `json:"inputDataSources,omitempty"` + // Name - A friendly name for the data source. + // This name should be unique across all data sources (regardless of type) within the data collection rule. + Name *string `json:"name,omitempty"` +} + +// IisLogsDataSource enables IIS logs to be collected by this data collection rule. +type IisLogsDataSource struct { + // Streams - IIS streams + Streams *[]string `json:"streams,omitempty"` + // LogDirectories - Absolute paths file location + LogDirectories *[]string `json:"logDirectories,omitempty"` + // Name - A friendly name for the data source. + // This name should be unique across all data sources (regardless of type) within the data collection rule. + Name *string `json:"name,omitempty"` +} + +// LogAnalyticsDestination log Analytics destination. +type LogAnalyticsDestination struct { + // WorkspaceResourceID - The resource ID of the Log Analytics workspace. + WorkspaceResourceID *string `json:"workspaceResourceId,omitempty"` + // WorkspaceID - READ-ONLY; The Customer ID of the Log Analytics workspace. + WorkspaceID *string `json:"workspaceId,omitempty"` + // Name - A friendly name for the destination. + // This name should be unique across all destinations (regardless of type) within the data collection rule. + Name *string `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for LogAnalyticsDestination. +func (lad LogAnalyticsDestination) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lad.WorkspaceResourceID != nil { + objectMap["workspaceResourceId"] = lad.WorkspaceResourceID + } + if lad.Name != nil { + objectMap["name"] = lad.Name + } + return json.Marshal(objectMap) +} + +// LogFilesDataSource definition of which custom log files will be collected by this data collection rule +type LogFilesDataSource struct { + // Streams - List of streams that this data source will be sent to. + // A stream indicates what schema will be used for this data source + Streams *[]string `json:"streams,omitempty"` + // FilePatterns - File Patterns where the log files are located + FilePatterns *[]string `json:"filePatterns,omitempty"` + // Format - The data format of the log files + Format *string `json:"format,omitempty"` + // Settings - The log files specific settings. + Settings *LogFilesDataSourceSettings `json:"settings,omitempty"` + // Name - A friendly name for the data source. + // This name should be unique across all data sources (regardless of type) within the data collection rule. + Name *string `json:"name,omitempty"` +} + +// LogFilesDataSourceSettings the log files specific settings. +type LogFilesDataSourceSettings struct { + // Text - Text settings + Text *LogFileSettingsText `json:"text,omitempty"` +} + +// LogFileSettings settings for different log file formats +type LogFileSettings struct { + // Text - Text settings + Text *LogFileSettingsText `json:"text,omitempty"` +} + +// LogFileSettingsText text settings +type LogFileSettingsText struct { + // RecordStartTimestampFormat - One of the supported timestamp formats. Possible values include: 'ISO8601', 'YYYYMMDDHHMMSS', 'MDYYYYHHMMSSAMPM', 'MonDDYYYYHHMMSS', 'YyMMddHHmmss', 'DdMMyyHHmmss', 'MMMdhhmmss', 'DdMMMyyyyHHmmsszzz', 'YyyyMMDdTHHmmssK' + RecordStartTimestampFormat KnownLogFileTextSettingsRecordStartTimestampFormat `json:"recordStartTimestampFormat,omitempty"` +} + +// LogFileTextSettings settings for text log files +type LogFileTextSettings struct { + // RecordStartTimestampFormat - One of the supported timestamp formats. Possible values include: 'ISO8601', 'YYYYMMDDHHMMSS', 'MDYYYYHHMMSSAMPM', 'MonDDYYYYHHMMSS', 'YyMMddHHmmss', 'DdMMyyHHmmss', 'MMMdhhmmss', 'DdMMMyyyyHHmmsszzz', 'YyyyMMDdTHHmmssK' + RecordStartTimestampFormat KnownLogFileTextSettingsRecordStartTimestampFormat `json:"recordStartTimestampFormat,omitempty"` +} + +// LogsIngestionEndpointSpec definition of the endpoint used for ingesting logs. +type LogsIngestionEndpointSpec struct { + // Endpoint - READ-ONLY; The endpoint. This property is READ-ONLY. + Endpoint *string `json:"endpoint,omitempty"` +} + +// MarshalJSON is the custom marshaler for LogsIngestionEndpointSpec. +func (lies LogsIngestionEndpointSpec) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Metadata metadata about the resource +type Metadata struct { + // ProvisionedBy - READ-ONLY; Azure offering managing this resource on-behalf-of customer. + ProvisionedBy *string `json:"provisionedBy,omitempty"` +} + +// MarshalJSON is the custom marshaler for Metadata. +func (mVar Metadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// NetworkRuleSet definition of the network rules. +type NetworkRuleSet struct { + // PublicNetworkAccess - The configuration to set whether network access from public internet to the endpoints are allowed. Possible values include: 'Enabled', 'Disabled' + PublicNetworkAccess KnownPublicNetworkAccessOptions `json:"publicNetworkAccess,omitempty"` +} + +// PerfCounterDataSource definition of which performance counters will be collected and how they will be +// collected by this data collection rule. +// Collected from both Windows and Linux machines where the counter is present. +type PerfCounterDataSource struct { + // Streams - List of streams that this data source will be sent to. + // A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. + Streams *[]KnownPerfCounterDataSourceStreams `json:"streams,omitempty"` + // SamplingFrequencyInSeconds - The number of seconds between consecutive counter measurements (samples). + SamplingFrequencyInSeconds *int32 `json:"samplingFrequencyInSeconds,omitempty"` + // CounterSpecifiers - A list of specifier names of the performance counters you want to collect. + // Use a wildcard (*) to collect a counter for all instances. + // To get a list of performance counters on Windows, run the command 'typeperf'. + CounterSpecifiers *[]string `json:"counterSpecifiers,omitempty"` + // Name - A friendly name for the data source. + // This name should be unique across all data sources (regardless of type) within the data collection rule. + Name *string `json:"name,omitempty"` +} + +// ResourceForUpdate definition of ARM tracked top level resource properties for update operation. +type ResourceForUpdate struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ResourceForUpdate. +func (rfu ResourceForUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rfu.Tags != nil { + objectMap["tags"] = rfu.Tags + } + return json.Marshal(objectMap) +} + +// Rule definition of what monitoring data to collect and where that data should be sent. +type Rule struct { + // Description - Description of the data collection rule. + Description *string `json:"description,omitempty"` + // ImmutableID - READ-ONLY; The immutable ID of this data collection rule. This property is READ-ONLY. + ImmutableID *string `json:"immutableId,omitempty"` + // DataCollectionEndpointID - The resource ID of the data collection endpoint that this rule can be used with. + DataCollectionEndpointID *string `json:"dataCollectionEndpointId,omitempty"` + // Metadata - READ-ONLY; Metadata about the resource + Metadata *RuleMetadata `json:"metadata,omitempty"` + // StreamDeclarations - Declaration of custom streams used in this rule. + StreamDeclarations map[string]*StreamDeclaration `json:"streamDeclarations"` + // DataSources - The specification of data sources. + // This property is optional and can be omitted if the rule is meant to be used via direct calls to the provisioned endpoint. + DataSources *RuleDataSources `json:"dataSources,omitempty"` + // Destinations - The specification of destinations. + Destinations *RuleDestinations `json:"destinations,omitempty"` + // DataFlows - The specification of data flows. + DataFlows *[]DataFlow `json:"dataFlows,omitempty"` + // ProvisioningState - READ-ONLY; The resource provisioning state. Possible values include: 'KnownDataCollectionRuleProvisioningStateCreating', 'KnownDataCollectionRuleProvisioningStateUpdating', 'KnownDataCollectionRuleProvisioningStateDeleting', 'KnownDataCollectionRuleProvisioningStateSucceeded', 'KnownDataCollectionRuleProvisioningStateFailed' + ProvisioningState KnownDataCollectionRuleProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for Rule. +func (r Rule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.Description != nil { + objectMap["description"] = r.Description + } + if r.DataCollectionEndpointID != nil { + objectMap["dataCollectionEndpointId"] = r.DataCollectionEndpointID + } + if r.StreamDeclarations != nil { + objectMap["streamDeclarations"] = r.StreamDeclarations + } + if r.DataSources != nil { + objectMap["dataSources"] = r.DataSources + } + if r.Destinations != nil { + objectMap["destinations"] = r.Destinations + } + if r.DataFlows != nil { + objectMap["dataFlows"] = r.DataFlows + } + return json.Marshal(objectMap) +} + +// RuleAssociation definition of association of a data collection rule with a monitored Azure resource. +type RuleAssociation struct { + // Description - Description of the association. + Description *string `json:"description,omitempty"` + // DataCollectionRuleID - The resource ID of the data collection rule that is to be associated. + DataCollectionRuleID *string `json:"dataCollectionRuleId,omitempty"` + // DataCollectionEndpointID - The resource ID of the data collection endpoint that is to be associated. + DataCollectionEndpointID *string `json:"dataCollectionEndpointId,omitempty"` + // ProvisioningState - READ-ONLY; The resource provisioning state. Possible values include: 'KnownDataCollectionRuleAssociationProvisioningStateCreating', 'KnownDataCollectionRuleAssociationProvisioningStateUpdating', 'KnownDataCollectionRuleAssociationProvisioningStateDeleting', 'KnownDataCollectionRuleAssociationProvisioningStateSucceeded', 'KnownDataCollectionRuleAssociationProvisioningStateFailed' + ProvisioningState KnownDataCollectionRuleAssociationProvisioningState `json:"provisioningState,omitempty"` + // Metadata - READ-ONLY; Metadata about the resource + Metadata *RuleAssociationMetadata `json:"metadata,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleAssociation. +func (ra RuleAssociation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ra.Description != nil { + objectMap["description"] = ra.Description + } + if ra.DataCollectionRuleID != nil { + objectMap["dataCollectionRuleId"] = ra.DataCollectionRuleID + } + if ra.DataCollectionEndpointID != nil { + objectMap["dataCollectionEndpointId"] = ra.DataCollectionEndpointID + } + return json.Marshal(objectMap) +} + +// RuleAssociationMetadata metadata about the resource +type RuleAssociationMetadata struct { + // ProvisionedBy - READ-ONLY; Azure offering managing this resource on-behalf-of customer. + ProvisionedBy *string `json:"provisionedBy,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleAssociationMetadata. +func (ra RuleAssociationMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// RuleAssociationProxyOnlyResource definition of generic ARM proxy resource. +type RuleAssociationProxyOnlyResource struct { + autorest.Response `json:"-"` + // RuleAssociationProxyOnlyResourceProperties - Resource properties. + *RuleAssociationProxyOnlyResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified ID of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; Resource entity tag (ETag). + Etag *string `json:"etag,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *RuleAssociationProxyOnlyResourceSystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleAssociationProxyOnlyResource. +func (rapor RuleAssociationProxyOnlyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rapor.RuleAssociationProxyOnlyResourceProperties != nil { + objectMap["properties"] = rapor.RuleAssociationProxyOnlyResourceProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RuleAssociationProxyOnlyResource struct. +func (rapor *RuleAssociationProxyOnlyResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var ruleAssociationProxyOnlyResourceProperties RuleAssociationProxyOnlyResourceProperties + err = json.Unmarshal(*v, &ruleAssociationProxyOnlyResourceProperties) + if err != nil { + return err + } + rapor.RuleAssociationProxyOnlyResourceProperties = &ruleAssociationProxyOnlyResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rapor.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rapor.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rapor.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + rapor.Etag = &etag + } + case "systemData": + if v != nil { + var systemData RuleAssociationProxyOnlyResourceSystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + rapor.SystemData = &systemData + } + } + } + + return nil +} + +// RuleAssociationProxyOnlyResourceListResult a pageable list of resources. +type RuleAssociationProxyOnlyResourceListResult struct { + autorest.Response `json:"-"` + // Value - A list of resources. + Value *[]RuleAssociationProxyOnlyResource `json:"value,omitempty"` + // NextLink - The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// RuleAssociationProxyOnlyResourceListResultIterator provides access to a complete listing of +// RuleAssociationProxyOnlyResource values. +type RuleAssociationProxyOnlyResourceListResultIterator struct { + i int + page RuleAssociationProxyOnlyResourceListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RuleAssociationProxyOnlyResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleAssociationProxyOnlyResourceListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RuleAssociationProxyOnlyResourceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RuleAssociationProxyOnlyResourceListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RuleAssociationProxyOnlyResourceListResultIterator) Response() RuleAssociationProxyOnlyResourceListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RuleAssociationProxyOnlyResourceListResultIterator) Value() RuleAssociationProxyOnlyResource { + if !iter.page.NotDone() { + return RuleAssociationProxyOnlyResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RuleAssociationProxyOnlyResourceListResultIterator type. +func NewRuleAssociationProxyOnlyResourceListResultIterator(page RuleAssociationProxyOnlyResourceListResultPage) RuleAssociationProxyOnlyResourceListResultIterator { + return RuleAssociationProxyOnlyResourceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (raporlr RuleAssociationProxyOnlyResourceListResult) IsEmpty() bool { + return raporlr.Value == nil || len(*raporlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (raporlr RuleAssociationProxyOnlyResourceListResult) hasNextLink() bool { + return raporlr.NextLink != nil && len(*raporlr.NextLink) != 0 +} + +// ruleAssociationProxyOnlyResourceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (raporlr RuleAssociationProxyOnlyResourceListResult) ruleAssociationProxyOnlyResourceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !raporlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(raporlr.NextLink))) +} + +// RuleAssociationProxyOnlyResourceListResultPage contains a page of RuleAssociationProxyOnlyResource +// values. +type RuleAssociationProxyOnlyResourceListResultPage struct { + fn func(context.Context, RuleAssociationProxyOnlyResourceListResult) (RuleAssociationProxyOnlyResourceListResult, error) + raporlr RuleAssociationProxyOnlyResourceListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RuleAssociationProxyOnlyResourceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleAssociationProxyOnlyResourceListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.raporlr) + if err != nil { + return err + } + page.raporlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RuleAssociationProxyOnlyResourceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RuleAssociationProxyOnlyResourceListResultPage) NotDone() bool { + return !page.raporlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RuleAssociationProxyOnlyResourceListResultPage) Response() RuleAssociationProxyOnlyResourceListResult { + return page.raporlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RuleAssociationProxyOnlyResourceListResultPage) Values() []RuleAssociationProxyOnlyResource { + if page.raporlr.IsEmpty() { + return nil + } + return *page.raporlr.Value +} + +// Creates a new instance of the RuleAssociationProxyOnlyResourceListResultPage type. +func NewRuleAssociationProxyOnlyResourceListResultPage(cur RuleAssociationProxyOnlyResourceListResult, getNextPage func(context.Context, RuleAssociationProxyOnlyResourceListResult) (RuleAssociationProxyOnlyResourceListResult, error)) RuleAssociationProxyOnlyResourceListResultPage { + return RuleAssociationProxyOnlyResourceListResultPage{ + fn: getNextPage, + raporlr: cur, + } +} + +// RuleAssociationProxyOnlyResourceProperties resource properties. +type RuleAssociationProxyOnlyResourceProperties struct { + // Description - Description of the association. + Description *string `json:"description,omitempty"` + // DataCollectionRuleID - The resource ID of the data collection rule that is to be associated. + DataCollectionRuleID *string `json:"dataCollectionRuleId,omitempty"` + // DataCollectionEndpointID - The resource ID of the data collection endpoint that is to be associated. + DataCollectionEndpointID *string `json:"dataCollectionEndpointId,omitempty"` + // ProvisioningState - READ-ONLY; The resource provisioning state. Possible values include: 'KnownDataCollectionRuleAssociationProvisioningStateCreating', 'KnownDataCollectionRuleAssociationProvisioningStateUpdating', 'KnownDataCollectionRuleAssociationProvisioningStateDeleting', 'KnownDataCollectionRuleAssociationProvisioningStateSucceeded', 'KnownDataCollectionRuleAssociationProvisioningStateFailed' + ProvisioningState KnownDataCollectionRuleAssociationProvisioningState `json:"provisioningState,omitempty"` + // Metadata - READ-ONLY; Metadata about the resource + Metadata *RuleAssociationMetadata `json:"metadata,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleAssociationProxyOnlyResourceProperties. +func (rapor RuleAssociationProxyOnlyResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rapor.Description != nil { + objectMap["description"] = rapor.Description + } + if rapor.DataCollectionRuleID != nil { + objectMap["dataCollectionRuleId"] = rapor.DataCollectionRuleID + } + if rapor.DataCollectionEndpointID != nil { + objectMap["dataCollectionEndpointId"] = rapor.DataCollectionEndpointID + } + return json.Marshal(objectMap) +} + +// RuleAssociationProxyOnlyResourceSystemData metadata pertaining to creation and last modification of the +// resource. +type RuleAssociationProxyOnlyResourceSystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// RuleDataSources the specification of data sources. +// This property is optional and can be omitted if the rule is meant to be used via direct calls to the +// provisioned endpoint. +type RuleDataSources struct { + // PerformanceCounters - The list of performance counter data source configurations. + PerformanceCounters *[]PerfCounterDataSource `json:"performanceCounters,omitempty"` + // WindowsEventLogs - The list of Windows Event Log data source configurations. + WindowsEventLogs *[]WindowsEventLogDataSource `json:"windowsEventLogs,omitempty"` + // Syslog - The list of Syslog data source configurations. + Syslog *[]SyslogDataSource `json:"syslog,omitempty"` + // Extensions - The list of Azure VM extension data source configurations. + Extensions *[]ExtensionDataSource `json:"extensions,omitempty"` + // LogFiles - The list of Log files source configurations. + LogFiles *[]LogFilesDataSource `json:"logFiles,omitempty"` + // IisLogs - The list of IIS logs source configurations. + IisLogs *[]IisLogsDataSource `json:"iisLogs,omitempty"` +} + +// RuleDestinations the specification of destinations. +type RuleDestinations struct { + // LogAnalytics - List of Log Analytics destinations. + LogAnalytics *[]LogAnalyticsDestination `json:"logAnalytics,omitempty"` + // AzureMonitorMetrics - Azure Monitor Metrics destination. + AzureMonitorMetrics *DestinationsSpecAzureMonitorMetrics `json:"azureMonitorMetrics,omitempty"` +} + +// RuleMetadata metadata about the resource +type RuleMetadata struct { + // ProvisionedBy - READ-ONLY; Azure offering managing this resource on-behalf-of customer. + ProvisionedBy *string `json:"provisionedBy,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleMetadata. +func (r RuleMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// RuleResource definition of ARM tracked top level resource. +type RuleResource struct { + autorest.Response `json:"-"` + // RuleResourceProperties - Resource properties. + *RuleResourceProperties `json:"properties,omitempty"` + // Location - The geo-location where the resource lives. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Kind - The kind of the resource. Possible values include: 'KnownDataCollectionRuleResourceKindLinux', 'KnownDataCollectionRuleResourceKindWindows' + Kind KnownDataCollectionRuleResourceKind `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified ID of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; Resource entity tag (ETag). + Etag *string `json:"etag,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *RuleResourceSystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleResource. +func (rr RuleResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rr.RuleResourceProperties != nil { + objectMap["properties"] = rr.RuleResourceProperties + } + if rr.Location != nil { + objectMap["location"] = rr.Location + } + if rr.Tags != nil { + objectMap["tags"] = rr.Tags + } + if rr.Kind != "" { + objectMap["kind"] = rr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RuleResource struct. +func (rr *RuleResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var ruleResourceProperties RuleResourceProperties + err = json.Unmarshal(*v, &ruleResourceProperties) + if err != nil { + return err + } + rr.RuleResourceProperties = &ruleResourceProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + rr.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + rr.Tags = tags + } + case "kind": + if v != nil { + var kind KnownDataCollectionRuleResourceKind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + rr.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rr.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + rr.Etag = &etag + } + case "systemData": + if v != nil { + var systemData RuleResourceSystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + rr.SystemData = &systemData + } + } + } + + return nil +} + +// RuleResourceListResult a pageable list of resources. +type RuleResourceListResult struct { + autorest.Response `json:"-"` + // Value - A list of resources. + Value *[]RuleResource `json:"value,omitempty"` + // NextLink - The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// RuleResourceListResultIterator provides access to a complete listing of RuleResource values. +type RuleResourceListResultIterator struct { + i int + page RuleResourceListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RuleResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleResourceListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RuleResourceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RuleResourceListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RuleResourceListResultIterator) Response() RuleResourceListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RuleResourceListResultIterator) Value() RuleResource { + if !iter.page.NotDone() { + return RuleResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RuleResourceListResultIterator type. +func NewRuleResourceListResultIterator(page RuleResourceListResultPage) RuleResourceListResultIterator { + return RuleResourceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rrlr RuleResourceListResult) IsEmpty() bool { + return rrlr.Value == nil || len(*rrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rrlr RuleResourceListResult) hasNextLink() bool { + return rrlr.NextLink != nil && len(*rrlr.NextLink) != 0 +} + +// ruleResourceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rrlr RuleResourceListResult) ruleResourceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !rrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rrlr.NextLink))) +} + +// RuleResourceListResultPage contains a page of RuleResource values. +type RuleResourceListResultPage struct { + fn func(context.Context, RuleResourceListResult) (RuleResourceListResult, error) + rrlr RuleResourceListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RuleResourceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleResourceListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rrlr) + if err != nil { + return err + } + page.rrlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RuleResourceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RuleResourceListResultPage) NotDone() bool { + return !page.rrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RuleResourceListResultPage) Response() RuleResourceListResult { + return page.rrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RuleResourceListResultPage) Values() []RuleResource { + if page.rrlr.IsEmpty() { + return nil + } + return *page.rrlr.Value +} + +// Creates a new instance of the RuleResourceListResultPage type. +func NewRuleResourceListResultPage(cur RuleResourceListResult, getNextPage func(context.Context, RuleResourceListResult) (RuleResourceListResult, error)) RuleResourceListResultPage { + return RuleResourceListResultPage{ + fn: getNextPage, + rrlr: cur, + } +} + +// RuleResourceProperties resource properties. +type RuleResourceProperties struct { + // Description - Description of the data collection rule. + Description *string `json:"description,omitempty"` + // ImmutableID - READ-ONLY; The immutable ID of this data collection rule. This property is READ-ONLY. + ImmutableID *string `json:"immutableId,omitempty"` + // DataCollectionEndpointID - The resource ID of the data collection endpoint that this rule can be used with. + DataCollectionEndpointID *string `json:"dataCollectionEndpointId,omitempty"` + // Metadata - READ-ONLY; Metadata about the resource + Metadata *RuleMetadata `json:"metadata,omitempty"` + // StreamDeclarations - Declaration of custom streams used in this rule. + StreamDeclarations map[string]*StreamDeclaration `json:"streamDeclarations"` + // DataSources - The specification of data sources. + // This property is optional and can be omitted if the rule is meant to be used via direct calls to the provisioned endpoint. + DataSources *RuleDataSources `json:"dataSources,omitempty"` + // Destinations - The specification of destinations. + Destinations *RuleDestinations `json:"destinations,omitempty"` + // DataFlows - The specification of data flows. + DataFlows *[]DataFlow `json:"dataFlows,omitempty"` + // ProvisioningState - READ-ONLY; The resource provisioning state. Possible values include: 'KnownDataCollectionRuleProvisioningStateCreating', 'KnownDataCollectionRuleProvisioningStateUpdating', 'KnownDataCollectionRuleProvisioningStateDeleting', 'KnownDataCollectionRuleProvisioningStateSucceeded', 'KnownDataCollectionRuleProvisioningStateFailed' + ProvisioningState KnownDataCollectionRuleProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleResourceProperties. +func (rr RuleResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rr.Description != nil { + objectMap["description"] = rr.Description + } + if rr.DataCollectionEndpointID != nil { + objectMap["dataCollectionEndpointId"] = rr.DataCollectionEndpointID + } + if rr.StreamDeclarations != nil { + objectMap["streamDeclarations"] = rr.StreamDeclarations + } + if rr.DataSources != nil { + objectMap["dataSources"] = rr.DataSources + } + if rr.Destinations != nil { + objectMap["destinations"] = rr.Destinations + } + if rr.DataFlows != nil { + objectMap["dataFlows"] = rr.DataFlows + } + return json.Marshal(objectMap) +} + +// RuleResourceSystemData metadata pertaining to creation and last modification of the resource. +type RuleResourceSystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// StreamDeclaration declaration of a custom stream. +type StreamDeclaration struct { + // Columns - List of columns used by data in this stream. + Columns *[]ColumnDefinition `json:"columns,omitempty"` +} + +// SyslogDataSource definition of which syslog data will be collected and how it will be collected. +// Only collected from Linux machines. +type SyslogDataSource struct { + // Streams - List of streams that this data source will be sent to. + // A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. + Streams *[]KnownSyslogDataSourceStreams `json:"streams,omitempty"` + // FacilityNames - The list of facility names. + FacilityNames *[]KnownSyslogDataSourceFacilityNames `json:"facilityNames,omitempty"` + // LogLevels - The log levels to collect. + LogLevels *[]KnownSyslogDataSourceLogLevels `json:"logLevels,omitempty"` + // Name - A friendly name for the data source. + // This name should be unique across all data sources (regardless of type) within the data collection rule. + Name *string `json:"name,omitempty"` +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// WindowsEventLogDataSource definition of which Windows Event Log events will be collected and how they +// will be collected. +// Only collected from Windows machines. +type WindowsEventLogDataSource struct { + // Streams - List of streams that this data source will be sent to. + // A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. + Streams *[]KnownWindowsEventLogDataSourceStreams `json:"streams,omitempty"` + // XPathQueries - A list of Windows Event Log queries in XPATH format. + XPathQueries *[]string `json:"xPathQueries,omitempty"` + // Name - A friendly name for the data source. + // This name should be unique across all data sources (regardless of type) within the data collection rule. + Name *string `json:"name,omitempty"` +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/datacollection/ruleassociations.go b/services/preview/monitor/mgmt/2021-09-01-preview/datacollection/ruleassociations.go new file mode 100644 index 000000000000..6b55b628d070 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/datacollection/ruleassociations.go @@ -0,0 +1,661 @@ +package datacollection + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for 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 ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// RuleAssociationsClient is the monitor Management Client +type RuleAssociationsClient struct { + BaseClient +} + +// NewRuleAssociationsClient creates an instance of the RuleAssociationsClient client. +func NewRuleAssociationsClient(subscriptionID string) RuleAssociationsClient { + return NewRuleAssociationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRuleAssociationsClientWithBaseURI creates an instance of the RuleAssociationsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewRuleAssociationsClientWithBaseURI(baseURI string, subscriptionID string) RuleAssociationsClient { + return RuleAssociationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create sends the create request. +// Parameters: +// resourceURI - the identifier of the resource. +// associationName - the name of the association. The name is case insensitive. +// body - the payload +func (client RuleAssociationsClient) Create(ctx context.Context, resourceURI string, associationName string, body *RuleAssociationProxyOnlyResource) (result RuleAssociationProxyOnlyResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleAssociationsClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceURI, + Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("datacollection.RuleAssociationsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceURI, associationName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollection.RuleAssociationsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datacollection.RuleAssociationsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollection.RuleAssociationsClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client RuleAssociationsClient) CreatePreparer(ctx context.Context, resourceURI string, associationName string, body *RuleAssociationProxyOnlyResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "associationName": autorest.Encode("path", associationName), + "resourceUri": resourceURI, + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + body.Etag = nil + body.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if body != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(body)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client RuleAssociationsClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client RuleAssociationsClient) CreateResponder(resp *http.Response) (result RuleAssociationProxyOnlyResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// resourceURI - the identifier of the resource. +// associationName - the name of the association. The name is case insensitive. +func (client RuleAssociationsClient) Delete(ctx context.Context, resourceURI string, associationName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleAssociationsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceURI, + Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("datacollection.RuleAssociationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceURI, associationName) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollection.RuleAssociationsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "datacollection.RuleAssociationsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollection.RuleAssociationsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client RuleAssociationsClient) DeletePreparer(ctx context.Context, resourceURI string, associationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "associationName": autorest.Encode("path", associationName), + "resourceUri": resourceURI, + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client RuleAssociationsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RuleAssociationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// resourceURI - the identifier of the resource. +// associationName - the name of the association. The name is case insensitive. +func (client RuleAssociationsClient) Get(ctx context.Context, resourceURI string, associationName string) (result RuleAssociationProxyOnlyResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleAssociationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceURI, + Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("datacollection.RuleAssociationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceURI, associationName) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollection.RuleAssociationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datacollection.RuleAssociationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollection.RuleAssociationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client RuleAssociationsClient) GetPreparer(ctx context.Context, resourceURI string, associationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "associationName": autorest.Encode("path", associationName), + "resourceUri": resourceURI, + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RuleAssociationsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RuleAssociationsClient) GetResponder(resp *http.Response) (result RuleAssociationProxyOnlyResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDataCollectionEndpoint sends the list by data collection endpoint request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// dataCollectionEndpointName - the name of the data collection endpoint. The name is case insensitive. +func (client RuleAssociationsClient) ListByDataCollectionEndpoint(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string) (result RuleAssociationProxyOnlyResourceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleAssociationsClient.ListByDataCollectionEndpoint") + defer func() { + sc := -1 + if result.raporlr.Response.Response != nil { + sc = result.raporlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("datacollection.RuleAssociationsClient", "ListByDataCollectionEndpoint", err.Error()) + } + + result.fn = client.listByDataCollectionEndpointNextResults + req, err := client.ListByDataCollectionEndpointPreparer(ctx, resourceGroupName, dataCollectionEndpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollection.RuleAssociationsClient", "ListByDataCollectionEndpoint", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDataCollectionEndpointSender(req) + if err != nil { + result.raporlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datacollection.RuleAssociationsClient", "ListByDataCollectionEndpoint", resp, "Failure sending request") + return + } + + result.raporlr, err = client.ListByDataCollectionEndpointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollection.RuleAssociationsClient", "ListByDataCollectionEndpoint", resp, "Failure responding to request") + return + } + if result.raporlr.hasNextLink() && result.raporlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByDataCollectionEndpointPreparer prepares the ListByDataCollectionEndpoint request. +func (client RuleAssociationsClient) ListByDataCollectionEndpointPreparer(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataCollectionEndpointName": autorest.Encode("path", dataCollectionEndpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}/associations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDataCollectionEndpointSender sends the ListByDataCollectionEndpoint request. The method will close the +// http.Response Body if it receives an error. +func (client RuleAssociationsClient) ListByDataCollectionEndpointSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByDataCollectionEndpointResponder handles the response to the ListByDataCollectionEndpoint request. The method always +// closes the http.Response Body. +func (client RuleAssociationsClient) ListByDataCollectionEndpointResponder(resp *http.Response) (result RuleAssociationProxyOnlyResourceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByDataCollectionEndpointNextResults retrieves the next set of results, if any. +func (client RuleAssociationsClient) listByDataCollectionEndpointNextResults(ctx context.Context, lastResults RuleAssociationProxyOnlyResourceListResult) (result RuleAssociationProxyOnlyResourceListResult, err error) { + req, err := lastResults.ruleAssociationProxyOnlyResourceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "datacollection.RuleAssociationsClient", "listByDataCollectionEndpointNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByDataCollectionEndpointSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "datacollection.RuleAssociationsClient", "listByDataCollectionEndpointNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByDataCollectionEndpointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollection.RuleAssociationsClient", "listByDataCollectionEndpointNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByDataCollectionEndpointComplete enumerates all values, automatically crossing page boundaries as required. +func (client RuleAssociationsClient) ListByDataCollectionEndpointComplete(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string) (result RuleAssociationProxyOnlyResourceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleAssociationsClient.ListByDataCollectionEndpoint") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByDataCollectionEndpoint(ctx, resourceGroupName, dataCollectionEndpointName) + return +} + +// ListByResource sends the list by resource request. +// Parameters: +// resourceURI - the identifier of the resource. +func (client RuleAssociationsClient) ListByResource(ctx context.Context, resourceURI string) (result RuleAssociationProxyOnlyResourceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleAssociationsClient.ListByResource") + defer func() { + sc := -1 + if result.raporlr.Response.Response != nil { + sc = result.raporlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceURI, + Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("datacollection.RuleAssociationsClient", "ListByResource", err.Error()) + } + + result.fn = client.listByResourceNextResults + req, err := client.ListByResourcePreparer(ctx, resourceURI) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollection.RuleAssociationsClient", "ListByResource", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceSender(req) + if err != nil { + result.raporlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datacollection.RuleAssociationsClient", "ListByResource", resp, "Failure sending request") + return + } + + result.raporlr, err = client.ListByResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollection.RuleAssociationsClient", "ListByResource", resp, "Failure responding to request") + return + } + if result.raporlr.hasNextLink() && result.raporlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourcePreparer prepares the ListByResource request. +func (client RuleAssociationsClient) ListByResourcePreparer(ctx context.Context, resourceURI string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceUri": resourceURI, + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceSender sends the ListByResource request. The method will close the +// http.Response Body if it receives an error. +func (client RuleAssociationsClient) ListByResourceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListByResourceResponder handles the response to the ListByResource request. The method always +// closes the http.Response Body. +func (client RuleAssociationsClient) ListByResourceResponder(resp *http.Response) (result RuleAssociationProxyOnlyResourceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceNextResults retrieves the next set of results, if any. +func (client RuleAssociationsClient) listByResourceNextResults(ctx context.Context, lastResults RuleAssociationProxyOnlyResourceListResult) (result RuleAssociationProxyOnlyResourceListResult, err error) { + req, err := lastResults.ruleAssociationProxyOnlyResourceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "datacollection.RuleAssociationsClient", "listByResourceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "datacollection.RuleAssociationsClient", "listByResourceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollection.RuleAssociationsClient", "listByResourceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceComplete enumerates all values, automatically crossing page boundaries as required. +func (client RuleAssociationsClient) ListByResourceComplete(ctx context.Context, resourceURI string) (result RuleAssociationProxyOnlyResourceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleAssociationsClient.ListByResource") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResource(ctx, resourceURI) + return +} + +// ListByRule sends the list by rule request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// dataCollectionRuleName - the name of the data collection rule. The name is case insensitive. +func (client RuleAssociationsClient) ListByRule(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result RuleAssociationProxyOnlyResourceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleAssociationsClient.ListByRule") + defer func() { + sc := -1 + if result.raporlr.Response.Response != nil { + sc = result.raporlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("datacollection.RuleAssociationsClient", "ListByRule", err.Error()) + } + + result.fn = client.listByRuleNextResults + req, err := client.ListByRulePreparer(ctx, resourceGroupName, dataCollectionRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollection.RuleAssociationsClient", "ListByRule", nil, "Failure preparing request") + return + } + + resp, err := client.ListByRuleSender(req) + if err != nil { + result.raporlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datacollection.RuleAssociationsClient", "ListByRule", resp, "Failure sending request") + return + } + + result.raporlr, err = client.ListByRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollection.RuleAssociationsClient", "ListByRule", resp, "Failure responding to request") + return + } + if result.raporlr.hasNextLink() && result.raporlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByRulePreparer prepares the ListByRule request. +func (client RuleAssociationsClient) ListByRulePreparer(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataCollectionRuleName": autorest.Encode("path", dataCollectionRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByRuleSender sends the ListByRule request. The method will close the +// http.Response Body if it receives an error. +func (client RuleAssociationsClient) ListByRuleSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByRuleResponder handles the response to the ListByRule request. The method always +// closes the http.Response Body. +func (client RuleAssociationsClient) ListByRuleResponder(resp *http.Response) (result RuleAssociationProxyOnlyResourceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByRuleNextResults retrieves the next set of results, if any. +func (client RuleAssociationsClient) listByRuleNextResults(ctx context.Context, lastResults RuleAssociationProxyOnlyResourceListResult) (result RuleAssociationProxyOnlyResourceListResult, err error) { + req, err := lastResults.ruleAssociationProxyOnlyResourceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "datacollection.RuleAssociationsClient", "listByRuleNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "datacollection.RuleAssociationsClient", "listByRuleNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollection.RuleAssociationsClient", "listByRuleNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByRuleComplete enumerates all values, automatically crossing page boundaries as required. +func (client RuleAssociationsClient) ListByRuleComplete(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result RuleAssociationProxyOnlyResourceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleAssociationsClient.ListByRule") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByRule(ctx, resourceGroupName, dataCollectionRuleName) + return +} diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/datacollectionrules.go b/services/preview/monitor/mgmt/2021-09-01-preview/datacollection/rules.go similarity index 62% rename from services/preview/monitor/mgmt/2021-04-01-preview/insights/datacollectionrules.go rename to services/preview/monitor/mgmt/2021-09-01-preview/datacollection/rules.go index e3baabf0f6b4..9a779a8700c3 100644 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/datacollectionrules.go +++ b/services/preview/monitor/mgmt/2021-09-01-preview/datacollection/rules.go @@ -1,4 +1,4 @@ -package insights +package datacollection // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -15,21 +15,20 @@ import ( "net/http" ) -// DataCollectionRulesClient is the monitor Management Client -type DataCollectionRulesClient struct { +// RulesClient is the monitor Management Client +type RulesClient struct { BaseClient } -// NewDataCollectionRulesClient creates an instance of the DataCollectionRulesClient client. -func NewDataCollectionRulesClient(subscriptionID string) DataCollectionRulesClient { - return NewDataCollectionRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +// NewRulesClient creates an instance of the RulesClient client. +func NewRulesClient(subscriptionID string) RulesClient { + return NewRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// NewDataCollectionRulesClientWithBaseURI creates an instance of the DataCollectionRulesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewDataCollectionRulesClientWithBaseURI(baseURI string, subscriptionID string) DataCollectionRulesClient { - return DataCollectionRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +// NewRulesClientWithBaseURI creates an instance of the RulesClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewRulesClientWithBaseURI(baseURI string, subscriptionID string) RulesClient { + return RulesClient{NewWithBaseURI(baseURI, subscriptionID)} } // Create sends the create request. @@ -37,9 +36,9 @@ func NewDataCollectionRulesClientWithBaseURI(baseURI string, subscriptionID stri // resourceGroupName - the name of the resource group. The name is case insensitive. // dataCollectionRuleName - the name of the data collection rule. The name is case insensitive. // body - the payload -func (client DataCollectionRulesClient) Create(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body *DataCollectionRuleResource) (result DataCollectionRuleResource, err error) { +func (client RulesClient) Create(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body *RuleResource) (result RuleResource, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRulesClient.Create") + ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.Create") defer func() { sc := -1 if result.Response.Response != nil { @@ -57,25 +56,25 @@ func (client DataCollectionRulesClient) Create(ctx context.Context, resourceGrou {TargetValue: body, Constraints: []validation.Constraint{{Target: "body", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("insights.DataCollectionRulesClient", "Create", err.Error()) + return result, validation.NewError("datacollection.RulesClient", "Create", err.Error()) } req, err := client.CreatePreparer(ctx, resourceGroupName, dataCollectionRuleName, body) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Create", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "datacollection.RulesClient", "Create", nil, "Failure preparing request") return } resp, err := client.CreateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Create", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "datacollection.RulesClient", "Create", resp, "Failure sending request") return } result, err = client.CreateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Create", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "datacollection.RulesClient", "Create", resp, "Failure responding to request") return } @@ -83,14 +82,14 @@ func (client DataCollectionRulesClient) Create(ctx context.Context, resourceGrou } // CreatePreparer prepares the Create request. -func (client DataCollectionRulesClient) CreatePreparer(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body *DataCollectionRuleResource) (*http.Request, error) { +func (client RulesClient) CreatePreparer(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body *RuleResource) (*http.Request, error) { pathParameters := map[string]interface{}{ "dataCollectionRuleName": autorest.Encode("path", dataCollectionRuleName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -115,13 +114,13 @@ func (client DataCollectionRulesClient) CreatePreparer(ctx context.Context, reso // CreateSender sends the Create request. The method will close the // http.Response Body if it receives an error. -func (client DataCollectionRulesClient) CreateSender(req *http.Request) (*http.Response, error) { +func (client RulesClient) CreateSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // CreateResponder handles the response to the Create request. The method always // closes the http.Response Body. -func (client DataCollectionRulesClient) CreateResponder(resp *http.Response) (result DataCollectionRuleResource, err error) { +func (client RulesClient) CreateResponder(resp *http.Response) (result RuleResource, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), @@ -135,9 +134,9 @@ func (client DataCollectionRulesClient) CreateResponder(resp *http.Response) (re // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. // dataCollectionRuleName - the name of the data collection rule. The name is case insensitive. -func (client DataCollectionRulesClient) Delete(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result autorest.Response, err error) { +func (client RulesClient) Delete(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result autorest.Response, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRulesClient.Delete") + ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.Delete") defer func() { sc := -1 if result.Response != nil { @@ -152,25 +151,25 @@ func (client DataCollectionRulesClient) Delete(ctx context.Context, resourceGrou {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DataCollectionRulesClient", "Delete", err.Error()) + return result, validation.NewError("datacollection.RulesClient", "Delete", err.Error()) } req, err := client.DeletePreparer(ctx, resourceGroupName, dataCollectionRuleName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Delete", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "datacollection.RulesClient", "Delete", nil, "Failure preparing request") return } resp, err := client.DeleteSender(req) if err != nil { result.Response = resp - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Delete", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "datacollection.RulesClient", "Delete", resp, "Failure sending request") return } result, err = client.DeleteResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Delete", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "datacollection.RulesClient", "Delete", resp, "Failure responding to request") return } @@ -178,14 +177,14 @@ func (client DataCollectionRulesClient) Delete(ctx context.Context, resourceGrou } // DeletePreparer prepares the Delete request. -func (client DataCollectionRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (*http.Request, error) { +func (client RulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "dataCollectionRuleName": autorest.Encode("path", dataCollectionRuleName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -200,13 +199,13 @@ func (client DataCollectionRulesClient) DeletePreparer(ctx context.Context, reso // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. -func (client DataCollectionRulesClient) DeleteSender(req *http.Request) (*http.Response, error) { +func (client RulesClient) DeleteSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. -func (client DataCollectionRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { +func (client RulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), @@ -219,9 +218,9 @@ func (client DataCollectionRulesClient) DeleteResponder(resp *http.Response) (re // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. // dataCollectionRuleName - the name of the data collection rule. The name is case insensitive. -func (client DataCollectionRulesClient) Get(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result DataCollectionRuleResource, err error) { +func (client RulesClient) Get(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result RuleResource, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRulesClient.Get") + ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.Get") defer func() { sc := -1 if result.Response.Response != nil { @@ -236,25 +235,25 @@ func (client DataCollectionRulesClient) Get(ctx context.Context, resourceGroupNa {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DataCollectionRulesClient", "Get", err.Error()) + return result, validation.NewError("datacollection.RulesClient", "Get", err.Error()) } req, err := client.GetPreparer(ctx, resourceGroupName, dataCollectionRuleName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Get", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "datacollection.RulesClient", "Get", nil, "Failure preparing request") return } resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Get", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "datacollection.RulesClient", "Get", resp, "Failure sending request") return } result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Get", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "datacollection.RulesClient", "Get", resp, "Failure responding to request") return } @@ -262,14 +261,14 @@ func (client DataCollectionRulesClient) Get(ctx context.Context, resourceGroupNa } // GetPreparer prepares the Get request. -func (client DataCollectionRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (*http.Request, error) { +func (client RulesClient) GetPreparer(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "dataCollectionRuleName": autorest.Encode("path", dataCollectionRuleName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -284,13 +283,13 @@ func (client DataCollectionRulesClient) GetPreparer(ctx context.Context, resourc // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. -func (client DataCollectionRulesClient) GetSender(req *http.Request) (*http.Response, error) { +func (client RulesClient) GetSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client DataCollectionRulesClient) GetResponder(resp *http.Response) (result DataCollectionRuleResource, err error) { +func (client RulesClient) GetResponder(resp *http.Response) (result RuleResource, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -303,13 +302,13 @@ func (client DataCollectionRulesClient) GetResponder(resp *http.Response) (resul // ListByResourceGroup sends the list by resource group request. // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. -func (client DataCollectionRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DataCollectionRuleResourceListResultPage, err error) { +func (client RulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result RuleResourceListResultPage, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRulesClient.ListByResourceGroup") + ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.ListByResourceGroup") defer func() { sc := -1 - if result.dcrrlr.Response.Response != nil { - sc = result.dcrrlr.Response.Response.StatusCode + if result.rrlr.Response.Response != nil { + sc = result.rrlr.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() @@ -320,29 +319,29 @@ func (client DataCollectionRulesClient) ListByResourceGroup(ctx context.Context, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DataCollectionRulesClient", "ListByResourceGroup", err.Error()) + return result, validation.NewError("datacollection.RulesClient", "ListByResourceGroup", err.Error()) } result.fn = client.listByResourceGroupNextResults req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "ListByResourceGroup", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "datacollection.RulesClient", "ListByResourceGroup", nil, "Failure preparing request") return } resp, err := client.ListByResourceGroupSender(req) if err != nil { - result.dcrrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "ListByResourceGroup", resp, "Failure sending request") + result.rrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datacollection.RulesClient", "ListByResourceGroup", resp, "Failure sending request") return } - result.dcrrlr, err = client.ListByResourceGroupResponder(resp) + result.rrlr, err = client.ListByResourceGroupResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "ListByResourceGroup", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "datacollection.RulesClient", "ListByResourceGroup", resp, "Failure responding to request") return } - if result.dcrrlr.hasNextLink() && result.dcrrlr.IsEmpty() { + if result.rrlr.hasNextLink() && result.rrlr.IsEmpty() { err = result.NextWithContext(ctx) return } @@ -351,13 +350,13 @@ func (client DataCollectionRulesClient) ListByResourceGroup(ctx context.Context, } // ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client DataCollectionRulesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { +func (client RulesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -372,13 +371,13 @@ func (client DataCollectionRulesClient) ListByResourceGroupPreparer(ctx context. // ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the // http.Response Body if it receives an error. -func (client DataCollectionRulesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { +func (client RulesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always // closes the http.Response Body. -func (client DataCollectionRulesClient) ListByResourceGroupResponder(resp *http.Response) (result DataCollectionRuleResourceListResult, err error) { +func (client RulesClient) ListByResourceGroupResponder(resp *http.Response) (result RuleResourceListResult, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -389,10 +388,10 @@ func (client DataCollectionRulesClient) ListByResourceGroupResponder(resp *http. } // listByResourceGroupNextResults retrieves the next set of results, if any. -func (client DataCollectionRulesClient) listByResourceGroupNextResults(ctx context.Context, lastResults DataCollectionRuleResourceListResult) (result DataCollectionRuleResourceListResult, err error) { - req, err := lastResults.dataCollectionRuleResourceListResultPreparer(ctx) +func (client RulesClient) listByResourceGroupNextResults(ctx context.Context, lastResults RuleResourceListResult) (result RuleResourceListResult, err error) { + req, err := lastResults.ruleResourceListResultPreparer(ctx) if err != nil { - return result, autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "datacollection.RulesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") } if req == nil { return @@ -400,19 +399,19 @@ func (client DataCollectionRulesClient) listByResourceGroupNextResults(ctx conte resp, err := client.ListByResourceGroupSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "datacollection.RulesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") } result, err = client.ListByResourceGroupResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "datacollection.RulesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") } return } // ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client DataCollectionRulesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result DataCollectionRuleResourceListResultIterator, err error) { +func (client RulesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result RuleResourceListResultIterator, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRulesClient.ListByResourceGroup") + ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.ListByResourceGroup") defer func() { sc := -1 if result.Response().Response.Response != nil { @@ -426,13 +425,13 @@ func (client DataCollectionRulesClient) ListByResourceGroupComplete(ctx context. } // ListBySubscription sends the list by subscription request. -func (client DataCollectionRulesClient) ListBySubscription(ctx context.Context) (result DataCollectionRuleResourceListResultPage, err error) { +func (client RulesClient) ListBySubscription(ctx context.Context) (result RuleResourceListResultPage, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRulesClient.ListBySubscription") + ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.ListBySubscription") defer func() { sc := -1 - if result.dcrrlr.Response.Response != nil { - sc = result.dcrrlr.Response.Response.StatusCode + if result.rrlr.Response.Response != nil { + sc = result.rrlr.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() @@ -440,29 +439,29 @@ func (client DataCollectionRulesClient) ListBySubscription(ctx context.Context) if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DataCollectionRulesClient", "ListBySubscription", err.Error()) + return result, validation.NewError("datacollection.RulesClient", "ListBySubscription", err.Error()) } result.fn = client.listBySubscriptionNextResults req, err := client.ListBySubscriptionPreparer(ctx) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "ListBySubscription", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "datacollection.RulesClient", "ListBySubscription", nil, "Failure preparing request") return } resp, err := client.ListBySubscriptionSender(req) if err != nil { - result.dcrrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "ListBySubscription", resp, "Failure sending request") + result.rrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datacollection.RulesClient", "ListBySubscription", resp, "Failure sending request") return } - result.dcrrlr, err = client.ListBySubscriptionResponder(resp) + result.rrlr, err = client.ListBySubscriptionResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "ListBySubscription", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "datacollection.RulesClient", "ListBySubscription", resp, "Failure responding to request") return } - if result.dcrrlr.hasNextLink() && result.dcrrlr.IsEmpty() { + if result.rrlr.hasNextLink() && result.rrlr.IsEmpty() { err = result.NextWithContext(ctx) return } @@ -471,12 +470,12 @@ func (client DataCollectionRulesClient) ListBySubscription(ctx context.Context) } // ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client DataCollectionRulesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { +func (client RulesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { pathParameters := map[string]interface{}{ "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -491,13 +490,13 @@ func (client DataCollectionRulesClient) ListBySubscriptionPreparer(ctx context.C // ListBySubscriptionSender sends the ListBySubscription request. The method will close the // http.Response Body if it receives an error. -func (client DataCollectionRulesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { +func (client RulesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always // closes the http.Response Body. -func (client DataCollectionRulesClient) ListBySubscriptionResponder(resp *http.Response) (result DataCollectionRuleResourceListResult, err error) { +func (client RulesClient) ListBySubscriptionResponder(resp *http.Response) (result RuleResourceListResult, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -508,10 +507,10 @@ func (client DataCollectionRulesClient) ListBySubscriptionResponder(resp *http.R } // listBySubscriptionNextResults retrieves the next set of results, if any. -func (client DataCollectionRulesClient) listBySubscriptionNextResults(ctx context.Context, lastResults DataCollectionRuleResourceListResult) (result DataCollectionRuleResourceListResult, err error) { - req, err := lastResults.dataCollectionRuleResourceListResultPreparer(ctx) +func (client RulesClient) listBySubscriptionNextResults(ctx context.Context, lastResults RuleResourceListResult) (result RuleResourceListResult, err error) { + req, err := lastResults.ruleResourceListResultPreparer(ctx) if err != nil { - return result, autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "datacollection.RulesClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") } if req == nil { return @@ -519,19 +518,19 @@ func (client DataCollectionRulesClient) listBySubscriptionNextResults(ctx contex resp, err := client.ListBySubscriptionSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "datacollection.RulesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") } result, err = client.ListBySubscriptionResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "datacollection.RulesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") } return } // ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client DataCollectionRulesClient) ListBySubscriptionComplete(ctx context.Context) (result DataCollectionRuleResourceListResultIterator, err error) { +func (client RulesClient) ListBySubscriptionComplete(ctx context.Context) (result RuleResourceListResultIterator, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRulesClient.ListBySubscription") + ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.ListBySubscription") defer func() { sc := -1 if result.Response().Response.Response != nil { @@ -549,9 +548,9 @@ func (client DataCollectionRulesClient) ListBySubscriptionComplete(ctx context.C // resourceGroupName - the name of the resource group. The name is case insensitive. // dataCollectionRuleName - the name of the data collection rule. The name is case insensitive. // body - the payload -func (client DataCollectionRulesClient) Update(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body *ResourceForUpdate) (result DataCollectionRuleResource, err error) { +func (client RulesClient) Update(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body *ResourceForUpdate) (result RuleResource, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRulesClient.Update") + ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.Update") defer func() { sc := -1 if result.Response.Response != nil { @@ -566,25 +565,25 @@ func (client DataCollectionRulesClient) Update(ctx context.Context, resourceGrou {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DataCollectionRulesClient", "Update", err.Error()) + return result, validation.NewError("datacollection.RulesClient", "Update", err.Error()) } req, err := client.UpdatePreparer(ctx, resourceGroupName, dataCollectionRuleName, body) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Update", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "datacollection.RulesClient", "Update", nil, "Failure preparing request") return } resp, err := client.UpdateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Update", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "datacollection.RulesClient", "Update", resp, "Failure sending request") return } result, err = client.UpdateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Update", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "datacollection.RulesClient", "Update", resp, "Failure responding to request") return } @@ -592,14 +591,14 @@ func (client DataCollectionRulesClient) Update(ctx context.Context, resourceGrou } // UpdatePreparer prepares the Update request. -func (client DataCollectionRulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body *ResourceForUpdate) (*http.Request, error) { +func (client RulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body *ResourceForUpdate) (*http.Request, error) { pathParameters := map[string]interface{}{ "dataCollectionRuleName": autorest.Encode("path", dataCollectionRuleName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -619,13 +618,13 @@ func (client DataCollectionRulesClient) UpdatePreparer(ctx context.Context, reso // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. -func (client DataCollectionRulesClient) UpdateSender(req *http.Request) (*http.Response, error) { +func (client RulesClient) UpdateSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. -func (client DataCollectionRulesClient) UpdateResponder(resp *http.Response) (result DataCollectionRuleResource, err error) { +func (client RulesClient) UpdateResponder(resp *http.Response) (result RuleResource, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/datacollection/version.go b/services/preview/monitor/mgmt/2021-09-01-preview/datacollection/version.go new file mode 100644 index 000000000000..04795516ecb0 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/datacollection/version.go @@ -0,0 +1,19 @@ +package datacollection + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " datacollection/2021-09-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/CHANGELOG.md b/services/preview/monitor/mgmt/2021-09-01-preview/insights/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/preview/monitor/mgmt/2021-09-01-preview/insights/CHANGELOG.md +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/_meta.json b/services/preview/monitor/mgmt/2021-09-01-preview/insights/_meta.json index 244fc9365ed8..1446ff4ee520 100644 --- a/services/preview/monitor/mgmt/2021-09-01-preview/insights/_meta.json +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/_meta.json @@ -1,5 +1,5 @@ { - "commit": "81ab10cd9d46a85258b710c6150ec48021c6d202", + "commit": "83f6c7b9ac240d3862e909245f0a61d70ae33908", "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", "tag": "package-2021-09", "use": "@microsoft.azure/autorest.go@2.1.187",