From a128e517f811d7735755b60a869889d0f68faca6 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 13 Jun 2024 08:13:31 +0000 Subject: [PATCH] CodeGen from PR 29427 in Azure/azure-rest-api-specs Merge 0403d481fb49f7e2ecc9c0a27434fffd66b35763 into 1996b293669d94f9817d42fd72b1eae7fa320b57 --- .../computefleet/armcomputefleet/CHANGELOG.md | 7 + .../computefleet/armcomputefleet/LICENSE.txt | 21 + .../computefleet/armcomputefleet/README.md | 92 + .../computefleet/armcomputefleet/autorest.md | 13 + .../computefleet/armcomputefleet/build.go | 7 + .../computefleet/armcomputefleet/ci.yml | 28 + .../armcomputefleet/client_factory.go | 60 + .../computefleet/armcomputefleet/constants.go | 741 ++ .../armcomputefleet/fake/fleets_server.go | 353 + .../armcomputefleet/fake/internal.go | 64 + .../armcomputefleet/fake/operations_server.go | 96 + .../armcomputefleet/fake/server_factory.go | 87 + .../armcomputefleet/fake/time_rfc3339.go | 110 + .../fake/virtualmachinescalesets_server.go | 112 + .../armcomputefleet/fleets_client.go | 460 ++ .../computefleet/armcomputefleet/go.mod | 11 + .../computefleet/armcomputefleet/go.sum | 12 + .../computefleet/armcomputefleet/models.go | 1532 ++++ .../armcomputefleet/models_serde.go | 3336 ++++++++ .../armcomputefleet/operations_client.go | 88 + .../computefleet/armcomputefleet/options.go | 55 + .../computefleet/armcomputefleet/responses.go | 56 + .../armcomputefleet/time_rfc3339.go | 110 + .../virtualmachinescalesets_client.go | 109 + .../mongocluster/armmongocluster/CHANGELOG.md | 7 + .../mongocluster/armmongocluster/LICENSE.txt | 21 + .../mongocluster/armmongocluster/README.md | 92 + .../mongocluster/armmongocluster/autorest.md | 13 + .../mongocluster/armmongocluster/build.go | 7 + .../mongocluster/armmongocluster/ci.yml | 28 + .../armmongocluster/client_factory.go | 76 + .../mongocluster/armmongocluster/constants.go | 236 + .../fake/firewallrules_server.go | 272 + .../armmongocluster/fake/internal.go | 64 + .../fake/mongoclusters_server.go | 431 + .../armmongocluster/fake/operations_server.go | 96 + .../fake/privateendpointconnections_server.go | 272 + .../fake/privatelinks_server.go | 112 + .../armmongocluster/fake/server_factory.go | 101 + .../armmongocluster/fake/time_rfc3339.go | 110 + .../armmongocluster/firewallrules_client.go | 346 + .../mongocluster/armmongocluster/go.mod | 11 + .../mongocluster/armmongocluster/go.sum | 12 + .../mongocluster/armmongocluster/models.go | 402 + .../armmongocluster/models_serde.go | 1057 +++ .../armmongocluster/mongoclusters_client.go | 595 ++ .../armmongocluster/operations_client.go | 88 + .../mongocluster/armmongocluster/options.go | 117 + .../privateendpointconnections_client.go | 347 + .../armmongocluster/privatelinks_client.go | 109 + .../mongocluster/armmongocluster/responses.go | 114 + .../armmongocluster/time_rfc3339.go | 110 + .../monitor/armmonitor/CHANGELOG.md | 156 + .../monitor/armmonitor/README.md | 2 +- .../monitor/armmonitor/actiongroups_client.go | 256 +- .../actiongroups_client_example_test.go | 938 --- .../armmonitor/activitylogalerts_client.go | 2 +- .../activitylogalerts_client_example_test.go | 611 -- .../monitor/armmonitor/activitylogs_client.go | 4 +- .../activitylogs_client_example_test.go | 168 - .../armmonitor/alertruleincidents_client.go | 2 +- .../alertruleincidents_client_example_test.go | 80 - .../monitor/armmonitor/alertrules_client.go | 2 +- .../alertrules_client_example_test.go | 416 - .../monitor/armmonitor/autorest.md | 6 +- .../armmonitor/autoscalesettings_client.go | 2 +- .../autoscalesettings_client_example_test.go | 1166 --- .../azuremonitorworkspaces_client.go | 88 +- ...remonitorworkspaces_client_example_test.go | 379 - .../monitor/armmonitor/baselines_client.go | 28 +- .../baselines_client_example_test.go | 102 - .../monitor/armmonitor/client.go | 188 + .../monitor/armmonitor/client_factory.go | 208 +- .../monitor/armmonitor/constants.go | 278 +- .../datacollectionendpoints_client.go | 243 +- ...collectionendpoints_client_example_test.go | 378 - .../datacollectionruleassociations_client.go | 26 +- ...ionruleassociations_client_example_test.go | 291 - .../armmonitor/datacollectionrules_client.go | 30 +- ...datacollectionrules_client_example_test.go | 864 -- .../diagnosticsettings_client_example_test.go | 404 - ...ticsettingscategory_client_example_test.go | 94 - .../eventcategories_client_example_test.go | 54 - .../armmonitor/fake/actiongroups_server.go | 149 + .../fake/azuremonitorworkspaces_server.go | 69 +- .../fake/datacollectionendpoints_server.go | 148 + .../fake/datacollectionrules_server.go | 18 +- .../monitor/armmonitor/fake/metrics_server.go | 28 +- .../armmonitor/fake/operations_server.go | 2 +- .../fake/privateendpointconnections_server.go | 6 +- .../fake/scheduledqueryrule_server.go | 212 + .../monitor/armmonitor/fake/server.go | 162 + .../monitor/armmonitor/fake/server_factory.go | 12 + .../monitor/armmonitor/fake/time_rfc3339.go | 111 +- sdk/resourcemanager/monitor/armmonitor/go.mod | 2 +- .../monitor/armmonitor/logprofiles_client.go | 2 +- .../logprofiles_client_example_test.go | 262 - .../monitor/armmonitor/metricalerts_client.go | 2 +- .../metricalerts_client_example_test.go | 1477 ---- .../armmonitor/metricalertsstatus_client.go | 2 +- .../metricalertsstatus_client_example_test.go | 88 - .../armmonitor/metricdefinitions_client.go | 12 +- .../metricdefinitions_client_example_test.go | 7245 ----------------- .../armmonitor/metricnamespaces_client.go | 4 +- .../metricnamespaces_client_example_test.go | 65 - .../monitor/armmonitor/metrics_client.go | 127 +- .../armmonitor/metrics_client_example_test.go | 1480 ---- .../monitor/armmonitor/models.go | 952 ++- .../monitor/armmonitor/models_serde.go | 2010 ++++- .../monitor/armmonitor/operations_client.go | 2 +- .../operations_client_example_test.go | 433 - .../armmonitor/operationsformonitor_client.go | 6 +- ...perationsformonitor_client_example_test.go | 101 - .../monitor/armmonitor/options.go | 135 +- .../monitor/armmonitor/polymorphic_helpers.go | 14 +- .../armmonitor/predictivemetric_client.go | 10 +- .../predictivemetric_client_example_test.go | 61 - .../privateendpointconnections_client.go | 10 +- ...endpointconnections_client_example_test.go | 178 - .../armmonitor/privatelinkresources_client.go | 2 +- ...rivatelinkresources_client_example_test.go | 105 - .../privatelinkscopedresources_client.go | 2 +- ...linkscopedresources_client_example_test.go | 184 - .../privatelinkscopeoperationstatus_client.go | 2 +- ...copeoperationstatus_client_example_test.go | 45 - .../armmonitor/privatelinkscopes_client.go | 2 +- .../privatelinkscopes_client_example_test.go | 405 - .../{response_types.go => responses.go} | 81 +- .../armmonitor/scheduledqueryrule_client.go | 261 + .../armmonitor/scheduledqueryrules_client.go | 26 +- ...scheduledqueryrules_client_example_test.go | 859 -- .../armmonitor/tenantactiongroups_client.go | 30 +- .../tenantactiongroups_client_example_test.go | 425 - .../armmonitor/tenantactivitylogs_client.go | 2 +- .../tenantactivitylogs_client_example_test.go | 325 - .../monitor/armmonitor/time_rfc3339.go | 111 +- .../vminsights_client_example_test.go | 219 - 137 files changed, 17872 insertions(+), 21083 deletions(-) create mode 100644 sdk/resourcemanager/computefleet/armcomputefleet/CHANGELOG.md create mode 100644 sdk/resourcemanager/computefleet/armcomputefleet/LICENSE.txt create mode 100644 sdk/resourcemanager/computefleet/armcomputefleet/README.md create mode 100644 sdk/resourcemanager/computefleet/armcomputefleet/autorest.md create mode 100644 sdk/resourcemanager/computefleet/armcomputefleet/build.go create mode 100644 sdk/resourcemanager/computefleet/armcomputefleet/ci.yml create mode 100644 sdk/resourcemanager/computefleet/armcomputefleet/client_factory.go create mode 100644 sdk/resourcemanager/computefleet/armcomputefleet/constants.go create mode 100644 sdk/resourcemanager/computefleet/armcomputefleet/fake/fleets_server.go create mode 100644 sdk/resourcemanager/computefleet/armcomputefleet/fake/internal.go create mode 100644 sdk/resourcemanager/computefleet/armcomputefleet/fake/operations_server.go create mode 100644 sdk/resourcemanager/computefleet/armcomputefleet/fake/server_factory.go create mode 100644 sdk/resourcemanager/computefleet/armcomputefleet/fake/time_rfc3339.go create mode 100644 sdk/resourcemanager/computefleet/armcomputefleet/fake/virtualmachinescalesets_server.go create mode 100644 sdk/resourcemanager/computefleet/armcomputefleet/fleets_client.go create mode 100644 sdk/resourcemanager/computefleet/armcomputefleet/go.mod create mode 100644 sdk/resourcemanager/computefleet/armcomputefleet/go.sum create mode 100644 sdk/resourcemanager/computefleet/armcomputefleet/models.go create mode 100644 sdk/resourcemanager/computefleet/armcomputefleet/models_serde.go create mode 100644 sdk/resourcemanager/computefleet/armcomputefleet/operations_client.go create mode 100644 sdk/resourcemanager/computefleet/armcomputefleet/options.go create mode 100644 sdk/resourcemanager/computefleet/armcomputefleet/responses.go create mode 100644 sdk/resourcemanager/computefleet/armcomputefleet/time_rfc3339.go create mode 100644 sdk/resourcemanager/computefleet/armcomputefleet/virtualmachinescalesets_client.go create mode 100644 sdk/resourcemanager/mongocluster/armmongocluster/CHANGELOG.md create mode 100644 sdk/resourcemanager/mongocluster/armmongocluster/LICENSE.txt create mode 100644 sdk/resourcemanager/mongocluster/armmongocluster/README.md create mode 100644 sdk/resourcemanager/mongocluster/armmongocluster/autorest.md create mode 100644 sdk/resourcemanager/mongocluster/armmongocluster/build.go create mode 100644 sdk/resourcemanager/mongocluster/armmongocluster/ci.yml create mode 100644 sdk/resourcemanager/mongocluster/armmongocluster/client_factory.go create mode 100644 sdk/resourcemanager/mongocluster/armmongocluster/constants.go create mode 100644 sdk/resourcemanager/mongocluster/armmongocluster/fake/firewallrules_server.go create mode 100644 sdk/resourcemanager/mongocluster/armmongocluster/fake/internal.go create mode 100644 sdk/resourcemanager/mongocluster/armmongocluster/fake/mongoclusters_server.go create mode 100644 sdk/resourcemanager/mongocluster/armmongocluster/fake/operations_server.go create mode 100644 sdk/resourcemanager/mongocluster/armmongocluster/fake/privateendpointconnections_server.go create mode 100644 sdk/resourcemanager/mongocluster/armmongocluster/fake/privatelinks_server.go create mode 100644 sdk/resourcemanager/mongocluster/armmongocluster/fake/server_factory.go create mode 100644 sdk/resourcemanager/mongocluster/armmongocluster/fake/time_rfc3339.go create mode 100644 sdk/resourcemanager/mongocluster/armmongocluster/firewallrules_client.go create mode 100644 sdk/resourcemanager/mongocluster/armmongocluster/go.mod create mode 100644 sdk/resourcemanager/mongocluster/armmongocluster/go.sum create mode 100644 sdk/resourcemanager/mongocluster/armmongocluster/models.go create mode 100644 sdk/resourcemanager/mongocluster/armmongocluster/models_serde.go create mode 100644 sdk/resourcemanager/mongocluster/armmongocluster/mongoclusters_client.go create mode 100644 sdk/resourcemanager/mongocluster/armmongocluster/operations_client.go create mode 100644 sdk/resourcemanager/mongocluster/armmongocluster/options.go create mode 100644 sdk/resourcemanager/mongocluster/armmongocluster/privateendpointconnections_client.go create mode 100644 sdk/resourcemanager/mongocluster/armmongocluster/privatelinks_client.go create mode 100644 sdk/resourcemanager/mongocluster/armmongocluster/responses.go create mode 100644 sdk/resourcemanager/mongocluster/armmongocluster/time_rfc3339.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/actiongroups_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/activitylogs_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/alertrules_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/baselines_client_example_test.go create mode 100644 sdk/resourcemanager/monitor/armmonitor/client.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/eventcategories_client_example_test.go create mode 100644 sdk/resourcemanager/monitor/armmonitor/fake/scheduledqueryrule_server.go create mode 100644 sdk/resourcemanager/monitor/armmonitor/fake/server.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/logprofiles_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/metricalerts_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/metrics_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/operations_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/predictivemetric_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client_example_test.go rename sdk/resourcemanager/monitor/armmonitor/{response_types.go => responses.go} (89%) create mode 100644 sdk/resourcemanager/monitor/armmonitor/scheduledqueryrule_client.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/vminsights_client_example_test.go diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/CHANGELOG.md b/sdk/resourcemanager/computefleet/armcomputefleet/CHANGELOG.md new file mode 100644 index 000000000000..281dfe070cd2 --- /dev/null +++ b/sdk/resourcemanager/computefleet/armcomputefleet/CHANGELOG.md @@ -0,0 +1,7 @@ +# Release History + +## 0.1.0 (2024-06-13) + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/LICENSE.txt b/sdk/resourcemanager/computefleet/armcomputefleet/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/computefleet/armcomputefleet/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/README.md b/sdk/resourcemanager/computefleet/armcomputefleet/README.md new file mode 100644 index 000000000000..f1d7be0c5caa --- /dev/null +++ b/sdk/resourcemanager/computefleet/armcomputefleet/README.md @@ -0,0 +1,92 @@ +# Azure Computefleet Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet) + +The `armcomputefleet` module provides operations for working with Azure Computefleet. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/computefleet/armcomputefleet) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).) + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Computefleet module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Computefleet. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Client Factory + +Azure Computefleet module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armcomputefleet.NewClientFactory(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +clientFactory, err := armcomputefleet.NewClientFactory(, cred, &options) +``` + +## Clients + +A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. + +```go +client := clientFactory.NewFleetsClient() +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Computefleet` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/autorest.md b/sdk/resourcemanager/computefleet/armcomputefleet/autorest.md new file mode 100644 index 000000000000..e9a27f8cb115 --- /dev/null +++ b/sdk/resourcemanager/computefleet/armcomputefleet/autorest.md @@ -0,0 +1,13 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +azure-arm: true +require: +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/azurefleet/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/azurefleet/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 0.1.0 + +``` \ No newline at end of file diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/build.go b/sdk/resourcemanager/computefleet/armcomputefleet/build.go new file mode 100644 index 000000000000..e27c04a43de1 --- /dev/null +++ b/sdk/resourcemanager/computefleet/armcomputefleet/build.go @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file enables 'go generate' to regenerate this specific SDK +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -alwaysSetBodyParamRequired -removeUnreferencedTypes resourcemanager/computefleet/armcomputefleet + +package armcomputefleet diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/ci.yml b/sdk/resourcemanager/computefleet/armcomputefleet/ci.yml new file mode 100644 index 000000000000..a4201c1477d6 --- /dev/null +++ b/sdk/resourcemanager/computefleet/armcomputefleet/ci.yml @@ -0,0 +1,28 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/computefleet/armcomputefleet/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/computefleet/armcomputefleet/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/computefleet/armcomputefleet' diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/client_factory.go b/sdk/resourcemanager/computefleet/armcomputefleet/client_factory.go new file mode 100644 index 000000000000..4cf7abd1bc3c --- /dev/null +++ b/sdk/resourcemanager/computefleet/armcomputefleet/client_factory.go @@ -0,0 +1,60 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcomputefleet + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + internal *arm.Client +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, + internal: internal, + }, nil +} + +// NewFleetsClient creates a new instance of FleetsClient. +func (c *ClientFactory) NewFleetsClient() *FleetsClient { + return &FleetsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + return &OperationsClient{ + internal: c.internal, + } +} + +// NewVirtualMachineScaleSetsClient creates a new instance of VirtualMachineScaleSetsClient. +func (c *ClientFactory) NewVirtualMachineScaleSetsClient() *VirtualMachineScaleSetsClient { + return &VirtualMachineScaleSetsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/constants.go b/sdk/resourcemanager/computefleet/armcomputefleet/constants.go new file mode 100644 index 000000000000..83f8f38b62cc --- /dev/null +++ b/sdk/resourcemanager/computefleet/armcomputefleet/constants.go @@ -0,0 +1,741 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcomputefleet + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet" + moduleVersion = "v0.1.0" +) + +// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + +// CachingTypes - Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The default values are: +// None for Standard storage. ReadOnly for Premium storage +type CachingTypes string + +const ( + CachingTypesNone CachingTypes = "None" + CachingTypesReadOnly CachingTypes = "ReadOnly" + CachingTypesReadWrite CachingTypes = "ReadWrite" +) + +// PossibleCachingTypesValues returns the possible values for the CachingTypes const type. +func PossibleCachingTypesValues() []CachingTypes { + return []CachingTypes{ + CachingTypesNone, + CachingTypesReadOnly, + CachingTypesReadWrite, + } +} + +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// DeleteOptions - Specify what happens to the network interface when the VM is deleted +type DeleteOptions string + +const ( + DeleteOptionsDelete DeleteOptions = "Delete" + DeleteOptionsDetach DeleteOptions = "Detach" +) + +// PossibleDeleteOptionsValues returns the possible values for the DeleteOptions const type. +func PossibleDeleteOptionsValues() []DeleteOptions { + return []DeleteOptions{ + DeleteOptionsDelete, + DeleteOptionsDetach, + } +} + +// DiffDiskOptions - Specifies the ephemeral disk option for operating system disk. +type DiffDiskOptions string + +const ( + DiffDiskOptionsLocal DiffDiskOptions = "Local" +) + +// PossibleDiffDiskOptionsValues returns the possible values for the DiffDiskOptions const type. +func PossibleDiffDiskOptionsValues() []DiffDiskOptions { + return []DiffDiskOptions{ + DiffDiskOptionsLocal, + } +} + +// DiffDiskPlacement - Specifies the ephemeral disk placement for operating system disk. This property can be used by user +// in the request to choose the location i.e, cache disk or resource disk space for Ephemeral OS disk +// provisioning. For more information on Ephemeral OS disk size requirements, please refer Ephemeral OS disk size requirements +// for Windows VM at +// https://docs.microsoft.com/azure/virtual-machines/windows/ephemeral-os-disks#size-requirements and Linux VM at +// https://docs.microsoft.com/azure/virtual-machines/linux/ephemeral-os-disks#size-requirements +type DiffDiskPlacement string + +const ( + DiffDiskPlacementCacheDisk DiffDiskPlacement = "CacheDisk" + DiffDiskPlacementResourceDisk DiffDiskPlacement = "ResourceDisk" +) + +// PossibleDiffDiskPlacementValues returns the possible values for the DiffDiskPlacement const type. +func PossibleDiffDiskPlacementValues() []DiffDiskPlacement { + return []DiffDiskPlacement{ + DiffDiskPlacementCacheDisk, + DiffDiskPlacementResourceDisk, + } +} + +// DiskCreateOptionTypes - Specifies how the virtual machine should be created. Possible values are: Attach. This value is +// used when you are using a specialized disk to create the virtual machine. FromImage. This value is used +// when you are using an image to create the virtual machine. If you are using a platform image, you also use the imageReference +// element described above. If you are using a marketplace image, you also +// use the plan element previously described. +type DiskCreateOptionTypes string + +const ( + DiskCreateOptionTypesAttach DiskCreateOptionTypes = "Attach" + DiskCreateOptionTypesEmpty DiskCreateOptionTypes = "Empty" + DiskCreateOptionTypesFromImage DiskCreateOptionTypes = "FromImage" +) + +// PossibleDiskCreateOptionTypesValues returns the possible values for the DiskCreateOptionTypes const type. +func PossibleDiskCreateOptionTypesValues() []DiskCreateOptionTypes { + return []DiskCreateOptionTypes{ + DiskCreateOptionTypesAttach, + DiskCreateOptionTypesEmpty, + DiskCreateOptionTypesFromImage, + } +} + +// DiskDeleteOptionTypes - Specifies the behavior of the managed disk when the VM gets deleted, for example whether the managed +// disk is deleted or detached. Supported values are: Delete. If this value is used, the managed disk +// is deleted when VM gets deleted. Detach. If this value is used, the managed disk is retained after VM gets deleted. Minimum +// api-version: 2021-03-01. +type DiskDeleteOptionTypes string + +const ( + DiskDeleteOptionTypesDelete DiskDeleteOptionTypes = "Delete" + DiskDeleteOptionTypesDetach DiskDeleteOptionTypes = "Detach" +) + +// PossibleDiskDeleteOptionTypesValues returns the possible values for the DiskDeleteOptionTypes const type. +func PossibleDiskDeleteOptionTypesValues() []DiskDeleteOptionTypes { + return []DiskDeleteOptionTypes{ + DiskDeleteOptionTypesDelete, + DiskDeleteOptionTypesDetach, + } +} + +// DomainNameLabelScopeTypes - The Domain name label scope.The concatenation of the hashed domain name label that generated +// according to the policy from domain name label scope and vm index will be the domain name labels of the +// PublicIPAddress resources that will be created +type DomainNameLabelScopeTypes string + +const ( + DomainNameLabelScopeTypesNoReuse DomainNameLabelScopeTypes = "NoReuse" + DomainNameLabelScopeTypesResourceGroupReuse DomainNameLabelScopeTypes = "ResourceGroupReuse" + DomainNameLabelScopeTypesSubscriptionReuse DomainNameLabelScopeTypes = "SubscriptionReuse" + DomainNameLabelScopeTypesTenantReuse DomainNameLabelScopeTypes = "TenantReuse" +) + +// PossibleDomainNameLabelScopeTypesValues returns the possible values for the DomainNameLabelScopeTypes const type. +func PossibleDomainNameLabelScopeTypesValues() []DomainNameLabelScopeTypes { + return []DomainNameLabelScopeTypes{ + DomainNameLabelScopeTypesNoReuse, + DomainNameLabelScopeTypesResourceGroupReuse, + DomainNameLabelScopeTypesSubscriptionReuse, + DomainNameLabelScopeTypesTenantReuse, + } +} + +// EvictionPolicy - Different kind of eviction policies +type EvictionPolicy string + +const ( + // EvictionPolicyDeallocate - When evicted, the Spot VM will be deallocated/stopped + EvictionPolicyDeallocate EvictionPolicy = "Deallocate" + // EvictionPolicyDelete - When evicted, the Spot VM will be deleted and the corresponding capacity will be updated to reflect + // this. + EvictionPolicyDelete EvictionPolicy = "Delete" +) + +// PossibleEvictionPolicyValues returns the possible values for the EvictionPolicy const type. +func PossibleEvictionPolicyValues() []EvictionPolicy { + return []EvictionPolicy{ + EvictionPolicyDeallocate, + EvictionPolicyDelete, + } +} + +// IPVersion - Available from Api-Version 2017-03-30 onwards, it represents whether the specific ipconfiguration is IPv4 or +// IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. +type IPVersion string + +const ( + IPVersionIPv4 IPVersion = "IPv4" + IPVersionIPv6 IPVersion = "IPv6" +) + +// PossibleIPVersionValues returns the possible values for the IPVersion const type. +func PossibleIPVersionValues() []IPVersion { + return []IPVersion{ + IPVersionIPv4, + IPVersionIPv6, + } +} + +// LinuxPatchAssessmentMode - Specifies the mode of VM Guest Patch Assessment for the IaaS virtual machine. +// Possible values are: +// ImageDefault - You control the timing of patch assessments on a virtual machine. +// AutomaticByPlatform - The platform will trigger periodic patch assessments. The property provisionVMAgent must be true. +type LinuxPatchAssessmentMode string + +const ( + LinuxPatchAssessmentModeAutomaticByPlatform LinuxPatchAssessmentMode = "AutomaticByPlatform" + LinuxPatchAssessmentModeImageDefault LinuxPatchAssessmentMode = "ImageDefault" +) + +// PossibleLinuxPatchAssessmentModeValues returns the possible values for the LinuxPatchAssessmentMode const type. +func PossibleLinuxPatchAssessmentModeValues() []LinuxPatchAssessmentMode { + return []LinuxPatchAssessmentMode{ + LinuxPatchAssessmentModeAutomaticByPlatform, + LinuxPatchAssessmentModeImageDefault, + } +} + +// LinuxVMGuestPatchAutomaticByPlatformRebootSetting - Specifies the reboot setting for all AutomaticByPlatform patch installation +// operations. +type LinuxVMGuestPatchAutomaticByPlatformRebootSetting string + +const ( + LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Always" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "IfRequired" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Never" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Unknown" +) + +// PossibleLinuxVMGuestPatchAutomaticByPlatformRebootSettingValues returns the possible values for the LinuxVMGuestPatchAutomaticByPlatformRebootSetting const type. +func PossibleLinuxVMGuestPatchAutomaticByPlatformRebootSettingValues() []LinuxVMGuestPatchAutomaticByPlatformRebootSetting { + return []LinuxVMGuestPatchAutomaticByPlatformRebootSetting{ + LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways, + LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired, + LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever, + LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown, + } +} + +// LinuxVMGuestPatchMode - Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated +// to virtual machine scale set with OrchestrationMode as Flexible. +// Possible values are: +// ImageDefault - The virtual machine's default patching configuration is used. +// AutomaticByPlatform - The virtual machine will be automatically updated by the platform. The property provisionVMAgent +// must be true +type LinuxVMGuestPatchMode string + +const ( + LinuxVMGuestPatchModeAutomaticByPlatform LinuxVMGuestPatchMode = "AutomaticByPlatform" + LinuxVMGuestPatchModeImageDefault LinuxVMGuestPatchMode = "ImageDefault" +) + +// PossibleLinuxVMGuestPatchModeValues returns the possible values for the LinuxVMGuestPatchMode const type. +func PossibleLinuxVMGuestPatchModeValues() []LinuxVMGuestPatchMode { + return []LinuxVMGuestPatchMode{ + LinuxVMGuestPatchModeAutomaticByPlatform, + LinuxVMGuestPatchModeImageDefault, + } +} + +// ManagedServiceIdentityType - Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). +type ManagedServiceIdentityType string + +const ( + ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" + ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" + ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" + ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" +) + +// PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type. +func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { + return []ManagedServiceIdentityType{ + ManagedServiceIdentityTypeNone, + ManagedServiceIdentityTypeSystemAssigned, + ManagedServiceIdentityTypeSystemAssignedUserAssigned, + ManagedServiceIdentityTypeSystemAssignedUserAssigned, + ManagedServiceIdentityTypeUserAssigned, + } +} + +// Mode - Specifies the mode that ProxyAgent will execute on if the feature is enabled. ProxyAgent will start to audit or +// monitor but not enforce access control over requests to host endpoints in Audit mode, +// while in Enforce mode it will enforce access control. The default value is Enforce mode. +type Mode string + +const ( + ModeAudit Mode = "Audit" + ModeEnforce Mode = "Enforce" +) + +// PossibleModeValues returns the possible values for the Mode const type. +func PossibleModeValues() []Mode { + return []Mode{ + ModeAudit, + ModeEnforce, + } +} + +// NetworkAPIVersion - specifies the Microsoft.Network API version used when creating networking resources in the Network +// Interface Configurations for Virtual Machine Scale Set with orchestration mode 'Flexible' +type NetworkAPIVersion string + +const ( + NetworkAPIVersionTwoThousandTwenty1101 NetworkAPIVersion = "2020-11-01" +) + +// PossibleNetworkAPIVersionValues returns the possible values for the NetworkAPIVersion const type. +func PossibleNetworkAPIVersionValues() []NetworkAPIVersion { + return []NetworkAPIVersion{ + NetworkAPIVersionTwoThousandTwenty1101, + } +} + +// NetworkInterfaceAuxiliaryMode - Specifies whether the Auxiliary mode is enabled for the Network Interface resource. +type NetworkInterfaceAuxiliaryMode string + +const ( + NetworkInterfaceAuxiliaryModeAcceleratedConnections NetworkInterfaceAuxiliaryMode = "AcceleratedConnections" + NetworkInterfaceAuxiliaryModeFloating NetworkInterfaceAuxiliaryMode = "Floating" + NetworkInterfaceAuxiliaryModeNone NetworkInterfaceAuxiliaryMode = "None" +) + +// PossibleNetworkInterfaceAuxiliaryModeValues returns the possible values for the NetworkInterfaceAuxiliaryMode const type. +func PossibleNetworkInterfaceAuxiliaryModeValues() []NetworkInterfaceAuxiliaryMode { + return []NetworkInterfaceAuxiliaryMode{ + NetworkInterfaceAuxiliaryModeAcceleratedConnections, + NetworkInterfaceAuxiliaryModeFloating, + NetworkInterfaceAuxiliaryModeNone, + } +} + +// NetworkInterfaceAuxiliarySKU - Specifies whether the Auxiliary sku is enabled for the Network Interface resource. +type NetworkInterfaceAuxiliarySKU string + +const ( + NetworkInterfaceAuxiliarySKUA1 NetworkInterfaceAuxiliarySKU = "A1" + NetworkInterfaceAuxiliarySKUA2 NetworkInterfaceAuxiliarySKU = "A2" + NetworkInterfaceAuxiliarySKUA4 NetworkInterfaceAuxiliarySKU = "A4" + NetworkInterfaceAuxiliarySKUA8 NetworkInterfaceAuxiliarySKU = "A8" + NetworkInterfaceAuxiliarySKUNone NetworkInterfaceAuxiliarySKU = "None" +) + +// PossibleNetworkInterfaceAuxiliarySKUValues returns the possible values for the NetworkInterfaceAuxiliarySKU const type. +func PossibleNetworkInterfaceAuxiliarySKUValues() []NetworkInterfaceAuxiliarySKU { + return []NetworkInterfaceAuxiliarySKU{ + NetworkInterfaceAuxiliarySKUA1, + NetworkInterfaceAuxiliarySKUA2, + NetworkInterfaceAuxiliarySKUA4, + NetworkInterfaceAuxiliarySKUA8, + NetworkInterfaceAuxiliarySKUNone, + } +} + +// OperatingSystemTypes - This property allows you to specify the type of the OS that is included in the disk if creating +// a VM from user-image or a specialized VHD. Possible values are: Windows, Linux. +type OperatingSystemTypes string + +const ( + OperatingSystemTypesLinux OperatingSystemTypes = "Linux" + OperatingSystemTypesWindows OperatingSystemTypes = "Windows" +) + +// PossibleOperatingSystemTypesValues returns the possible values for the OperatingSystemTypes const type. +func PossibleOperatingSystemTypesValues() []OperatingSystemTypes { + return []OperatingSystemTypes{ + OperatingSystemTypesLinux, + OperatingSystemTypesWindows, + } +} + +// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default +// value is "user,system" +type Origin string + +const ( + OriginSystem Origin = "system" + OriginUser Origin = "user" + OriginUserSystem Origin = "user,system" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + +// ProtocolTypes - Specifies the protocol of WinRM listener. Possible values are: http, https. +type ProtocolTypes string + +const ( + ProtocolTypesHTTP ProtocolTypes = "Http" + ProtocolTypesHTTPS ProtocolTypes = "Https" +) + +// PossibleProtocolTypesValues returns the possible values for the ProtocolTypes const type. +func PossibleProtocolTypesValues() []ProtocolTypes { + return []ProtocolTypes{ + ProtocolTypesHTTP, + ProtocolTypesHTTPS, + } +} + +// ProvisioningState - The status of the current operation. +type ProvisioningState string + +const ( + // ProvisioningStateCanceled - Resource creation was canceled. + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateCreating - Initial creation in progress. + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleting - Deletion in progress. + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - Resource creation failed. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateMigrating - Resource is being migrated from one subscription or resource group to another. + ProvisioningStateMigrating ProvisioningState = "Migrating" + // ProvisioningStateSucceeded - Resource has been created. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating - Update in progress. + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateCanceled, + ProvisioningStateCreating, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateMigrating, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + } +} + +// PublicIPAddressSKUName - Specify public IP sku name +type PublicIPAddressSKUName string + +const ( + PublicIPAddressSKUNameBasic PublicIPAddressSKUName = "Basic" + PublicIPAddressSKUNameStandard PublicIPAddressSKUName = "Standard" +) + +// PossiblePublicIPAddressSKUNameValues returns the possible values for the PublicIPAddressSKUName const type. +func PossiblePublicIPAddressSKUNameValues() []PublicIPAddressSKUName { + return []PublicIPAddressSKUName{ + PublicIPAddressSKUNameBasic, + PublicIPAddressSKUNameStandard, + } +} + +// PublicIPAddressSKUTier - Specify public IP sku tier +type PublicIPAddressSKUTier string + +const ( + PublicIPAddressSKUTierGlobal PublicIPAddressSKUTier = "Global" + PublicIPAddressSKUTierRegional PublicIPAddressSKUTier = "Regional" +) + +// PossiblePublicIPAddressSKUTierValues returns the possible values for the PublicIPAddressSKUTier const type. +func PossiblePublicIPAddressSKUTierValues() []PublicIPAddressSKUTier { + return []PublicIPAddressSKUTier{ + PublicIPAddressSKUTierGlobal, + PublicIPAddressSKUTierRegional, + } +} + +// RegularPriorityAllocationStrategy - Regular VM Allocation strategy types for Compute Fleet +type RegularPriorityAllocationStrategy string + +const ( + // RegularPriorityAllocationStrategyLowestPrice - Default. VM sizes distribution will be determined to optimize for price. + RegularPriorityAllocationStrategyLowestPrice RegularPriorityAllocationStrategy = "LowestPrice" + // RegularPriorityAllocationStrategyPrioritized - VM sizes distribution will be determined to optimize for the 'priority' + // as specified for each vm size. + RegularPriorityAllocationStrategyPrioritized RegularPriorityAllocationStrategy = "Prioritized" +) + +// PossibleRegularPriorityAllocationStrategyValues returns the possible values for the RegularPriorityAllocationStrategy const type. +func PossibleRegularPriorityAllocationStrategyValues() []RegularPriorityAllocationStrategy { + return []RegularPriorityAllocationStrategy{ + RegularPriorityAllocationStrategyLowestPrice, + RegularPriorityAllocationStrategyPrioritized, + } +} + +// SecurityEncryptionTypes - Specifies the EncryptionType of the managed disk. It is set to DiskWithVMGuestState for encryption +// of the managed disk along with VMGuestState blob, VMGuestStateOnly for encryption of just the +// VMGuestState blob, and NonPersistedTPM for not persisting firmware state in the VMGuestState blob.. Note: It can be set +// for only Confidential VMs. +type SecurityEncryptionTypes string + +const ( + SecurityEncryptionTypesDiskWithVMGuestState SecurityEncryptionTypes = "DiskWithVMGuestState" + SecurityEncryptionTypesNonPersistedTPM SecurityEncryptionTypes = "NonPersistedTPM" + SecurityEncryptionTypesVMGuestStateOnly SecurityEncryptionTypes = "VMGuestStateOnly" +) + +// PossibleSecurityEncryptionTypesValues returns the possible values for the SecurityEncryptionTypes const type. +func PossibleSecurityEncryptionTypesValues() []SecurityEncryptionTypes { + return []SecurityEncryptionTypes{ + SecurityEncryptionTypesDiskWithVMGuestState, + SecurityEncryptionTypesNonPersistedTPM, + SecurityEncryptionTypesVMGuestStateOnly, + } +} + +// SecurityTypes - Specifies the SecurityType of the virtual machine. It has to be set to any specified value to enable UefiSettings. +// The default behavior is: UefiSettings will not be enabled unless this property is +// set. +type SecurityTypes string + +const ( + SecurityTypesConfidentialVM SecurityTypes = "ConfidentialVM" + SecurityTypesTrustedLaunch SecurityTypes = "TrustedLaunch" +) + +// PossibleSecurityTypesValues returns the possible values for the SecurityTypes const type. +func PossibleSecurityTypesValues() []SecurityTypes { + return []SecurityTypes{ + SecurityTypesConfidentialVM, + SecurityTypesTrustedLaunch, + } +} + +// SettingNames - Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands +// and AutoLogon. +type SettingNames string + +const ( + SettingNamesAutoLogon SettingNames = "AutoLogon" + SettingNamesFirstLogonCommands SettingNames = "FirstLogonCommands" +) + +// PossibleSettingNamesValues returns the possible values for the SettingNames const type. +func PossibleSettingNamesValues() []SettingNames { + return []SettingNames{ + SettingNamesAutoLogon, + SettingNamesFirstLogonCommands, + } +} + +// SpotAllocationStrategy - Spot allocation strategy types for Compute Fleet +type SpotAllocationStrategy string + +const ( + // SpotAllocationStrategyCapacityOptimized - VM sizes distribution will be determined to optimize for capacity. + SpotAllocationStrategyCapacityOptimized SpotAllocationStrategy = "CapacityOptimized" + // SpotAllocationStrategyLowestPrice - VM sizes distribution will be determined to optimize for price. Note: Capacity will + // still be considered here but will be given much less weight. + SpotAllocationStrategyLowestPrice SpotAllocationStrategy = "LowestPrice" + // SpotAllocationStrategyPriceCapacityOptimized - Default. VM sizes distribution will be determined to optimize for both price + // and capacity. + SpotAllocationStrategyPriceCapacityOptimized SpotAllocationStrategy = "PriceCapacityOptimized" +) + +// PossibleSpotAllocationStrategyValues returns the possible values for the SpotAllocationStrategy const type. +func PossibleSpotAllocationStrategyValues() []SpotAllocationStrategy { + return []SpotAllocationStrategy{ + SpotAllocationStrategyCapacityOptimized, + SpotAllocationStrategyLowestPrice, + SpotAllocationStrategyPriceCapacityOptimized, + } +} + +// StatusLevelTypes - The level code. +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +// PossibleStatusLevelTypesValues returns the possible values for the StatusLevelTypes const type. +func PossibleStatusLevelTypesValues() []StatusLevelTypes { + return []StatusLevelTypes{ + StatusLevelTypesError, + StatusLevelTypesInfo, + StatusLevelTypesWarning, + } +} + +// StorageAccountTypes - Specifies the storage account type for the managed disk. Managed OS disk storage account type can +// only be set when you create the scale set. NOTE: UltraSSDLRS can only be used with data disks. It +// cannot be used with OS Disk. StandardLRS uses Standard HDD. StandardSSDLRS uses Standard SSD. PremiumLRS uses Premium SSD. +// UltraSSDLRS uses Ultra disk. PremiumZRS uses Premium SSD zone redundant +// storage. StandardSSD_ZRS uses Standard SSD zone redundant storage. For more information regarding disks supported for Windows +// Virtual Machines, refer to +// https://docs.microsoft.com/azure/virtual-machines/windows/disks-types and, for Linux Virtual Machines, refer to https://docs.microsoft.com/azure/virtual-machines/linux/disks-types +type StorageAccountTypes string + +const ( + StorageAccountTypesPremiumLRS StorageAccountTypes = "Premium_LRS" + StorageAccountTypesPremiumV2LRS StorageAccountTypes = "PremiumV2_LRS" + StorageAccountTypesPremiumZRS StorageAccountTypes = "Premium_ZRS" + StorageAccountTypesStandardLRS StorageAccountTypes = "Standard_LRS" + StorageAccountTypesStandardSSDLRS StorageAccountTypes = "StandardSSD_LRS" + StorageAccountTypesStandardSSDZRS StorageAccountTypes = "StandardSSD_ZRS" + StorageAccountTypesUltraSSDLRS StorageAccountTypes = "UltraSSD_LRS" +) + +// PossibleStorageAccountTypesValues returns the possible values for the StorageAccountTypes const type. +func PossibleStorageAccountTypesValues() []StorageAccountTypes { + return []StorageAccountTypes{ + StorageAccountTypesPremiumLRS, + StorageAccountTypesPremiumV2LRS, + StorageAccountTypesPremiumZRS, + StorageAccountTypesStandardLRS, + StorageAccountTypesStandardSSDLRS, + StorageAccountTypesStandardSSDZRS, + StorageAccountTypesUltraSSDLRS, + } +} + +// VirtualMachineEvictionPolicyTypes - Specifies the eviction policy for the Azure Spot VM/VMSS +type VirtualMachineEvictionPolicyTypes string + +const ( + VirtualMachineEvictionPolicyTypesDeallocate VirtualMachineEvictionPolicyTypes = "Deallocate" + VirtualMachineEvictionPolicyTypesDelete VirtualMachineEvictionPolicyTypes = "Delete" +) + +// PossibleVirtualMachineEvictionPolicyTypesValues returns the possible values for the VirtualMachineEvictionPolicyTypes const type. +func PossibleVirtualMachineEvictionPolicyTypesValues() []VirtualMachineEvictionPolicyTypes { + return []VirtualMachineEvictionPolicyTypes{ + VirtualMachineEvictionPolicyTypesDeallocate, + VirtualMachineEvictionPolicyTypesDelete, + } +} + +// VirtualMachinePriorityTypes - Specifies the priority for a standalone virtual machine or the virtual machines in the scale +// set. 'Low' enum will be deprecated in the future, please use 'Spot' as the enum to deploy Azure Spot +// VM/VMSS. +type VirtualMachinePriorityTypes string + +const ( + VirtualMachinePriorityTypesLow VirtualMachinePriorityTypes = "Low" + VirtualMachinePriorityTypesRegular VirtualMachinePriorityTypes = "Regular" + VirtualMachinePriorityTypesSpot VirtualMachinePriorityTypes = "Spot" +) + +// PossibleVirtualMachinePriorityTypesValues returns the possible values for the VirtualMachinePriorityTypes const type. +func PossibleVirtualMachinePriorityTypesValues() []VirtualMachinePriorityTypes { + return []VirtualMachinePriorityTypes{ + VirtualMachinePriorityTypesLow, + VirtualMachinePriorityTypesRegular, + VirtualMachinePriorityTypesSpot, + } +} + +// WindowsPatchAssessmentMode - Specifies the mode of VM Guest patch assessment for the IaaS virtual machine. +// Possible values are: +// ImageDefault - You control the timing of patch assessments on a virtual machine. +// AutomaticByPlatform - The platform will trigger periodic patch assessments. The property provisionVMAgent must be true. +type WindowsPatchAssessmentMode string + +const ( + WindowsPatchAssessmentModeAutomaticByPlatform WindowsPatchAssessmentMode = "AutomaticByPlatform" + WindowsPatchAssessmentModeImageDefault WindowsPatchAssessmentMode = "ImageDefault" +) + +// PossibleWindowsPatchAssessmentModeValues returns the possible values for the WindowsPatchAssessmentMode const type. +func PossibleWindowsPatchAssessmentModeValues() []WindowsPatchAssessmentMode { + return []WindowsPatchAssessmentMode{ + WindowsPatchAssessmentModeAutomaticByPlatform, + WindowsPatchAssessmentModeImageDefault, + } +} + +// WindowsVMGuestPatchAutomaticByPlatformRebootSetting - Specifies the reboot setting for all AutomaticByPlatform patch installation +// operations. +type WindowsVMGuestPatchAutomaticByPlatformRebootSetting string + +const ( + WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Always" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "IfRequired" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Never" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Unknown" +) + +// PossibleWindowsVMGuestPatchAutomaticByPlatformRebootSettingValues returns the possible values for the WindowsVMGuestPatchAutomaticByPlatformRebootSetting const type. +func PossibleWindowsVMGuestPatchAutomaticByPlatformRebootSettingValues() []WindowsVMGuestPatchAutomaticByPlatformRebootSetting { + return []WindowsVMGuestPatchAutomaticByPlatformRebootSetting{ + WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways, + WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired, + WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever, + WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown, + } +} + +// WindowsVMGuestPatchMode - Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated +// to virtual machine scale set with OrchestrationMode as Flexible. +// Possible values are: +// Manual - You control the application of patches to a virtual machine. You do this by applying patches manually inside the +// VM. In this mode, automatic updates are disabled; the property +// WindowsConfiguration.enableAutomaticUpdates must be false +// AutomaticByOS - The virtual machine will automatically be updated by the OS. The property WindowsConfiguration.enableAutomaticUpdates +// must be true. +// AutomaticByPlatform - the virtual machine will automatically updated by the platform. The properties provisionVMAgent and +// WindowsConfiguration.enableAutomaticUpdates must be true +type WindowsVMGuestPatchMode string + +const ( + WindowsVMGuestPatchModeAutomaticByOS WindowsVMGuestPatchMode = "AutomaticByOS" + WindowsVMGuestPatchModeAutomaticByPlatform WindowsVMGuestPatchMode = "AutomaticByPlatform" + WindowsVMGuestPatchModeManual WindowsVMGuestPatchMode = "Manual" +) + +// PossibleWindowsVMGuestPatchModeValues returns the possible values for the WindowsVMGuestPatchMode const type. +func PossibleWindowsVMGuestPatchModeValues() []WindowsVMGuestPatchMode { + return []WindowsVMGuestPatchMode{ + WindowsVMGuestPatchModeAutomaticByOS, + WindowsVMGuestPatchModeAutomaticByPlatform, + WindowsVMGuestPatchModeManual, + } +} diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/fake/fleets_server.go b/sdk/resourcemanager/computefleet/armcomputefleet/fake/fleets_server.go new file mode 100644 index 000000000000..de7445ae25ab --- /dev/null +++ b/sdk/resourcemanager/computefleet/armcomputefleet/fake/fleets_server.go @@ -0,0 +1,353 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet" + "net/http" + "net/url" + "regexp" +) + +// FleetsServer is a fake server for instances of the armcomputefleet.FleetsClient type. +type FleetsServer struct { + // BeginCreateOrUpdate is the fake for method FleetsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, fleetName string, resource armcomputefleet.Fleet, options *armcomputefleet.FleetsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armcomputefleet.FleetsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method FleetsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, fleetName string, options *armcomputefleet.FleetsClientBeginDeleteOptions) (resp azfake.PollerResponder[armcomputefleet.FleetsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method FleetsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, fleetName string, options *armcomputefleet.FleetsClientGetOptions) (resp azfake.Responder[armcomputefleet.FleetsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method FleetsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armcomputefleet.FleetsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armcomputefleet.FleetsClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method FleetsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armcomputefleet.FleetsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armcomputefleet.FleetsClientListBySubscriptionResponse]) + + // BeginUpdate is the fake for method FleetsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, fleetName string, properties armcomputefleet.FleetUpdate, options *armcomputefleet.FleetsClientBeginUpdateOptions) (resp azfake.PollerResponder[armcomputefleet.FleetsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewFleetsServerTransport creates a new instance of FleetsServerTransport with the provided implementation. +// The returned FleetsServerTransport instance is connected to an instance of armcomputefleet.FleetsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewFleetsServerTransport(srv *FleetsServer) *FleetsServerTransport { + return &FleetsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armcomputefleet.FleetsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armcomputefleet.FleetsClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armcomputefleet.FleetsClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armcomputefleet.FleetsClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armcomputefleet.FleetsClientUpdateResponse]](), + } +} + +// FleetsServerTransport connects instances of armcomputefleet.FleetsClient to instances of FleetsServer. +// Don't use this type directly, use NewFleetsServerTransport instead. +type FleetsServerTransport struct { + srv *FleetsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armcomputefleet.FleetsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armcomputefleet.FleetsClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armcomputefleet.FleetsClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armcomputefleet.FleetsClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[armcomputefleet.FleetsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for FleetsServerTransport. +func (f *FleetsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "FleetsClient.BeginCreateOrUpdate": + resp, err = f.dispatchBeginCreateOrUpdate(req) + case "FleetsClient.BeginDelete": + resp, err = f.dispatchBeginDelete(req) + case "FleetsClient.Get": + resp, err = f.dispatchGet(req) + case "FleetsClient.NewListByResourceGroupPager": + resp, err = f.dispatchNewListByResourceGroupPager(req) + case "FleetsClient.NewListBySubscriptionPager": + resp, err = f.dispatchNewListBySubscriptionPager(req) + case "FleetsClient.BeginUpdate": + resp, err = f.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (f *FleetsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if f.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := f.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureFleet/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcomputefleet.Fleet](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, fleetNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + f.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + f.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + f.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (f *FleetsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if f.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := f.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureFleet/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginDelete(req.Context(), resourceGroupNameParam, fleetNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + f.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + f.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + f.beginDelete.remove(req) + } + + return resp, nil +} + +func (f *FleetsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if f.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureFleet/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.Get(req.Context(), resourceGroupNameParam, fleetNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Fleet, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (f *FleetsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if f.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := f.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureFleet/fleets` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := f.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + f.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armcomputefleet.FleetsClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + f.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + f.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (f *FleetsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if f.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := f.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureFleet/fleets` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := f.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + f.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armcomputefleet.FleetsClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + f.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + f.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (f *FleetsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if f.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := f.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureFleet/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcomputefleet.FleetUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginUpdate(req.Context(), resourceGroupNameParam, fleetNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + f.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + f.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + f.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/fake/internal.go b/sdk/resourcemanager/computefleet/armcomputefleet/fake/internal.go new file mode 100644 index 000000000000..5f75802a569e --- /dev/null +++ b/sdk/resourcemanager/computefleet/armcomputefleet/fake/internal.go @@ -0,0 +1,64 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "net/http" + "sync" +) + +type nonRetriableError struct { + error +} + +func (nonRetriableError) NonRetriable() { + // marker method +} + +func contains[T comparable](s []T, v T) bool { + for _, vv := range s { + if vv == v { + return true + } + } + return false +} + +func newTracker[T any]() *tracker[T] { + return &tracker[T]{ + items: map[string]*T{}, + } +} + +type tracker[T any] struct { + items map[string]*T + mu sync.Mutex +} + +func (p *tracker[T]) get(req *http.Request) *T { + p.mu.Lock() + defer p.mu.Unlock() + if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok { + return item + } + return nil +} + +func (p *tracker[T]) add(req *http.Request, item *T) { + p.mu.Lock() + defer p.mu.Unlock() + p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item +} + +func (p *tracker[T]) remove(req *http.Request) { + p.mu.Lock() + defer p.mu.Unlock() + delete(p.items, server.SanitizePagerPollerPath(req.URL.Path)) +} diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/fake/operations_server.go b/sdk/resourcemanager/computefleet/armcomputefleet/fake/operations_server.go new file mode 100644 index 000000000000..50e7e3847460 --- /dev/null +++ b/sdk/resourcemanager/computefleet/armcomputefleet/fake/operations_server.go @@ -0,0 +1,96 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet" + "net/http" +) + +// OperationsServer is a fake server for instances of the armcomputefleet.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armcomputefleet.OperationsClientListOptions) (resp azfake.PagerResponder[armcomputefleet.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armcomputefleet.OperationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { + return &OperationsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armcomputefleet.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armcomputefleet.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armcomputefleet.OperationsClientListResponse]] +} + +// Do implements the policy.Transporter interface for OperationsServerTransport. +func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "OperationsClient.NewListPager": + resp, err = o.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := o.newListPager.get(req) + if newListPager == nil { + resp := o.srv.NewListPager(nil) + newListPager = &resp + o.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcomputefleet.OperationsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + o.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + o.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/fake/server_factory.go b/sdk/resourcemanager/computefleet/armcomputefleet/fake/server_factory.go new file mode 100644 index 000000000000..8b89855a0366 --- /dev/null +++ b/sdk/resourcemanager/computefleet/armcomputefleet/fake/server_factory.go @@ -0,0 +1,87 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" + "sync" +) + +// ServerFactory is a fake server for instances of the armcomputefleet.ClientFactory type. +type ServerFactory struct { + FleetsServer FleetsServer + OperationsServer OperationsServer + VirtualMachineScaleSetsServer VirtualMachineScaleSetsServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armcomputefleet.ClientFactory via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { + return &ServerFactoryTransport{ + srv: srv, + } +} + +// ServerFactoryTransport connects instances of armcomputefleet.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trFleetsServer *FleetsServerTransport + trOperationsServer *OperationsServerTransport + trVirtualMachineScaleSetsServer *VirtualMachineScaleSetsServerTransport +} + +// Do implements the policy.Transporter interface for ServerFactoryTransport. +func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + client := method[:strings.Index(method, ".")] + var resp *http.Response + var err error + + switch client { + case "FleetsClient": + initServer(s, &s.trFleetsServer, func() *FleetsServerTransport { return NewFleetsServerTransport(&s.srv.FleetsServer) }) + resp, err = s.trFleetsServer.Do(req) + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + case "VirtualMachineScaleSetsClient": + initServer(s, &s.trVirtualMachineScaleSetsServer, func() *VirtualMachineScaleSetsServerTransport { + return NewVirtualMachineScaleSetsServerTransport(&s.srv.VirtualMachineScaleSetsServer) + }) + resp, err = s.trVirtualMachineScaleSetsServer.Do(req) + default: + err = fmt.Errorf("unhandled client %s", client) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { + s.trMu.Lock() + if *dst == nil { + *dst = src() + } + s.trMu.Unlock() +} diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/fake/time_rfc3339.go b/sdk/resourcemanager/computefleet/armcomputefleet/fake/time_rfc3339.go new file mode 100644 index 000000000000..81f308b0d343 --- /dev/null +++ b/sdk/resourcemanager/computefleet/armcomputefleet/fake/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/fake/virtualmachinescalesets_server.go b/sdk/resourcemanager/computefleet/armcomputefleet/fake/virtualmachinescalesets_server.go new file mode 100644 index 000000000000..67c0939c11eb --- /dev/null +++ b/sdk/resourcemanager/computefleet/armcomputefleet/fake/virtualmachinescalesets_server.go @@ -0,0 +1,112 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet" + "net/http" + "net/url" + "regexp" +) + +// VirtualMachineScaleSetsServer is a fake server for instances of the armcomputefleet.VirtualMachineScaleSetsClient type. +type VirtualMachineScaleSetsServer struct { + // NewListByFleetPager is the fake for method VirtualMachineScaleSetsClient.NewListByFleetPager + // HTTP status codes to indicate success: http.StatusOK + NewListByFleetPager func(resourceGroupName string, name string, options *armcomputefleet.VirtualMachineScaleSetsClientListByFleetOptions) (resp azfake.PagerResponder[armcomputefleet.VirtualMachineScaleSetsClientListByFleetResponse]) +} + +// NewVirtualMachineScaleSetsServerTransport creates a new instance of VirtualMachineScaleSetsServerTransport with the provided implementation. +// The returned VirtualMachineScaleSetsServerTransport instance is connected to an instance of armcomputefleet.VirtualMachineScaleSetsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewVirtualMachineScaleSetsServerTransport(srv *VirtualMachineScaleSetsServer) *VirtualMachineScaleSetsServerTransport { + return &VirtualMachineScaleSetsServerTransport{ + srv: srv, + newListByFleetPager: newTracker[azfake.PagerResponder[armcomputefleet.VirtualMachineScaleSetsClientListByFleetResponse]](), + } +} + +// VirtualMachineScaleSetsServerTransport connects instances of armcomputefleet.VirtualMachineScaleSetsClient to instances of VirtualMachineScaleSetsServer. +// Don't use this type directly, use NewVirtualMachineScaleSetsServerTransport instead. +type VirtualMachineScaleSetsServerTransport struct { + srv *VirtualMachineScaleSetsServer + newListByFleetPager *tracker[azfake.PagerResponder[armcomputefleet.VirtualMachineScaleSetsClientListByFleetResponse]] +} + +// Do implements the policy.Transporter interface for VirtualMachineScaleSetsServerTransport. +func (v *VirtualMachineScaleSetsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "VirtualMachineScaleSetsClient.NewListByFleetPager": + resp, err = v.dispatchNewListByFleetPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (v *VirtualMachineScaleSetsServerTransport) dispatchNewListByFleetPager(req *http.Request) (*http.Response, error) { + if v.srv.NewListByFleetPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByFleetPager not implemented")} + } + newListByFleetPager := v.newListByFleetPager.get(req) + if newListByFleetPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureFleet/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachineScaleSets` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) + if err != nil { + return nil, err + } + resp := v.srv.NewListByFleetPager(resourceGroupNameParam, nameParam, nil) + newListByFleetPager = &resp + v.newListByFleetPager.add(req, newListByFleetPager) + server.PagerResponderInjectNextLinks(newListByFleetPager, req, func(page *armcomputefleet.VirtualMachineScaleSetsClientListByFleetResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByFleetPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + v.newListByFleetPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByFleetPager) { + v.newListByFleetPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/fleets_client.go b/sdk/resourcemanager/computefleet/armcomputefleet/fleets_client.go new file mode 100644 index 000000000000..7f68bd643dcc --- /dev/null +++ b/sdk/resourcemanager/computefleet/armcomputefleet/fleets_client.go @@ -0,0 +1,460 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcomputefleet + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// FleetsClient contains the methods for the Fleets group. +// Don't use this type directly, use NewFleetsClient() instead. +type FleetsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewFleetsClient creates a new instance of FleetsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewFleetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FleetsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FleetsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a Fleet +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - The name of the Compute Fleet +// - resource - Resource create parameters. +// - options - FleetsClientBeginCreateOrUpdateOptions contains the optional parameters for the FleetsClient.BeginCreateOrUpdate +// method. +func (client *FleetsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, resource Fleet, options *FleetsClientBeginCreateOrUpdateOptions) (*runtime.Poller[FleetsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, fleetName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a Fleet +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-05-01-preview +func (client *FleetsClient) createOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, resource Fleet, options *FleetsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "FleetsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, fleetName, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *FleetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, resource Fleet, options *FleetsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureFleet/fleets/{fleetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a Fleet +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - The name of the Compute Fleet +// - options - FleetsClientBeginDeleteOptions contains the optional parameters for the FleetsClient.BeginDelete method. +func (client *FleetsClient) BeginDelete(ctx context.Context, resourceGroupName string, fleetName string, options *FleetsClientBeginDeleteOptions) (*runtime.Poller[FleetsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, fleetName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a Fleet +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-05-01-preview +func (client *FleetsClient) deleteOperation(ctx context.Context, resourceGroupName string, fleetName string, options *FleetsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "FleetsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, fleetName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *FleetsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, options *FleetsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureFleet/fleets/{fleetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a Fleet +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - The name of the Compute Fleet +// - options - FleetsClientGetOptions contains the optional parameters for the FleetsClient.Get method. +func (client *FleetsClient) Get(ctx context.Context, resourceGroupName string, fleetName string, options *FleetsClientGetOptions) (FleetsClientGetResponse, error) { + var err error + const operationName = "FleetsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, fleetName, options) + if err != nil { + return FleetsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FleetsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FleetsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *FleetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, options *FleetsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureFleet/fleets/{fleetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FleetsClient) getHandleResponse(resp *http.Response) (FleetsClientGetResponse, error) { + result := FleetsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Fleet); err != nil { + return FleetsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List Fleet resources by resource group +// +// Generated from API version 2024-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - FleetsClientListByResourceGroupOptions contains the optional parameters for the FleetsClient.NewListByResourceGroupPager +// method. +func (client *FleetsClient) NewListByResourceGroupPager(resourceGroupName string, options *FleetsClientListByResourceGroupOptions) *runtime.Pager[FleetsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[FleetsClientListByResourceGroupResponse]{ + More: func(page FleetsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FleetsClientListByResourceGroupResponse) (FleetsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "FleetsClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return FleetsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *FleetsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *FleetsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureFleet/fleets" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *FleetsClient) listByResourceGroupHandleResponse(resp *http.Response) (FleetsClientListByResourceGroupResponse, error) { + result := FleetsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FleetListResult); err != nil { + return FleetsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List Fleet resources by subscription ID +// +// Generated from API version 2024-05-01-preview +// - options - FleetsClientListBySubscriptionOptions contains the optional parameters for the FleetsClient.NewListBySubscriptionPager +// method. +func (client *FleetsClient) NewListBySubscriptionPager(options *FleetsClientListBySubscriptionOptions) *runtime.Pager[FleetsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[FleetsClientListBySubscriptionResponse]{ + More: func(page FleetsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FleetsClientListBySubscriptionResponse) (FleetsClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "FleetsClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return FleetsClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *FleetsClient) listBySubscriptionCreateRequest(ctx context.Context, options *FleetsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AzureFleet/fleets" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *FleetsClient) listBySubscriptionHandleResponse(resp *http.Response) (FleetsClientListBySubscriptionResponse, error) { + result := FleetsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FleetListResult); err != nil { + return FleetsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update a Fleet +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - The name of the Compute Fleet +// - properties - The resource properties to be updated. +// - options - FleetsClientBeginUpdateOptions contains the optional parameters for the FleetsClient.BeginUpdate method. +func (client *FleetsClient) BeginUpdate(ctx context.Context, resourceGroupName string, fleetName string, properties FleetUpdate, options *FleetsClientBeginUpdateOptions) (*runtime.Poller[FleetsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, fleetName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update a Fleet +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-05-01-preview +func (client *FleetsClient) update(ctx context.Context, resourceGroupName string, fleetName string, properties FleetUpdate, options *FleetsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "FleetsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, fleetName, properties, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *FleetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, properties FleetUpdate, options *FleetsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureFleet/fleets/{fleetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/go.mod b/sdk/resourcemanager/computefleet/armcomputefleet/go.mod new file mode 100644 index 000000000000..c642e3f6beca --- /dev/null +++ b/sdk/resourcemanager/computefleet/armcomputefleet/go.mod @@ -0,0 +1,11 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet + +go 1.18 + +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/text v0.14.0 // indirect +) diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/go.sum b/sdk/resourcemanager/computefleet/armcomputefleet/go.sum new file mode 100644 index 000000000000..03ce617a1873 --- /dev/null +++ b/sdk/resourcemanager/computefleet/armcomputefleet/go.sum @@ -0,0 +1,12 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 h1:c4k2FIYIh4xtwqrQwV0Ct1v5+ehlNXj5NI/MWVsiTkQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2/go.mod h1:5FDJtLEO/GxwNgUxbwrY3LP0pEoThTQJtk2oysdXHxM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 h1:LqbJ/WzJUwBf8UiaSzgX7aMclParm9/5Vgp+TY51uBQ= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2/go.mod h1:yInRyqWXAuaPrgI7p70+lDDgh3mlBohis29jGMISnmc= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/models.go b/sdk/resourcemanager/computefleet/armcomputefleet/models.go new file mode 100644 index 000000000000..ce8a293db361 --- /dev/null +++ b/sdk/resourcemanager/computefleet/armcomputefleet/models.go @@ -0,0 +1,1532 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcomputefleet + +import "time" + +// APIEntityReference - The API entity reference. +type APIEntityReference struct { + // The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/… + ID *string +} + +// APIError - Api error. +type APIError struct { + // The error code. + Code *string + + // The Api error details + Details []*APIErrorBase + + // The Api inner error + Innererror *InnerError + + // The error message. + Message *string + + // The target of the particular error. + Target *string +} + +// APIErrorBase - Api error base. +type APIErrorBase struct { + // The error code. + Code *string + + // The error message. + Message *string + + // The target of the particular error. + Target *string +} + +// AdditionalUnattendContent - Specifies additional XML formatted information that can be included in the Unattend.xml file, +// which is used by Windows Setup. Contents are defined by setting name, component name, and the pass in +// which the content is applied. +type AdditionalUnattendContent struct { + // The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup. + ComponentName *string + + // Specifies the XML formatted content that is added to the unattend.xml file for the specified path and component. The XML + // must be less than 4KB and must include the root element for the setting or + // feature that is being inserted. + Content *string + + // The pass name. Currently, the only allowable value is OobeSystem. + PassName *string + + // Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon. + SettingName *SettingNames +} + +// ApplicationProfile - Contains the list of gallery applications that should be made available to the VM/VMSS +type ApplicationProfile struct { + // Specifies the gallery applications that should be made available to the VM/VMSS + GalleryApplications []*VMGalleryApplication +} + +// BillingProfile - Specifies the billing related details of a Azure Spot VM or VMSS. Minimum api-version: 2019-03-01. +type BillingProfile struct { + // Specifies the maximum price you are willing to pay for a Azure Spot VM/VMSS. This price is in US Dollars. + // This price will be compared with the current Azure Spot price for the VM size. Also, the prices are compared at the time + // of create/update of Azure Spot VM/VMSS and the operation will only succeed if + // the maxPrice is greater than the current Azure Spot price. + // The maxPrice will also be used for evicting a Azure Spot VM/VMSS if the current Azure Spot price goes beyond the maxPrice + // after creation of VM/VMSS. + // Possible values are: + // - Any decimal value greater than zero. Example: 0.01538 + // -1 – indicates default price to be up-to on-demand. + // You can set the maxPrice to -1 to indicate that the Azure Spot VM/VMSS should not be evicted for price reasons. Also, the + // default max price is -1 if it is not provided by you. + // Minimum api-version: 2019-03-01. + MaxPrice *float64 +} + +// BootDiagnostics - Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose +// VM status. You can easily view the output of your console log. Azure also enables you to see +// a screenshot of the VM from the hypervisor. +type BootDiagnostics struct { + // Whether boot diagnostics should be enabled on the Virtual Machine. + Enabled *bool + + // Uri of the storage account to use for placing the console output and screenshot. If storageUri is not specified while enabling + // boot diagnostics, managed storage will be used. + StorageURI *string +} + +// CapacityReservationProfile - The parameters of a capacity reservation Profile. +type CapacityReservationProfile struct { + // Specifies the capacity reservation group resource id that should be used for allocating the virtual machine or scaleset + // vm instances provided enough capacity has been reserved. Please refer to + // https://aka.ms/CapacityReservation for more details. + CapacityReservationGroup *SubResource +} + +// ComputeProfile - Compute Profile to use for running user's workloads. +type ComputeProfile struct { + // REQUIRED; Base Virtual Machine Profile Properties to be specified according to + // "specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/{computeApiVersion}/virtualMachineScaleSet.json#/definitions/VirtualMachineScaleSetVMProfile" + BaseVirtualMachineProfile *VirtualMachineScaleSetVMProfile + + // Specifies the Microsoft.Compute API version to use when creating underlying Virtual Machine scale sets and Virtual Machines. + // The default value will be the latest supported computeApiVersion by Compute + // Fleet. + ComputeAPIVersion *string + + // Specifies the number of fault domains to use when creating the underlying VMSS. A fault domain is a logical group of hardware + // within an Azure datacenter. VMs in the same fault domain share a common + // power source and network switch. If not specified, defaults to 1, which represents "Max Spreading" (using as many fault + // domains as possible). This property cannot be updated. + PlatformFaultDomainCount *int32 +} + +// ComputeProfileUpdate - Compute Profile to use for running user's workloads. +type ComputeProfileUpdate struct { + // Base Virtual Machine Profile Properties to be specified according to + // "specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/{computeApiVersion}/virtualMachineScaleSet.json#/definitions/VirtualMachineScaleSetVMProfile" + BaseVirtualMachineProfile *VirtualMachineScaleSetVMProfile + + // Specifies the Microsoft.Compute API version to use when creating underlying Virtual Machine scale sets and Virtual Machines. + // The default value will be the latest supported computeApiVersion by Compute + // Fleet. + ComputeAPIVersion *string + + // Specifies the number of fault domains to use when creating the underlying VMSS. A fault domain is a logical group of hardware + // within an Azure datacenter. VMs in the same fault domain share a common + // power source and network switch. If not specified, defaults to 1, which represents "Max Spreading" (using as many fault + // domains as possible). This property cannot be updated. + PlatformFaultDomainCount *int32 +} + +// DiagnosticsProfile - Specifies the boot diagnostic settings state. Minimum api-version: 2015-06-15. +type DiagnosticsProfile struct { + // Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. NOTE: + // If storageUri is being specified then ensure that the storage account is in + // the same region and subscription as the VM. You can easily view the output of your console log. Azure also enables you + // to see a screenshot of the VM from the hypervisor. + BootDiagnostics *BootDiagnostics +} + +// DiffDiskSettings - Describes the parameters of ephemeral disk settings that can be specified for operating system disk. +// Note: The ephemeral disk settings can only be specified for managed disk. +type DiffDiskSettings struct { + // Specifies the ephemeral disk settings for operating system disk. + Option *DiffDiskOptions + + // Specifies the ephemeral disk placement for operating system disk. Possible values are: CacheDisk, ResourceDisk. The defaulting + // behavior is: CacheDisk if one is configured for the VM size otherwise + // ResourceDisk is used. Refer to the VM size documentation for Windows VM at https://docs.microsoft.com/azure/virtual-machines/windows/sizes + // and Linux VM at + // https://docs.microsoft.com/azure/virtual-machines/linux/sizes to check which VM sizes exposes a cache disk. + Placement *DiffDiskPlacement +} + +// DiskEncryptionSetParameters - Describes the parameter of customer managed disk encryption set resource id that can be specified +// for disk. Note: The disk encryption set resource id can only be specified for managed disk. Please +// refer https://aka.ms/mdssewithcmkoverview for more details. +type DiskEncryptionSetParameters struct { + // Resource Id + ID *string +} + +// EncryptionIdentity - Specifies the Managed Identity used by ADE to get access token for keyvault operations. +type EncryptionIdentity struct { + // Specifies ARM Resource ID of one of the user identities associated with the VM. + UserAssignedIdentityResourceID *string +} + +// Fleet - An Compute Fleet resource +type Fleet struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The managed service identities assigned to this resource. + Identity *ManagedServiceIdentity + + // Details of the resource plan. + Plan *Plan + + // The resource-specific properties for this resource. + Properties *FleetProperties + + // Resource tags. + Tags map[string]*string + + // Zones in which the Compute Fleet is available + Zones []*string + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// FleetListResult - The response of a Fleet list operation. +type FleetListResult struct { + // REQUIRED; The Fleet items on this page + Value []*Fleet + + // The link to the next page of items + NextLink *string +} + +// FleetProperties - Details of the Compute Fleet. +type FleetProperties struct { + // REQUIRED; Compute Profile to use for running user's workloads. + ComputeProfile *ComputeProfile + + // REQUIRED; List of VM sizes supported for Compute Fleet + VMSizesProfile []*VMSizeProfile + + // Configuration Options for Regular instances in Compute Fleet. + RegularPriorityProfile *RegularPriorityProfile + + // Configuration Options for Spot instances in Compute Fleet. + SpotPriorityProfile *SpotPriorityProfile + + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState +} + +// FleetPropertiesUpdate - Details of the Compute Fleet. +type FleetPropertiesUpdate struct { + // Compute Profile to use for running user's workloads. + ComputeProfile *ComputeProfileUpdate + + // Configuration Options for Regular instances in Compute Fleet. + RegularPriorityProfile *RegularPriorityProfile + + // Configuration Options for Spot instances in Compute Fleet. + SpotPriorityProfile *SpotPriorityProfile + + // List of VM sizes supported for Compute Fleet + VMSizesProfile []*VMSizeProfile +} + +// FleetUpdate - Fleet Update Model +type FleetUpdate struct { + // Updatable managed service identity + Identity *ManagedServiceIdentityUpdate + + // Updatable resource plan + Plan *ResourcePlanUpdate + + // RP-specific updatable properties + Properties *FleetPropertiesUpdate + + // Resource tags. + Tags map[string]*string +} + +// ImageReference - Specifies information about the image to use. You can specify information about platform images, marketplace +// images, or virtual machine images. This element is required when you want to use a platform +// image, marketplace image, or virtual machine image, but is not used in other creation operations. NOTE: Image reference +// publisher and offer can only be set when you create the scale set. +type ImageReference struct { + // Specified the community gallery image unique id for vm deployment. This can be fetched from community gallery image GET + // call. + CommunityGalleryImageID *string + + // Resource Id + ID *string + + // Specifies the offer of the platform image or marketplace image used to create the virtual machine. + Offer *string + + // The image publisher. + Publisher *string + + // The image SKU. + SKU *string + + // Specified the shared gallery image unique id for vm deployment. This can be fetched from shared gallery image GET call. + SharedGalleryImageID *string + + // Specifies the version of the platform image or marketplace image used to create the virtual machine. The allowed formats + // are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. + // Specify 'latest' to use the latest version of an image available at deploy time. Even if you use 'latest', the VM image + // will not automatically update after deploy time even if a new version becomes + // available. Please do not use field 'version' for gallery image deployment, gallery image should always use 'id' field for + // deployment, to use 'latest' version of gallery image, just set + // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}' + // in the 'id' field without version input. + Version *string + + // READ-ONLY; Specifies in decimal numbers, the version of platform image or marketplace image used to create the virtual + // machine. This readonly field differs from 'version', only if the value specified in + // 'version' field is 'latest'. + ExactVersion *string +} + +// InnerError - Inner error details. +type InnerError struct { + // The internal error message or exception dump. + Errordetail *string + + // The exception type. + Exceptiontype *string +} + +// InstanceViewStatus - Instance view status. +type InstanceViewStatus struct { + // The status code. + Code *string + + // The short localizable label for the status. + DisplayStatus *string + + // The level code. + Level *StatusLevelTypes + + // The detailed status message, including for alerts and error messages. + Message *string + + // The time of the status. + Time *time.Time +} + +// KeyVaultSecretReference - Describes a reference to Key Vault Secret +type KeyVaultSecretReference struct { + // REQUIRED; The URL referencing a secret in a Key Vault. + SecretURL *string + + // REQUIRED; The relative URL of the Key Vault containing the secret. + SourceVault *SubResource +} + +// LinuxConfiguration - Specifies the Linux operating system settings on the virtual machine. For a list of supported Linux +// distributions, see Linux on Azure-Endorsed Distributions +// [https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros]. +type LinuxConfiguration struct { + // Specifies whether password authentication should be disabled. + DisablePasswordAuthentication *bool + + // Indicates whether VMAgent Platform Updates is enabled for the Linux virtual machine. Default value is false. + EnableVMAgentPlatformUpdates *bool + + // [Preview Feature] Specifies settings related to VM Guest Patching on Linux. + PatchSettings *LinuxPatchSettings + + // Indicates whether virtual machine agent should be provisioned on the virtual machine. When this property is not specified + // in the request body, default behavior is to set it to true. This will ensure + // that VM Agent is installed on the VM so that extensions can be added to the VM later. + ProvisionVMAgent *bool + + // Specifies the ssh key configuration for a Linux OS. + SSH *SSHConfiguration +} + +// LinuxPatchSettings - Specifies settings related to VM Guest Patching on Linux. +type LinuxPatchSettings struct { + // Specifies the mode of VM Guest Patch Assessment for the IaaS virtual machine. + // Possible values are: + // ImageDefault - You control the timing of patch assessments on a virtual machine. + // AutomaticByPlatform - The platform will trigger periodic patch assessments. The property provisionVMAgent must be true. + AssessmentMode *LinuxPatchAssessmentMode + + // Specifies additional settings for patch mode AutomaticByPlatform in VM Guest Patching on Linux. + AutomaticByPlatformSettings *LinuxVMGuestPatchAutomaticByPlatformSettings + + // Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated to virtual machine scale + // set with OrchestrationMode as Flexible. + // Possible values are: + // ImageDefault - The virtual machine's default patching configuration is used. + // AutomaticByPlatform - The virtual machine will be automatically updated by the platform. The property provisionVMAgent + // must be true + PatchMode *LinuxVMGuestPatchMode +} + +// LinuxVMGuestPatchAutomaticByPlatformSettings - Specifies additional settings to be applied when patch mode AutomaticByPlatform +// is selected in Linux patch settings. +type LinuxVMGuestPatchAutomaticByPlatformSettings struct { + // Enables customer to schedule patching without accidental upgrades + BypassPlatformSafetyChecksOnUserSchedule *bool + + // Specifies the reboot setting for all AutomaticByPlatform patch installation operations. + RebootSetting *LinuxVMGuestPatchAutomaticByPlatformRebootSetting +} + +// ManagedServiceIdentity - Managed service identity (system assigned and/or user assigned identities) +type ManagedServiceIdentity struct { + // REQUIRED; Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + Type *ManagedServiceIdentityType + + // The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM + // resource ids in the form: + // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + // The dictionary values can be empty objects ({}) in + // requests. + UserAssignedIdentities map[string]*UserAssignedIdentity + + // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned + // identity. + PrincipalID *string + + // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *string +} + +// ManagedServiceIdentityUpdate - The template for adding optional properties. +type ManagedServiceIdentityUpdate struct { + // The type of managed identity assigned to this resource. + Type *ManagedServiceIdentityType + + // The identities assigned to this resource by the user. + UserAssignedIdentities map[string]*UserAssignedIdentity +} + +type OSImageNotificationProfile struct { + // Specifies whether the OS Image Scheduled event is enabled or disabled. + Enable *bool + + // Length of time a Virtual Machine being reimaged or having its OS upgraded will have to potentially approve the OS Image + // Scheduled Event before the event is auto approved (timed out). The configuration + // is specified in ISO 8601 format, and the value must be 15 minutes (PT15M) + NotBeforeTimeout *string +} + +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane + // operations. + IsDataAction *bool + + // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", + // "Microsoft.Compute/virtualMachines/capture/action" + Name *string + + // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + // value is "user,system" + Origin *Origin +} + +// OperationDisplay - Localized display information for this particular operation. +type OperationDisplay struct { + // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. + Description *string + + // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + // Machine", "Restart Virtual Machine". + Operation *string + + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". + Provider *string + + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". + Resource *string +} + +// OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to +// get the next set of results. +type OperationListResult struct { + // READ-ONLY; URL to get the next set of operation list results (if there are any). + NextLink *string + + // READ-ONLY; List of operations supported by the resource provider + Value []*Operation +} + +// PatchSettings - Specifies settings related to VM Guest Patching on Windows. +type PatchSettings struct { + // Specifies the mode of VM Guest patch assessment for the IaaS virtual machine. + // Possible values are: + // ImageDefault - You control the timing of patch assessments on a virtual machine. + // AutomaticByPlatform - The platform will trigger periodic patch assessments. The property provisionVMAgent must be true. + AssessmentMode *WindowsPatchAssessmentMode + + // Specifies additional settings for patch mode AutomaticByPlatform in VM Guest Patching on Windows. + AutomaticByPlatformSettings *WindowsVMGuestPatchAutomaticByPlatformSettings + + // Enables customers to patch their Azure VMs without requiring a reboot. For enableHotpatching, the 'provisionVMAgent' must + // be set to true and 'patchMode' must be set to 'AutomaticByPlatform'. + EnableHotpatching *bool + + // Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated to virtual machine scale + // set with OrchestrationMode as Flexible. + // Possible values are: + // Manual - You control the application of patches to a virtual machine. You do this by applying patches manually inside the + // VM. In this mode, automatic updates are disabled; the property + // WindowsConfiguration.enableAutomaticUpdates must be false + // AutomaticByOS - The virtual machine will automatically be updated by the OS. The property WindowsConfiguration.enableAutomaticUpdates + // must be true. + // AutomaticByPlatform - the virtual machine will automatically updated by the platform. The properties provisionVMAgent and + // WindowsConfiguration.enableAutomaticUpdates must be true + PatchMode *WindowsVMGuestPatchMode +} + +// Plan for the resource. +type Plan struct { + // REQUIRED; A user defined name of the 3rd Party Artifact that is being procured. + Name *string + + // REQUIRED; The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact + // at the time of Data Market onboarding. + Product *string + + // REQUIRED; The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic + Publisher *string + + // A publisher provided promotion code as provisioned in Data Market for the said product/artifact. + PromotionCode *string + + // The version of the desired product/artifact. + Version *string +} + +// ProxyAgentSettings - Specifies ProxyAgent settings while creating the virtual machine. Minimum api-version: 2023-09-01. +type ProxyAgentSettings struct { + // Specifies whether ProxyAgent feature should be enabled on the virtual machine or virtual machine scale set. + Enabled *bool + + // Increase the value of this property allows user to reset the key used for securing communication channel between guest + // and host. + KeyIncarnationID *int32 + + // Specifies the mode that ProxyAgent will execute on if the feature is enabled. ProxyAgent will start to audit or monitor + // but not enforce access control over requests to host endpoints in Audit mode, + // while in Enforce mode it will enforce access control. The default value is Enforce mode. + Mode *Mode +} + +// PublicIPAddressSKU - Describes the public IP Sku. It can only be set with OrchestrationMode as Flexible. +type PublicIPAddressSKU struct { + // Specify public IP sku name + Name *PublicIPAddressSKUName + + // Specify public IP sku tier + Tier *PublicIPAddressSKUTier +} + +// RegularPriorityProfile - Configuration Options for Regular instances in Compute Fleet. +type RegularPriorityProfile struct { + // Allocation strategy to follow when determining the VM sizes distribution for Regular VMs. + AllocationStrategy *RegularPriorityAllocationStrategy + + // Total capacity to achieve. It is currently in terms of number of VMs. + Capacity *int32 + + // Minimum capacity to achieve which cannot be updated. If we will not be able to "guarantee" minimum capacity, we will reject + // the request in the sync path itself. + MinCapacity *int32 +} + +// ResourcePlanUpdate - The template for adding optional properties. +type ResourcePlanUpdate struct { + // A user defined name of the 3rd Party Artifact that is being procured. + Name *string + + // The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at + // the time of Data Market onboarding. + Product *string + + // A publisher provided promotion code as provisioned in Data Market for the said product/artifact. + PromotionCode *string + + // The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic + Publisher *string + + // The version of the desired product/artifact. + Version *string +} + +// SSHConfiguration - SSH configuration for Linux based VMs running on Azure +type SSHConfiguration struct { + // The list of SSH public keys used to authenticate with linux based VMs. + PublicKeys []*SSHPublicKey +} + +// SSHPublicKey - Contains information about SSH certificate public key and the path on the Linux VM where the public key +// is placed. +type SSHPublicKey struct { + // SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa + // format. For creating ssh keys, see [Create SSH keys on Linux and Mac for + // Linux VMs in Azure]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + KeyData *string + + // Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key + // is appended to the file. Example: /home/user/.ssh/authorized_keys + Path *string +} + +type ScheduledEventsProfile struct { + // Specifies OS Image Scheduled Event related configurations. + OSImageNotificationProfile *OSImageNotificationProfile + + // Specifies Terminate Scheduled Event related configurations. + TerminateNotificationProfile *TerminateNotificationProfile +} + +// SecurityPostureReference - Specifies the security posture to be used for all virtual machines in the scale set. Minimum +// api-version: 2023-03-01 +type SecurityPostureReference struct { + // List of virtual machine extensions to exclude when applying the Security Posture. + ExcludeExtensions []*VirtualMachineExtension + + // The security posture reference id in the form of /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest + ID *string +} + +// SecurityProfile - Specifies the Security profile settings for the virtual machine or virtual machine scale set. +type SecurityProfile struct { + // This property can be used by user in the request to enable or disable the Host Encryption for the virtual machine or virtual + // machine scale set. This will enable the encryption for all the disks + // including Resource/Temp disk at host itself. The default behavior is: The Encryption at host will be disabled unless this + // property is set to true for the resource. + EncryptionAtHost *bool + + // Specifies the Managed Identity used by ADE to get access token for keyvault operations. + EncryptionIdentity *EncryptionIdentity + + // Specifies ProxyAgent settings while creating the virtual machine. Minimum api-version: 2023-09-01. + ProxyAgentSettings *ProxyAgentSettings + + // Specifies the SecurityType of the virtual machine. It has to be set to any specified value to enable UefiSettings. The + // default behavior is: UefiSettings will not be enabled unless this property is + // set. + SecurityType *SecurityTypes + + // Specifies the security settings like secure boot and vTPM used while creating the virtual machine. Minimum api-version: + // 2020-12-01. + UefiSettings *UefiSettings +} + +// ServiceArtifactReference - Specifies the service artifact reference id used to set same image version for all virtual machines +// in the scale set when using 'latest' image version. Minimum api-version: 2022-11-01 +type ServiceArtifactReference struct { + // The service artifact reference id in the form of + // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactName}/vmArtifactsProfiles/{vmArtifactsProfilesName} + ID *string +} + +// SpotPriorityProfile - Configuration Options for Spot instances in Compute Fleet. +type SpotPriorityProfile struct { + // Allocation strategy to follow when determining the VM sizes distribution for Spot VMs. + AllocationStrategy *SpotAllocationStrategy + + // Total capacity to achieve. It is currently in terms of number of VMs. + Capacity *int32 + + // Eviction Policy to follow when evicting Spot VMs. + EvictionPolicy *EvictionPolicy + + // Flag to enable/disable continuous goal seeking for the desired capacity and restoration of evicted Spot VMs. If maintain + // is enabled, AzureFleetRP will use all VM sizes in vmSizesProfile to create new + // VMs (if VMs are evicted deleted) or update existing VMs with new VM sizes (if VMs are evicted deallocated or failed to + // allocate due to capacity constraint) in order to achieve the desired capacity. + // Maintain is enabled by default. + Maintain *bool + + // Price per hour of each Spot VM will never exceed this. + MaxPricePerVM *float32 + + // Minimum capacity to achieve which cannot be updated. If we will not be able to "guarantee" minimum capacity, we will reject + // the request in the sync path itself. + MinCapacity *int32 +} + +type SubResource struct { + // Resource Id + ID *string +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // The identity that created the resource. + CreatedBy *string + + // The type of identity that created the resource. + CreatedByType *CreatedByType + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time + + // The identity that last modified the resource. + LastModifiedBy *string + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType +} + +type TerminateNotificationProfile struct { + // Specifies whether the Terminate Scheduled event is enabled or disabled. + Enable *bool + + // Configurable length of time a Virtual Machine being deleted will have to potentially approve the Terminate Scheduled Event + // before the event is auto approved (timed out). The configuration must be + // specified in ISO 8601 format, the default value is 5 minutes (PT5M) + NotBeforeTimeout *string +} + +// UefiSettings - Specifies the security settings like secure boot and vTPM used while creating the virtual machine. Minimum +// api-version: 2020-12-01. +type UefiSettings struct { + // Specifies whether secure boot should be enabled on the virtual machine. Minimum api-version: 2020-12-01. + SecureBootEnabled *bool + + // Specifies whether vTPM should be enabled on the virtual machine. Minimum api-version: 2020-12-01. + VTpmEnabled *bool +} + +// UserAssignedIdentity - User assigned identity properties +type UserAssignedIdentity struct { + // READ-ONLY; The client ID of the assigned identity. + ClientID *string + + // READ-ONLY; The principal ID of the assigned identity. + PrincipalID *string +} + +// VMDiskSecurityProfile - Specifies the security profile settings for the managed disk. Note: It can only be set for Confidential +// VMs. +type VMDiskSecurityProfile struct { + // Specifies the customer managed disk encryption set resource id for the managed disk that is used for Customer Managed Key + // encrypted ConfidentialVM OS Disk and VMGuest blob. + DiskEncryptionSet *DiskEncryptionSetParameters + + // Specifies the EncryptionType of the managed disk. It is set to DiskWithVMGuestState for encryption of the managed disk + // along with VMGuestState blob, VMGuestStateOnly for encryption of just the + // VMGuestState blob, and NonPersistedTPM for not persisting firmware state in the VMGuestState blob.. Note: It can be set + // for only Confidential VMs. + SecurityEncryptionType *SecurityEncryptionTypes +} + +// VMGalleryApplication - Specifies the required information to reference a compute gallery application version +type VMGalleryApplication struct { + // REQUIRED; Specifies the GalleryApplicationVersion resource id on the form of + // /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version} + PackageReferenceID *string + + // Optional, Specifies the uri to an azure blob that will replace the default configuration for the package if provided + ConfigurationReference *string + + // If set to true, when a new Gallery Application version is available in PIR/SIG, it will be automatically updated for the + // VM/VMSS + EnableAutomaticUpgrade *bool + + // Optional, Specifies the order in which the packages have to be installed + Order *int32 + + // Optional, Specifies a passthrough value for more generic context. + Tags *string + + // Optional, If true, any failure for any operation in the VmApplication will fail the deployment + TreatFailureAsDeploymentFailure *bool +} + +// VMSizeProfile - Specifications about a VM Size. This will also contain the corresponding rank and weight in future. +type VMSizeProfile struct { + // REQUIRED; The Sku name (e.g. 'StandardDS1v2') + Name *string + + // The rank of the VM size. This is used with 'RegularPriorityAllocationStrategy.Prioritized' The lower the number, the higher + // the priority. Starting with 0. + Rank *int32 +} + +// VMSizeProperties - Specifies VM Size Property settings on the virtual machine. +type VMSizeProperties struct { + // Specifies the number of vCPUs available for the VM. When this property is not specified in the request body the default + // behavior is to set it to the value of vCPUs available for that VM size exposed + // in api response of List all available virtual machine sizes in a region [https://docs.microsoft.com/en-us/rest/api/compute/resource-skus/list]. + VCPUsAvailable *int32 + + // Specifies the vCPU to physical core ratio. When this property is not specified in the request body the default behavior + // is set to the value of vCPUsPerCore for the VM Size exposed in api response of + // List all available virtual machine sizes in a region [https://docs.microsoft.com/en-us/rest/api/compute/resource-skus/list]. + // Setting this property to 1 also means that hyper-threading is disabled. + VCPUsPerCore *int32 +} + +// VaultCertificate - Describes a single certificate reference in a Key Vault, and where the certificate should reside on +// the VM. +type VaultCertificate struct { + // For Windows VMs, specifies the certificate store on the Virtual Machine to which the certificate should be added. The specified + // certificate store is implicitly in the LocalMachine account. For Linux + // VMs, the certificate file is placed under the /var/lib/waagent directory, with the file name .crt + // for the X509 certificate file and .prv for private key. Both + // of these files are .pem formatted. + CertificateStore *string + + // This is the URL of a certificate that has been uploaded to Key Vault as a secret. For adding a secret to the Key Vault, + // see Add a key or secret to the key vault + // [https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add]. In this case, your certificate needs to be It + // is the Base64 encoding of the following JSON Object which is encoded in UTF-8: + // { + // "data":"", + // "dataType":"pfx", + // "password":"" + // } + // To install certificates on a virtual machine it is recommended to use the Azure Key Vault virtual machine extension for + // Linux + // [https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux] or the Azure Key Vault virtual machine extension + // for Windows + // [https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows]. + CertificateURL *string +} + +// VaultSecretGroup - Describes a set of certificates which are all in the same Key Vault. +type VaultSecretGroup struct { + // The relative URL of the Key Vault containing all of the certificates in VaultCertificates. + SourceVault *SubResource + + // The list of key vault references in SourceVault which contain certificates. + VaultCertificates []*VaultCertificate +} + +// VirtualHardDisk - Describes the uri of a disk. +type VirtualHardDisk struct { + // Specifies the virtual hard disk's uri. + URI *string +} + +// VirtualMachineExtension - Describes a Virtual Machine Extension. +type VirtualMachineExtension struct { + // Resource location + Location *string + + // Describes the properties of a Virtual Machine Extension. + Properties *VirtualMachineExtensionProperties + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// VirtualMachineExtensionInstanceView - The instance view of a virtual machine extension. +type VirtualMachineExtensionInstanceView struct { + // The virtual machine extension name. + Name *string + + // The resource status information. + Statuses []*InstanceViewStatus + + // The resource status information. + Substatuses []*InstanceViewStatus + + // Specifies the type of the extension; an example is "CustomScriptExtension". + Type *string + + // Specifies the version of the script handler. + TypeHandlerVersion *string +} + +// VirtualMachineExtensionProperties - Describes the properties of a Virtual Machine Extension. +type VirtualMachineExtensionProperties struct { + // Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, + // however, the extension will not upgrade minor versions unless redeployed, even + // with this property set to true. + AutoUpgradeMinorVersion *bool + + // Indicates whether the extension should be automatically upgraded by the platform if there is a newer version of the extension + // available. + EnableAutomaticUpgrade *bool + + // How the extension handler should be forced to update even if the extension configuration has not changed. + ForceUpdateTag *string + + // The virtual machine extension instance view. + InstanceView *VirtualMachineExtensionInstanceView + + // The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + ProtectedSettings any + + // The extensions protected settings that are passed by reference, and consumed from key vault + ProtectedSettingsFromKeyVault *KeyVaultSecretReference + + // Collection of extension names after which this extension needs to be provisioned. + ProvisionAfterExtensions []*string + + // The name of the extension handler publisher. + Publisher *string + + // Json formatted public settings for the extension. + Settings any + + // Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not connecting + // to the VM will not be suppressed regardless of this value). The default is false. + SuppressFailures *bool + + // Specifies the type of the extension; an example is "CustomScriptExtension". + Type *string + + // Specifies the version of the script handler. + TypeHandlerVersion *string + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string +} + +// VirtualMachineScaleSet - An AzureFleet's virtualMachineScaleSet +type VirtualMachineScaleSet struct { + // READ-ONLY; The compute RP resource id of the virtualMachineScaleSet "subscriptions/{subId}/resourceGroups/{rgName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}" + ID *string + + // READ-ONLY; The name of the virtualMachineScaleSet + Name *string + + // READ-ONLY; This represents the operationStatus of the VMSS in response to the last operation that was performed on it by + // Azure Fleet resource. + OperationStatus *ProvisioningState + + // READ-ONLY; Error Information when operationStatus is Failed + Error *APIError + + // READ-ONLY; Type of the virtualMachineScaleSet + Type *string +} + +// VirtualMachineScaleSetDataDisk - Describes a virtual machine scale set data disk. +type VirtualMachineScaleSetDataDisk struct { + // REQUIRED; The create option. + CreateOption *DiskCreateOptionTypes + + // REQUIRED; Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and + // therefore must be unique for each data disk attached to a VM. + Lun *int32 + + // Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The default values are: None for Standard + // storage. ReadOnly for Premium storage. + Caching *CachingTypes + + // Specifies whether data disk should be deleted or detached upon VMSS Flex deletion (This feature is available for VMSS with + // Flexible OrchestrationMode only). + // Possible values: + // Delete If this value is used, the data disk is deleted when the VMSS Flex VM is deleted. + // Detach If this value is used, the data disk is retained after VMSS Flex VM is deleted. + // The default value is set to Delete. + DeleteOption *DiskDeleteOptionTypes + + // Specifies the Read-Write IOPS for the managed disk. Should be used only when StorageAccountType is UltraSSD_LRS. If not + // specified, a default value would be assigned based on diskSizeGB. + DiskIOPSReadWrite *int64 + + // Specifies the bandwidth in MB per second for the managed disk. Should be used only when StorageAccountType is UltraSSD_LRS. + // If not specified, a default value would be assigned based on diskSizeGB. + DiskMBpsReadWrite *int64 + + // Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a + // virtual machine image. The property diskSizeGB is the number of bytes x 1024^3 + // for the disk and the value cannot be larger than 1023. + DiskSizeGB *int32 + + // The managed disk parameters. + ManagedDisk *VirtualMachineScaleSetManagedDiskParameters + + // The disk name. + Name *string + + // Specifies whether writeAccelerator should be enabled or disabled on the disk. + WriteAcceleratorEnabled *bool +} + +// VirtualMachineScaleSetExtension - Describes a Virtual Machine Scale Set Extension. +type VirtualMachineScaleSetExtension struct { + // The name of the extension. + Name *string + + // Describes the properties of a Virtual Machine Scale Set Extension. + Properties *VirtualMachineScaleSetExtensionProperties + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource type + Type *string +} + +// VirtualMachineScaleSetExtensionProfile - Describes a virtual machine scale set extension profile. +type VirtualMachineScaleSetExtensionProfile struct { + // The virtual machine scale set child extension resources. + Extensions []*VirtualMachineScaleSetExtension + + // Specifies the time alloted for all extensions to start. The time duration should be between 15 minutes and 120 minutes + // (inclusive) and should be specified in ISO 8601 format. The default value is 90 + // minutes (PT1H30M). Minimum api-version: 2020-06-01. + ExtensionsTimeBudget *string +} + +// VirtualMachineScaleSetExtensionProperties - Describes the properties of a Virtual Machine Scale Set Extension. +type VirtualMachineScaleSetExtensionProperties struct { + // Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, + // however, the extension will not upgrade minor versions unless redeployed, even + // with this property set to true. + AutoUpgradeMinorVersion *bool + + // Indicates whether the extension should be automatically upgraded by the platform if there is a newer version of the extension + // available. + EnableAutomaticUpgrade *bool + + // If a value is provided and is different from the previous value, the extension handler will be forced to update even if + // the extension configuration has not changed. + ForceUpdateTag *string + + // The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + ProtectedSettings any + + // The extensions protected settings that are passed by reference, and consumed from key vault + ProtectedSettingsFromKeyVault *KeyVaultSecretReference + + // Collection of extension names after which this extension needs to be provisioned. + ProvisionAfterExtensions []*string + + // The name of the extension handler publisher. + Publisher *string + + // Json formatted public settings for the extension. + Settings any + + // Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not connecting + // to the VM will not be suppressed regardless of this value). The default is false. + SuppressFailures *bool + + // Specifies the type of the extension; an example is "CustomScriptExtension". + Type *string + + // Specifies the version of the script handler. + TypeHandlerVersion *string + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string +} + +// VirtualMachineScaleSetHardwareProfile - Specifies the hardware settings for the virtual machine scale set. +type VirtualMachineScaleSetHardwareProfile struct { + // Specifies the properties for customizing the size of the virtual machine. Minimum api-version: 2021-11-01. Please follow + // the instructions in VM Customization [https://aka.ms/vmcustomization] for more + // details. + VMSizeProperties *VMSizeProperties +} + +// VirtualMachineScaleSetIPConfiguration - Describes a virtual machine scale set network profile's IP configuration. +type VirtualMachineScaleSetIPConfiguration struct { + // REQUIRED; The IP configuration name. + Name *string + + // Describes a virtual machine scale set network profile's IP configuration properties. + Properties *VirtualMachineScaleSetIPConfigurationProperties +} + +// VirtualMachineScaleSetIPConfigurationProperties - Describes a virtual machine scale set network profile's IP configuration +// properties. +type VirtualMachineScaleSetIPConfigurationProperties struct { + // Specifies an array of references to backend address pools of application gateways. A scale set can reference backend address + // pools of multiple application gateways. Multiple scale sets cannot use the + // same application gateway. + ApplicationGatewayBackendAddressPools []*SubResource + + // Specifies an array of references to application security group. + ApplicationSecurityGroups []*SubResource + + // Specifies an array of references to backend address pools of load balancers. A scale set can reference backend address + // pools of one public and one internal load balancer. Multiple scale sets cannot + // use the same basic sku load balancer. + LoadBalancerBackendAddressPools []*SubResource + + // Specifies an array of references to inbound Nat pools of the load balancers. A scale set can reference inbound nat pools + // of one public and one internal load balancer. Multiple scale sets cannot use + // the same basic sku load balancer. + LoadBalancerInboundNatPools []*SubResource + + // Specifies the primary network interface in case the virtual machine has more than 1 network interface. + Primary *bool + + // Available from Api-Version 2017-03-30 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default + // is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + PrivateIPAddressVersion *IPVersion + + // The publicIPAddressConfiguration. + PublicIPAddressConfiguration *VirtualMachineScaleSetPublicIPAddressConfiguration + + // Specifies the identifier of the subnet. + Subnet *APIEntityReference +} + +// VirtualMachineScaleSetIPTag - Contains the IP tag associated with the public IP address. +type VirtualMachineScaleSetIPTag struct { + // IP tag type. Example: FirstPartyUsage. + IPTagType *string + + // IP tag associated with the public IP. Example: SQL, Storage etc. + Tag *string +} + +// VirtualMachineScaleSetListResult - The response of a VirtualMachineScaleSet list operation. +type VirtualMachineScaleSetListResult struct { + // REQUIRED; The VirtualMachineScaleSet items on this page + Value []*VirtualMachineScaleSet + + // The link to the next page of items + NextLink *string +} + +// VirtualMachineScaleSetManagedDiskParameters - Describes the parameters of a ScaleSet managed disk. +type VirtualMachineScaleSetManagedDiskParameters struct { + // Specifies the customer managed disk encryption set resource id for the managed disk. + DiskEncryptionSet *DiskEncryptionSetParameters + + // Specifies the security profile for the managed disk. + SecurityProfile *VMDiskSecurityProfile + + // Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot + // be used with OS Disk. + StorageAccountType *StorageAccountTypes +} + +// VirtualMachineScaleSetNetworkConfiguration - Describes a virtual machine scale set network profile's network configurations. +type VirtualMachineScaleSetNetworkConfiguration struct { + // REQUIRED; The network configuration name. + Name *string + + // Describes a virtual machine scale set network profile's IP configuration. + Properties *VirtualMachineScaleSetNetworkConfigurationProperties +} + +// VirtualMachineScaleSetNetworkConfigurationDNSSettings - Describes a virtual machines scale sets network configuration's +// DNS settings. +type VirtualMachineScaleSetNetworkConfigurationDNSSettings struct { + // List of DNS servers IP addresses + DNSServers []*string +} + +// VirtualMachineScaleSetNetworkConfigurationProperties - Describes a virtual machine scale set network profile's IP configuration. +type VirtualMachineScaleSetNetworkConfigurationProperties struct { + // REQUIRED; Specifies the IP configurations of the network interface. + IPConfigurations []*VirtualMachineScaleSetIPConfiguration + + // Specifies whether the Auxiliary mode is enabled for the Network Interface resource. + AuxiliaryMode *NetworkInterfaceAuxiliaryMode + + // Specifies whether the Auxiliary sku is enabled for the Network Interface resource. + AuxiliarySKU *NetworkInterfaceAuxiliarySKU + + // The dns settings to be applied on the network interfaces. + DNSSettings *VirtualMachineScaleSetNetworkConfigurationDNSSettings + + // Specify what happens to the network interface when the VM is deleted + DeleteOption *DeleteOptions + + // Specifies whether the network interface is disabled for tcp state tracking. + DisableTCPStateTracking *bool + + // Specifies whether the network interface is accelerated networking-enabled. + EnableAcceleratedNetworking *bool + + // Specifies whether the network interface is FPGA networking-enabled. + EnableFpga *bool + + // Whether IP forwarding enabled on this NIC. + EnableIPForwarding *bool + + // The network security group. + NetworkSecurityGroup *SubResource + + // Specifies the primary network interface in case the virtual machine has more than 1 network interface. + Primary *bool +} + +// VirtualMachineScaleSetNetworkProfile - Describes a virtual machine scale set network profile. +type VirtualMachineScaleSetNetworkProfile struct { + // A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The + // reference will be in the form: + // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. + HealthProbe *APIEntityReference + + // specifies the Microsoft.Network API version used when creating networking resources in the Network Interface Configurations + // for Virtual Machine Scale Set with orchestration mode 'Flexible' + NetworkAPIVersion *NetworkAPIVersion + + // The list of network configurations. + NetworkInterfaceConfigurations []*VirtualMachineScaleSetNetworkConfiguration +} + +// VirtualMachineScaleSetOSDisk - Describes a virtual machine scale set operating system disk. +type VirtualMachineScaleSetOSDisk struct { + // REQUIRED; Specifies how the virtual machines in the scale set should be created. The only allowed value is: FromImage. + // This value is used when you are using an image to create the virtual machine. If you are + // using a platform image, you also use the imageReference element described above. If you are using a marketplace image, + // you also use the plan element previously described. + CreateOption *DiskCreateOptionTypes + + // Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The default values are: None for Standard + // storage. ReadOnly for Premium storage. + Caching *CachingTypes + + // Specifies whether OS Disk should be deleted or detached upon VMSS Flex deletion (This feature is available for VMSS with + // Flexible OrchestrationMode only). + // Possible values: + // Delete If this value is used, the OS disk is deleted when VMSS Flex VM is deleted. + // Detach If this value is used, the OS disk is retained after VMSS Flex VM is deleted. + // The default value is set to Delete. For an Ephemeral OS Disk, the default value is set to Delete. User cannot change the + // delete option for Ephemeral OS Disk. + DeleteOption *DiskDeleteOptionTypes + + // Specifies the ephemeral disk Settings for the operating system disk used by the virtual machine scale set. + DiffDiskSettings *DiffDiskSettings + + // Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a + // virtual machine image. The property 'diskSizeGB' is the number of bytes x 1024^3 + // for the disk and the value cannot be larger than 1023. + DiskSizeGB *int32 + + // Specifies information about the unmanaged user image to base the scale set on. + Image *VirtualHardDisk + + // The managed disk parameters. + ManagedDisk *VirtualMachineScaleSetManagedDiskParameters + + // The disk name. + Name *string + + // This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or + // a specialized VHD. Possible values are: Windows, Linux. + OSType *OperatingSystemTypes + + // Specifies the container urls that are used to store operating system disks for the scale set. + VhdContainers []*string + + // Specifies whether writeAccelerator should be enabled or disabled on the disk. + WriteAcceleratorEnabled *bool +} + +// VirtualMachineScaleSetOSProfile - Describes a virtual machine scale set OS profile. +type VirtualMachineScaleSetOSProfile struct { + // Specifies the password of the administrator account. + // Minimum-length (Windows): 8 characters + // Minimum-length (Linux): 6 characters + // Max-length (Windows): 123 characters + // Max-length (Linux): 72 characters + // Complexity requirements: 3 out of 4 conditions below need to be fulfilled + // Has lower characters + // Has upper characters + // Has a digit + // Has a special character (Regex match [\W_]) + // Disallowed values: "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", + // "Password22", "iloveyou!" + // For resetting the password, see How to reset the Remote Desktop service or its login password in a Windows VM [https://docs.microsoft.com/troubleshoot/azure/virtual-machines/reset-rdp] + // For resetting root password, see Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension + // [https://docs.microsoft.com/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection] + AdminPassword *string + + // Specifies the name of the administrator account. + // Windows-only restriction: Cannot end in "." + // Disallowed values: "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", + // "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + // "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". + // Minimum-length (Linux): 1 character + // Max-length (Linux): 64 characters + // Max-length (Windows): 20 characters + AdminUsername *string + + // Specifies whether extension operations should be allowed on the virtual machine scale set. This may only be set to False + // when no extensions are present on the virtual machine scale set. + AllowExtensionOperations *bool + + // Specifies the computer name prefix for all of the virtual machines in the scale set. Computer name prefixes must be 1 to + // 15 characters long. + ComputerNamePrefix *string + + // Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved + // as a file on the Virtual Machine. The maximum length of the binary array is + // 65535 bytes. For using cloud-init for your VM, see Using cloud-init to customize a Linux VM during creation [https://docs.microsoft.com/azure/virtual-machines/linux/using-cloud-init] + CustomData *string + + // Specifies the Linux operating system settings on the virtual machine. For a list of supported Linux distributions, see + // Linux on Azure-Endorsed Distributions + // [https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros]. + LinuxConfiguration *LinuxConfiguration + + // Optional property which must either be set to True or omitted. + RequireGuestProvisionSignal *bool + + // Specifies set of certificates that should be installed onto the virtual machines in the scale set. To install certificates + // on a virtual machine it is recommended to use the Azure Key Vault virtual + // machine extension for Linux [https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux] or the Azure + // Key Vault virtual machine extension for Windows + // [https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows]. + Secrets []*VaultSecretGroup + + // Specifies Windows operating system settings on the virtual machine. + WindowsConfiguration *WindowsConfiguration +} + +// VirtualMachineScaleSetPublicIPAddressConfiguration - Describes a virtual machines scale set IP Configuration's PublicIPAddress +// configuration +type VirtualMachineScaleSetPublicIPAddressConfiguration struct { + // REQUIRED; The publicIP address configuration name. + Name *string + + // Describes a virtual machines scale set IP Configuration's PublicIPAddress configuration + Properties *VirtualMachineScaleSetPublicIPAddressConfigurationProperties + + // Describes the public IP Sku. It can only be set with OrchestrationMode as Flexible. + SKU *PublicIPAddressSKU +} + +// VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings - Describes a virtual machines scale sets network configuration's +// DNS settings. +type VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings struct { + // REQUIRED; The Domain name label.The concatenation of the domain name label and vm index will be the domain name labels + // of the PublicIPAddress resources that will be created + DomainNameLabel *string + + // The Domain name label scope.The concatenation of the hashed domain name label that generated according to the policy from + // domain name label scope and vm index will be the domain name labels of the + // PublicIPAddress resources that will be created + DomainNameLabelScope *DomainNameLabelScopeTypes +} + +// VirtualMachineScaleSetPublicIPAddressConfigurationProperties - Describes a virtual machines scale set IP Configuration's +// PublicIPAddress configuration +type VirtualMachineScaleSetPublicIPAddressConfigurationProperties struct { + // The dns settings to be applied on the publicIP addresses . + DNSSettings *VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings + + // Specify what happens to the public IP when the VM is deleted + DeleteOption *DeleteOptions + + // The list of IP tags associated with the public IP address. + IPTags []*VirtualMachineScaleSetIPTag + + // The idle timeout of the public IP address. + IdleTimeoutInMinutes *int32 + + // Available from Api-Version 2019-07-01 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default + // is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + PublicIPAddressVersion *IPVersion + + // The PublicIPPrefix from which to allocate publicIP addresses. + PublicIPPrefix *SubResource +} + +// VirtualMachineScaleSetStorageProfile - Describes a virtual machine scale set storage profile. +type VirtualMachineScaleSetStorageProfile struct { + // Specifies the parameters that are used to add data disks to the virtual machines in the scale set. For more information + // about disks, see About disks and VHDs for Azure virtual machines + // [https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview]. + DataDisks []*VirtualMachineScaleSetDataDisk + DiskControllerType *string + + // Specifies information about the image to use. You can specify information about platform images, marketplace images, or + // virtual machine images. This element is required when you want to use a platform + // image, marketplace image, or virtual machine image, but is not used in other creation operations. + ImageReference *ImageReference + + // Specifies information about the operating system disk used by the virtual machines in the scale set. For more information + // about disks, see About disks and VHDs for Azure virtual machines + // [https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview]. + OSDisk *VirtualMachineScaleSetOSDisk +} + +// VirtualMachineScaleSetVMProfile - Describes a virtual machine scale set virtual machine profile. +type VirtualMachineScaleSetVMProfile struct { + // Specifies the gallery applications that should be made available to the VM/VMSS + ApplicationProfile *ApplicationProfile + + // Specifies the billing related details of a Azure Spot VMSS. Minimum api-version: 2019-03-01. + BillingProfile *BillingProfile + + // Specifies the capacity reservation related details of a scale set. Minimum api-version: 2021-04-01. + CapacityReservation *CapacityReservationProfile + + // Specifies the boot diagnostic settings state. Minimum api-version: 2015-06-15. + DiagnosticsProfile *DiagnosticsProfile + + // Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot scale set. For Azure Spot virtual machines, + // both 'Deallocate' and 'Delete' are supported and the minimum api-version is + // 2019-03-01. For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2017-10-30-preview. + EvictionPolicy *VirtualMachineEvictionPolicyTypes + + // Specifies a collection of settings for extensions installed on virtual machines in the scale set. + ExtensionProfile *VirtualMachineScaleSetExtensionProfile + + // Specifies the hardware profile related details of a scale set. Minimum api-version: 2021-11-01. + HardwareProfile *VirtualMachineScaleSetHardwareProfile + + // Specifies that the image or disk that is being used was licensed on-premises. + // Possible values for Windows Server operating system are: + // WindowsClient + // WindowsServer + // Possible values for Linux Server operating system are: + // RHELBYOS (for RHEL) + // SLESBYOS (for SUSE) + // For more information, see Azure Hybrid Use Benefit for Windows Server [https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing] + // Azure Hybrid Use Benefit for Linux Server [https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux] + // Minimum api-version: 2015-06-15 + LicenseType *string + + // Specifies properties of the network interfaces of the virtual machines in the scale set. + NetworkProfile *VirtualMachineScaleSetNetworkProfile + + // Specifies the operating system settings for the virtual machines in the scale set. + OSProfile *VirtualMachineScaleSetOSProfile + + // Specifies the priority for the virtual machines in the scale set. Minimum api-version: 2017-10-30-preview. + Priority *VirtualMachinePriorityTypes + + // Specifies Scheduled Event related configurations. + ScheduledEventsProfile *ScheduledEventsProfile + + // Specifies the security posture to be used for all virtual machines in the scale set. Minimum api-version: 2023-03-01 + SecurityPostureReference *SecurityPostureReference + + // Specifies the Security related profile settings for the virtual machines in the scale set. + SecurityProfile *SecurityProfile + + // Specifies the service artifact reference id used to set same image version for all virtual machines in the scale set when + // using 'latest' image version. Minimum api-version: 2022-11-01 + ServiceArtifactReference *ServiceArtifactReference + + // Specifies the storage settings for the virtual machine disks. + StorageProfile *VirtualMachineScaleSetStorageProfile + + // UserData for the virtual machines in the scale set, which must be base-64 encoded. Customer should not pass any secrets + // in here. Minimum api-version: 2021-03-01. + UserData *string + + // READ-ONLY; Specifies the time in which this VM profile for the Virtual Machine Scale Set was created. Minimum API version + // for this property is 2023-09-01. This value will be added to VMSS Flex VM tags when + // creating/updating the VMSS VM Profile with minimum api-version 2023-09-01. + TimeCreated *time.Time +} + +// WinRMConfiguration - Describes Windows Remote Management configuration of the VM +type WinRMConfiguration struct { + // The list of Windows Remote Management listeners + Listeners []*WinRMListener +} + +// WinRMListener - Describes Protocol and thumbprint of Windows Remote Management listener +type WinRMListener struct { + // This is the URL of a certificate that has been uploaded to Key Vault as a secret. For adding a secret to the Key Vault, + // see Add a key or secret to the key vault + // [https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add]. In this case, your certificate needs to be the + // Base64 encoding of the following JSON Object which is encoded in UTF-8: + // { + // "data":"", + // "dataType":"pfx", + // "password":"" + // } + // To install certificates on a virtual machine it is recommended to use the Azure Key Vault virtual machine extension for + // Linux + // [https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux] or the Azure Key Vault virtual machine extension + // for Windows + // [https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows]. + CertificateURL *string + + // Specifies the protocol of WinRM listener. Possible values are: http, https. + Protocol *ProtocolTypes +} + +// WindowsConfiguration - Specifies Windows operating system settings on the virtual machine. +type WindowsConfiguration struct { + // Specifies additional base-64 encoded XML formatted information that can be included in the Unattend.xml file, which is + // used by Windows Setup. + AdditionalUnattendContent []*AdditionalUnattendContent + + // Indicates whether Automatic Updates is enabled for the Windows virtual machine. Default value is true. For virtual machine + // scale sets, this property can be updated and updates will take effect on OS + // reprovisioning. + EnableAutomaticUpdates *bool + + // Indicates whether VMAgent Platform Updates is enabled for the Windows virtual machine. Default value is false. + EnableVMAgentPlatformUpdates *bool + + // [Preview Feature] Specifies settings related to VM Guest Patching on Windows. + PatchSettings *PatchSettings + + // Indicates whether virtual machine agent should be provisioned on the virtual machine. When this property is not specified + // in the request body, it is set to true by default. This will ensure that VM + // Agent is installed on the VM so that extensions can be added to the VM later. + ProvisionVMAgent *bool + + // Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". Possible values can be TimeZoneInfo.Id + // [https://docs.microsoft.com/dotnet/api/system.timezoneinfo.id?#System_TimeZoneInfo_Id] value from time zones returned by + // TimeZoneInfo.GetSystemTimeZones + // [https://docs.microsoft.com/dotnet/api/system.timezoneinfo.getsystemtimezones]. + TimeZone *string + + // Specifies the Windows Remote Management listeners. This enables remote Windows PowerShell. + WinRM *WinRMConfiguration +} + +// WindowsVMGuestPatchAutomaticByPlatformSettings - Specifies additional settings to be applied when patch mode AutomaticByPlatform +// is selected in Windows patch settings. +type WindowsVMGuestPatchAutomaticByPlatformSettings struct { + // Enables customer to schedule patching without accidental upgrades + BypassPlatformSafetyChecksOnUserSchedule *bool + + // Specifies the reboot setting for all AutomaticByPlatform patch installation operations. + RebootSetting *WindowsVMGuestPatchAutomaticByPlatformRebootSetting +} diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/models_serde.go b/sdk/resourcemanager/computefleet/armcomputefleet/models_serde.go new file mode 100644 index 000000000000..b38b211460d2 --- /dev/null +++ b/sdk/resourcemanager/computefleet/armcomputefleet/models_serde.go @@ -0,0 +1,3336 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcomputefleet + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type APIEntityReference. +func (a APIEntityReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type APIEntityReference. +func (a *APIEntityReference) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type APIError. +func (a APIError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", a.Code) + populate(objectMap, "details", a.Details) + populate(objectMap, "innererror", a.Innererror) + populate(objectMap, "message", a.Message) + populate(objectMap, "target", a.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type APIError. +func (a *APIError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &a.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &a.Details) + delete(rawMsg, key) + case "innererror": + err = unpopulate(val, "Innererror", &a.Innererror) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &a.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &a.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type APIErrorBase. +func (a APIErrorBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", a.Code) + populate(objectMap, "message", a.Message) + populate(objectMap, "target", a.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type APIErrorBase. +func (a *APIErrorBase) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &a.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &a.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &a.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AdditionalUnattendContent. +func (a AdditionalUnattendContent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["componentName"] = "Microsoft-Windows-Shell-Setup" + populate(objectMap, "content", a.Content) + objectMap["passName"] = "OobeSystem" + populate(objectMap, "settingName", a.SettingName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdditionalUnattendContent. +func (a *AdditionalUnattendContent) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "componentName": + err = unpopulate(val, "ComponentName", &a.ComponentName) + delete(rawMsg, key) + case "content": + err = unpopulate(val, "Content", &a.Content) + delete(rawMsg, key) + case "passName": + err = unpopulate(val, "PassName", &a.PassName) + delete(rawMsg, key) + case "settingName": + err = unpopulate(val, "SettingName", &a.SettingName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationProfile. +func (a ApplicationProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "galleryApplications", a.GalleryApplications) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationProfile. +func (a *ApplicationProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "galleryApplications": + err = unpopulate(val, "GalleryApplications", &a.GalleryApplications) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BillingProfile. +func (b BillingProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "maxPrice", b.MaxPrice) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BillingProfile. +func (b *BillingProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "maxPrice": + err = unpopulate(val, "MaxPrice", &b.MaxPrice) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BootDiagnostics. +func (b BootDiagnostics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", b.Enabled) + populate(objectMap, "storageUri", b.StorageURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BootDiagnostics. +func (b *BootDiagnostics) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &b.Enabled) + delete(rawMsg, key) + case "storageUri": + err = unpopulate(val, "StorageURI", &b.StorageURI) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CapacityReservationProfile. +func (c CapacityReservationProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capacityReservationGroup", c.CapacityReservationGroup) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CapacityReservationProfile. +func (c *CapacityReservationProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capacityReservationGroup": + err = unpopulate(val, "CapacityReservationGroup", &c.CapacityReservationGroup) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ComputeProfile. +func (c ComputeProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "baseVirtualMachineProfile", c.BaseVirtualMachineProfile) + populate(objectMap, "computeApiVersion", c.ComputeAPIVersion) + populate(objectMap, "platformFaultDomainCount", c.PlatformFaultDomainCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ComputeProfile. +func (c *ComputeProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "baseVirtualMachineProfile": + err = unpopulate(val, "BaseVirtualMachineProfile", &c.BaseVirtualMachineProfile) + delete(rawMsg, key) + case "computeApiVersion": + err = unpopulate(val, "ComputeAPIVersion", &c.ComputeAPIVersion) + delete(rawMsg, key) + case "platformFaultDomainCount": + err = unpopulate(val, "PlatformFaultDomainCount", &c.PlatformFaultDomainCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ComputeProfileUpdate. +func (c ComputeProfileUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "baseVirtualMachineProfile", c.BaseVirtualMachineProfile) + populate(objectMap, "computeApiVersion", c.ComputeAPIVersion) + populate(objectMap, "platformFaultDomainCount", c.PlatformFaultDomainCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ComputeProfileUpdate. +func (c *ComputeProfileUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "baseVirtualMachineProfile": + err = unpopulate(val, "BaseVirtualMachineProfile", &c.BaseVirtualMachineProfile) + delete(rawMsg, key) + case "computeApiVersion": + err = unpopulate(val, "ComputeAPIVersion", &c.ComputeAPIVersion) + delete(rawMsg, key) + case "platformFaultDomainCount": + err = unpopulate(val, "PlatformFaultDomainCount", &c.PlatformFaultDomainCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiagnosticsProfile. +func (d DiagnosticsProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "bootDiagnostics", d.BootDiagnostics) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticsProfile. +func (d *DiagnosticsProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "bootDiagnostics": + err = unpopulate(val, "BootDiagnostics", &d.BootDiagnostics) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiffDiskSettings. +func (d DiffDiskSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "option", d.Option) + populate(objectMap, "placement", d.Placement) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiffDiskSettings. +func (d *DiffDiskSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "option": + err = unpopulate(val, "Option", &d.Option) + delete(rawMsg, key) + case "placement": + err = unpopulate(val, "Placement", &d.Placement) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiskEncryptionSetParameters. +func (d DiskEncryptionSetParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskEncryptionSetParameters. +func (d *DiskEncryptionSetParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EncryptionIdentity. +func (e EncryptionIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "userAssignedIdentityResourceId", e.UserAssignedIdentityResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionIdentity. +func (e *EncryptionIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "userAssignedIdentityResourceId": + err = unpopulate(val, "UserAssignedIdentityResourceID", &e.UserAssignedIdentityResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Fleet. +func (f Fleet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", f.ID) + populate(objectMap, "identity", f.Identity) + populate(objectMap, "location", f.Location) + populate(objectMap, "name", f.Name) + populate(objectMap, "plan", f.Plan) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "tags", f.Tags) + populate(objectMap, "type", f.Type) + populate(objectMap, "zones", f.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Fleet. +func (f *Fleet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &f.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &f.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "plan": + err = unpopulate(val, "Plan", &f.Plan) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &f.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &f.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FleetListResult. +func (f FleetListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetListResult. +func (f *FleetListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FleetProperties. +func (f FleetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "computeProfile", f.ComputeProfile) + populate(objectMap, "provisioningState", f.ProvisioningState) + populate(objectMap, "regularPriorityProfile", f.RegularPriorityProfile) + populate(objectMap, "spotPriorityProfile", f.SpotPriorityProfile) + populate(objectMap, "vmSizesProfile", f.VMSizesProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetProperties. +func (f *FleetProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "computeProfile": + err = unpopulate(val, "ComputeProfile", &f.ComputeProfile) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) + delete(rawMsg, key) + case "regularPriorityProfile": + err = unpopulate(val, "RegularPriorityProfile", &f.RegularPriorityProfile) + delete(rawMsg, key) + case "spotPriorityProfile": + err = unpopulate(val, "SpotPriorityProfile", &f.SpotPriorityProfile) + delete(rawMsg, key) + case "vmSizesProfile": + err = unpopulate(val, "VMSizesProfile", &f.VMSizesProfile) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FleetPropertiesUpdate. +func (f FleetPropertiesUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "computeProfile", f.ComputeProfile) + populate(objectMap, "regularPriorityProfile", f.RegularPriorityProfile) + populate(objectMap, "spotPriorityProfile", f.SpotPriorityProfile) + populate(objectMap, "vmSizesProfile", f.VMSizesProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetPropertiesUpdate. +func (f *FleetPropertiesUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "computeProfile": + err = unpopulate(val, "ComputeProfile", &f.ComputeProfile) + delete(rawMsg, key) + case "regularPriorityProfile": + err = unpopulate(val, "RegularPriorityProfile", &f.RegularPriorityProfile) + delete(rawMsg, key) + case "spotPriorityProfile": + err = unpopulate(val, "SpotPriorityProfile", &f.SpotPriorityProfile) + delete(rawMsg, key) + case "vmSizesProfile": + err = unpopulate(val, "VMSizesProfile", &f.VMSizesProfile) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FleetUpdate. +func (f FleetUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", f.Identity) + populate(objectMap, "plan", f.Plan) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "tags", f.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetUpdate. +func (f *FleetUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identity": + err = unpopulate(val, "Identity", &f.Identity) + delete(rawMsg, key) + case "plan": + err = unpopulate(val, "Plan", &f.Plan) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &f.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImageReference. +func (i ImageReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "communityGalleryImageId", i.CommunityGalleryImageID) + populate(objectMap, "exactVersion", i.ExactVersion) + populate(objectMap, "id", i.ID) + populate(objectMap, "offer", i.Offer) + populate(objectMap, "publisher", i.Publisher) + populate(objectMap, "sku", i.SKU) + populate(objectMap, "sharedGalleryImageId", i.SharedGalleryImageID) + populate(objectMap, "version", i.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageReference. +func (i *ImageReference) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "communityGalleryImageId": + err = unpopulate(val, "CommunityGalleryImageID", &i.CommunityGalleryImageID) + delete(rawMsg, key) + case "exactVersion": + err = unpopulate(val, "ExactVersion", &i.ExactVersion) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "offer": + err = unpopulate(val, "Offer", &i.Offer) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &i.Publisher) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &i.SKU) + delete(rawMsg, key) + case "sharedGalleryImageId": + err = unpopulate(val, "SharedGalleryImageID", &i.SharedGalleryImageID) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &i.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InnerError. +func (i InnerError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "errordetail", i.Errordetail) + populate(objectMap, "exceptiontype", i.Exceptiontype) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InnerError. +func (i *InnerError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "errordetail": + err = unpopulate(val, "Errordetail", &i.Errordetail) + delete(rawMsg, key) + case "exceptiontype": + err = unpopulate(val, "Exceptiontype", &i.Exceptiontype) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InstanceViewStatus. +func (i InstanceViewStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", i.Code) + populate(objectMap, "displayStatus", i.DisplayStatus) + populate(objectMap, "level", i.Level) + populate(objectMap, "message", i.Message) + populateDateTimeRFC3339(objectMap, "time", i.Time) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InstanceViewStatus. +func (i *InstanceViewStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &i.Code) + delete(rawMsg, key) + case "displayStatus": + err = unpopulate(val, "DisplayStatus", &i.DisplayStatus) + delete(rawMsg, key) + case "level": + err = unpopulate(val, "Level", &i.Level) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &i.Message) + delete(rawMsg, key) + case "time": + err = unpopulateDateTimeRFC3339(val, "Time", &i.Time) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KeyVaultSecretReference. +func (k KeyVaultSecretReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "secretUrl", k.SecretURL) + populate(objectMap, "sourceVault", k.SourceVault) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultSecretReference. +func (k *KeyVaultSecretReference) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "secretUrl": + err = unpopulate(val, "SecretURL", &k.SecretURL) + delete(rawMsg, key) + case "sourceVault": + err = unpopulate(val, "SourceVault", &k.SourceVault) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LinuxConfiguration. +func (l LinuxConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "disablePasswordAuthentication", l.DisablePasswordAuthentication) + populate(objectMap, "enableVMAgentPlatformUpdates", l.EnableVMAgentPlatformUpdates) + populate(objectMap, "patchSettings", l.PatchSettings) + populate(objectMap, "provisionVMAgent", l.ProvisionVMAgent) + populate(objectMap, "ssh", l.SSH) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LinuxConfiguration. +func (l *LinuxConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "disablePasswordAuthentication": + err = unpopulate(val, "DisablePasswordAuthentication", &l.DisablePasswordAuthentication) + delete(rawMsg, key) + case "enableVMAgentPlatformUpdates": + err = unpopulate(val, "EnableVMAgentPlatformUpdates", &l.EnableVMAgentPlatformUpdates) + delete(rawMsg, key) + case "patchSettings": + err = unpopulate(val, "PatchSettings", &l.PatchSettings) + delete(rawMsg, key) + case "provisionVMAgent": + err = unpopulate(val, "ProvisionVMAgent", &l.ProvisionVMAgent) + delete(rawMsg, key) + case "ssh": + err = unpopulate(val, "SSH", &l.SSH) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LinuxPatchSettings. +func (l LinuxPatchSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "assessmentMode", l.AssessmentMode) + populate(objectMap, "automaticByPlatformSettings", l.AutomaticByPlatformSettings) + populate(objectMap, "patchMode", l.PatchMode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LinuxPatchSettings. +func (l *LinuxPatchSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "assessmentMode": + err = unpopulate(val, "AssessmentMode", &l.AssessmentMode) + delete(rawMsg, key) + case "automaticByPlatformSettings": + err = unpopulate(val, "AutomaticByPlatformSettings", &l.AutomaticByPlatformSettings) + delete(rawMsg, key) + case "patchMode": + err = unpopulate(val, "PatchMode", &l.PatchMode) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LinuxVMGuestPatchAutomaticByPlatformSettings. +func (l LinuxVMGuestPatchAutomaticByPlatformSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "bypassPlatformSafetyChecksOnUserSchedule", l.BypassPlatformSafetyChecksOnUserSchedule) + populate(objectMap, "rebootSetting", l.RebootSetting) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LinuxVMGuestPatchAutomaticByPlatformSettings. +func (l *LinuxVMGuestPatchAutomaticByPlatformSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "bypassPlatformSafetyChecksOnUserSchedule": + err = unpopulate(val, "BypassPlatformSafetyChecksOnUserSchedule", &l.BypassPlatformSafetyChecksOnUserSchedule) + delete(rawMsg, key) + case "rebootSetting": + err = unpopulate(val, "RebootSetting", &l.RebootSetting) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. +func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", m.PrincipalID) + populate(objectMap, "tenantId", m.TenantID) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentity. +func (m *ManagedServiceIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &m.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentityUpdate. +func (m ManagedServiceIdentityUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentityUpdate. +func (m *ManagedServiceIdentityUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OSImageNotificationProfile. +func (o OSImageNotificationProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enable", o.Enable) + populate(objectMap, "notBeforeTimeout", o.NotBeforeTimeout) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OSImageNotificationProfile. +func (o *OSImageNotificationProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enable": + err = unpopulate(val, "Enable", &o.Enable) + delete(rawMsg, key) + case "notBeforeTimeout": + err = unpopulate(val, "NotBeforeTimeout", &o.NotBeforeTimeout) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PatchSettings. +func (p PatchSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "assessmentMode", p.AssessmentMode) + populate(objectMap, "automaticByPlatformSettings", p.AutomaticByPlatformSettings) + populate(objectMap, "enableHotpatching", p.EnableHotpatching) + populate(objectMap, "patchMode", p.PatchMode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PatchSettings. +func (p *PatchSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "assessmentMode": + err = unpopulate(val, "AssessmentMode", &p.AssessmentMode) + delete(rawMsg, key) + case "automaticByPlatformSettings": + err = unpopulate(val, "AutomaticByPlatformSettings", &p.AutomaticByPlatformSettings) + delete(rawMsg, key) + case "enableHotpatching": + err = unpopulate(val, "EnableHotpatching", &p.EnableHotpatching) + delete(rawMsg, key) + case "patchMode": + err = unpopulate(val, "PatchMode", &p.PatchMode) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Plan. +func (p Plan) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", p.Name) + populate(objectMap, "product", p.Product) + populate(objectMap, "promotionCode", p.PromotionCode) + populate(objectMap, "publisher", p.Publisher) + populate(objectMap, "version", p.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Plan. +func (p *Plan) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "product": + err = unpopulate(val, "Product", &p.Product) + delete(rawMsg, key) + case "promotionCode": + err = unpopulate(val, "PromotionCode", &p.PromotionCode) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &p.Publisher) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &p.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProxyAgentSettings. +func (p ProxyAgentSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", p.Enabled) + populate(objectMap, "keyIncarnationId", p.KeyIncarnationID) + populate(objectMap, "mode", p.Mode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyAgentSettings. +func (p *ProxyAgentSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &p.Enabled) + delete(rawMsg, key) + case "keyIncarnationId": + err = unpopulate(val, "KeyIncarnationID", &p.KeyIncarnationID) + delete(rawMsg, key) + case "mode": + err = unpopulate(val, "Mode", &p.Mode) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PublicIPAddressSKU. +func (p PublicIPAddressSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", p.Name) + populate(objectMap, "tier", p.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PublicIPAddressSKU. +func (p *PublicIPAddressSKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &p.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RegularPriorityProfile. +func (r RegularPriorityProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allocationStrategy", r.AllocationStrategy) + populate(objectMap, "capacity", r.Capacity) + populate(objectMap, "minCapacity", r.MinCapacity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegularPriorityProfile. +func (r *RegularPriorityProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allocationStrategy": + err = unpopulate(val, "AllocationStrategy", &r.AllocationStrategy) + delete(rawMsg, key) + case "capacity": + err = unpopulate(val, "Capacity", &r.Capacity) + delete(rawMsg, key) + case "minCapacity": + err = unpopulate(val, "MinCapacity", &r.MinCapacity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourcePlanUpdate. +func (r ResourcePlanUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", r.Name) + populate(objectMap, "product", r.Product) + populate(objectMap, "promotionCode", r.PromotionCode) + populate(objectMap, "publisher", r.Publisher) + populate(objectMap, "version", r.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourcePlanUpdate. +func (r *ResourcePlanUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "product": + err = unpopulate(val, "Product", &r.Product) + delete(rawMsg, key) + case "promotionCode": + err = unpopulate(val, "PromotionCode", &r.PromotionCode) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &r.Publisher) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &r.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SSHConfiguration. +func (s SSHConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "publicKeys", s.PublicKeys) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SSHConfiguration. +func (s *SSHConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "publicKeys": + err = unpopulate(val, "PublicKeys", &s.PublicKeys) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SSHPublicKey. +func (s SSHPublicKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "keyData", s.KeyData) + populate(objectMap, "path", s.Path) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SSHPublicKey. +func (s *SSHPublicKey) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "keyData": + err = unpopulate(val, "KeyData", &s.KeyData) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &s.Path) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScheduledEventsProfile. +func (s ScheduledEventsProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "osImageNotificationProfile", s.OSImageNotificationProfile) + populate(objectMap, "terminateNotificationProfile", s.TerminateNotificationProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledEventsProfile. +func (s *ScheduledEventsProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "osImageNotificationProfile": + err = unpopulate(val, "OSImageNotificationProfile", &s.OSImageNotificationProfile) + delete(rawMsg, key) + case "terminateNotificationProfile": + err = unpopulate(val, "TerminateNotificationProfile", &s.TerminateNotificationProfile) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityPostureReference. +func (s SecurityPostureReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "excludeExtensions", s.ExcludeExtensions) + populate(objectMap, "id", s.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityPostureReference. +func (s *SecurityPostureReference) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "excludeExtensions": + err = unpopulate(val, "ExcludeExtensions", &s.ExcludeExtensions) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityProfile. +func (s SecurityProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "encryptionAtHost", s.EncryptionAtHost) + populate(objectMap, "encryptionIdentity", s.EncryptionIdentity) + populate(objectMap, "proxyAgentSettings", s.ProxyAgentSettings) + populate(objectMap, "securityType", s.SecurityType) + populate(objectMap, "uefiSettings", s.UefiSettings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityProfile. +func (s *SecurityProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "encryptionAtHost": + err = unpopulate(val, "EncryptionAtHost", &s.EncryptionAtHost) + delete(rawMsg, key) + case "encryptionIdentity": + err = unpopulate(val, "EncryptionIdentity", &s.EncryptionIdentity) + delete(rawMsg, key) + case "proxyAgentSettings": + err = unpopulate(val, "ProxyAgentSettings", &s.ProxyAgentSettings) + delete(rawMsg, key) + case "securityType": + err = unpopulate(val, "SecurityType", &s.SecurityType) + delete(rawMsg, key) + case "uefiSettings": + err = unpopulate(val, "UefiSettings", &s.UefiSettings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceArtifactReference. +func (s ServiceArtifactReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceArtifactReference. +func (s *ServiceArtifactReference) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SpotPriorityProfile. +func (s SpotPriorityProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allocationStrategy", s.AllocationStrategy) + populate(objectMap, "capacity", s.Capacity) + populate(objectMap, "evictionPolicy", s.EvictionPolicy) + populate(objectMap, "maintain", s.Maintain) + populate(objectMap, "maxPricePerVM", s.MaxPricePerVM) + populate(objectMap, "minCapacity", s.MinCapacity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpotPriorityProfile. +func (s *SpotPriorityProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allocationStrategy": + err = unpopulate(val, "AllocationStrategy", &s.AllocationStrategy) + delete(rawMsg, key) + case "capacity": + err = unpopulate(val, "Capacity", &s.Capacity) + delete(rawMsg, key) + case "evictionPolicy": + err = unpopulate(val, "EvictionPolicy", &s.EvictionPolicy) + delete(rawMsg, key) + case "maintain": + err = unpopulate(val, "Maintain", &s.Maintain) + delete(rawMsg, key) + case "maxPricePerVM": + err = unpopulate(val, "MaxPricePerVM", &s.MaxPricePerVM) + delete(rawMsg, key) + case "minCapacity": + err = unpopulate(val, "MinCapacity", &s.MinCapacity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SubResource. +func (s SubResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubResource. +func (s *SubResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TerminateNotificationProfile. +func (t TerminateNotificationProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enable", t.Enable) + populate(objectMap, "notBeforeTimeout", t.NotBeforeTimeout) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TerminateNotificationProfile. +func (t *TerminateNotificationProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enable": + err = unpopulate(val, "Enable", &t.Enable) + delete(rawMsg, key) + case "notBeforeTimeout": + err = unpopulate(val, "NotBeforeTimeout", &t.NotBeforeTimeout) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UefiSettings. +func (u UefiSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "secureBootEnabled", u.SecureBootEnabled) + populate(objectMap, "vTpmEnabled", u.VTpmEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UefiSettings. +func (u *UefiSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "secureBootEnabled": + err = unpopulate(val, "SecureBootEnabled", &u.SecureBootEnabled) + delete(rawMsg, key) + case "vTpmEnabled": + err = unpopulate(val, "VTpmEnabled", &u.VTpmEnabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity. +func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity. +func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMDiskSecurityProfile. +func (v VMDiskSecurityProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "diskEncryptionSet", v.DiskEncryptionSet) + populate(objectMap, "securityEncryptionType", v.SecurityEncryptionType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMDiskSecurityProfile. +func (v *VMDiskSecurityProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskEncryptionSet": + err = unpopulate(val, "DiskEncryptionSet", &v.DiskEncryptionSet) + delete(rawMsg, key) + case "securityEncryptionType": + err = unpopulate(val, "SecurityEncryptionType", &v.SecurityEncryptionType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMGalleryApplication. +func (v VMGalleryApplication) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "configurationReference", v.ConfigurationReference) + populate(objectMap, "enableAutomaticUpgrade", v.EnableAutomaticUpgrade) + populate(objectMap, "order", v.Order) + populate(objectMap, "packageReferenceId", v.PackageReferenceID) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "treatFailureAsDeploymentFailure", v.TreatFailureAsDeploymentFailure) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMGalleryApplication. +func (v *VMGalleryApplication) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "configurationReference": + err = unpopulate(val, "ConfigurationReference", &v.ConfigurationReference) + delete(rawMsg, key) + case "enableAutomaticUpgrade": + err = unpopulate(val, "EnableAutomaticUpgrade", &v.EnableAutomaticUpgrade) + delete(rawMsg, key) + case "order": + err = unpopulate(val, "Order", &v.Order) + delete(rawMsg, key) + case "packageReferenceId": + err = unpopulate(val, "PackageReferenceID", &v.PackageReferenceID) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + case "treatFailureAsDeploymentFailure": + err = unpopulate(val, "TreatFailureAsDeploymentFailure", &v.TreatFailureAsDeploymentFailure) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMSizeProfile. +func (v VMSizeProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", v.Name) + populate(objectMap, "rank", v.Rank) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMSizeProfile. +func (v *VMSizeProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "rank": + err = unpopulate(val, "Rank", &v.Rank) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMSizeProperties. +func (v VMSizeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "vCPUsAvailable", v.VCPUsAvailable) + populate(objectMap, "vCPUsPerCore", v.VCPUsPerCore) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMSizeProperties. +func (v *VMSizeProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "vCPUsAvailable": + err = unpopulate(val, "VCPUsAvailable", &v.VCPUsAvailable) + delete(rawMsg, key) + case "vCPUsPerCore": + err = unpopulate(val, "VCPUsPerCore", &v.VCPUsPerCore) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VaultCertificate. +func (v VaultCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "certificateStore", v.CertificateStore) + populate(objectMap, "certificateUrl", v.CertificateURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VaultCertificate. +func (v *VaultCertificate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "certificateStore": + err = unpopulate(val, "CertificateStore", &v.CertificateStore) + delete(rawMsg, key) + case "certificateUrl": + err = unpopulate(val, "CertificateURL", &v.CertificateURL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VaultSecretGroup. +func (v VaultSecretGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "sourceVault", v.SourceVault) + populate(objectMap, "vaultCertificates", v.VaultCertificates) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VaultSecretGroup. +func (v *VaultSecretGroup) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "sourceVault": + err = unpopulate(val, "SourceVault", &v.SourceVault) + delete(rawMsg, key) + case "vaultCertificates": + err = unpopulate(val, "VaultCertificates", &v.VaultCertificates) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualHardDisk. +func (v VirtualHardDisk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "uri", v.URI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualHardDisk. +func (v *VirtualHardDisk) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "uri": + err = unpopulate(val, "URI", &v.URI) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineExtension. +func (v VirtualMachineExtension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineExtension. +func (v *VirtualMachineExtension) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineExtensionInstanceView. +func (v VirtualMachineExtensionInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", v.Name) + populate(objectMap, "statuses", v.Statuses) + populate(objectMap, "substatuses", v.Substatuses) + populate(objectMap, "type", v.Type) + populate(objectMap, "typeHandlerVersion", v.TypeHandlerVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineExtensionInstanceView. +func (v *VirtualMachineExtensionInstanceView) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "statuses": + err = unpopulate(val, "Statuses", &v.Statuses) + delete(rawMsg, key) + case "substatuses": + err = unpopulate(val, "Substatuses", &v.Substatuses) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + case "typeHandlerVersion": + err = unpopulate(val, "TypeHandlerVersion", &v.TypeHandlerVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineExtensionProperties. +func (v VirtualMachineExtensionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "autoUpgradeMinorVersion", v.AutoUpgradeMinorVersion) + populate(objectMap, "enableAutomaticUpgrade", v.EnableAutomaticUpgrade) + populate(objectMap, "forceUpdateTag", v.ForceUpdateTag) + populate(objectMap, "instanceView", v.InstanceView) + populateAny(objectMap, "protectedSettings", v.ProtectedSettings) + populate(objectMap, "protectedSettingsFromKeyVault", v.ProtectedSettingsFromKeyVault) + populate(objectMap, "provisionAfterExtensions", v.ProvisionAfterExtensions) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "publisher", v.Publisher) + populateAny(objectMap, "settings", v.Settings) + populate(objectMap, "suppressFailures", v.SuppressFailures) + populate(objectMap, "type", v.Type) + populate(objectMap, "typeHandlerVersion", v.TypeHandlerVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineExtensionProperties. +func (v *VirtualMachineExtensionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "autoUpgradeMinorVersion": + err = unpopulate(val, "AutoUpgradeMinorVersion", &v.AutoUpgradeMinorVersion) + delete(rawMsg, key) + case "enableAutomaticUpgrade": + err = unpopulate(val, "EnableAutomaticUpgrade", &v.EnableAutomaticUpgrade) + delete(rawMsg, key) + case "forceUpdateTag": + err = unpopulate(val, "ForceUpdateTag", &v.ForceUpdateTag) + delete(rawMsg, key) + case "instanceView": + err = unpopulate(val, "InstanceView", &v.InstanceView) + delete(rawMsg, key) + case "protectedSettings": + err = unpopulate(val, "ProtectedSettings", &v.ProtectedSettings) + delete(rawMsg, key) + case "protectedSettingsFromKeyVault": + err = unpopulate(val, "ProtectedSettingsFromKeyVault", &v.ProtectedSettingsFromKeyVault) + delete(rawMsg, key) + case "provisionAfterExtensions": + err = unpopulate(val, "ProvisionAfterExtensions", &v.ProvisionAfterExtensions) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &v.Publisher) + delete(rawMsg, key) + case "settings": + err = unpopulate(val, "Settings", &v.Settings) + delete(rawMsg, key) + case "suppressFailures": + err = unpopulate(val, "SuppressFailures", &v.SuppressFailures) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + case "typeHandlerVersion": + err = unpopulate(val, "TypeHandlerVersion", &v.TypeHandlerVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSet. +func (v VirtualMachineScaleSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", v.Error) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "operationStatus", v.OperationStatus) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSet. +func (v *VirtualMachineScaleSet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &v.Error) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "operationStatus": + err = unpopulate(val, "OperationStatus", &v.OperationStatus) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetDataDisk. +func (v VirtualMachineScaleSetDataDisk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "caching", v.Caching) + populate(objectMap, "createOption", v.CreateOption) + populate(objectMap, "deleteOption", v.DeleteOption) + populate(objectMap, "diskIOPSReadWrite", v.DiskIOPSReadWrite) + populate(objectMap, "diskMBpsReadWrite", v.DiskMBpsReadWrite) + populate(objectMap, "diskSizeGB", v.DiskSizeGB) + populate(objectMap, "lun", v.Lun) + populate(objectMap, "managedDisk", v.ManagedDisk) + populate(objectMap, "name", v.Name) + populate(objectMap, "writeAcceleratorEnabled", v.WriteAcceleratorEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetDataDisk. +func (v *VirtualMachineScaleSetDataDisk) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "caching": + err = unpopulate(val, "Caching", &v.Caching) + delete(rawMsg, key) + case "createOption": + err = unpopulate(val, "CreateOption", &v.CreateOption) + delete(rawMsg, key) + case "deleteOption": + err = unpopulate(val, "DeleteOption", &v.DeleteOption) + delete(rawMsg, key) + case "diskIOPSReadWrite": + err = unpopulate(val, "DiskIOPSReadWrite", &v.DiskIOPSReadWrite) + delete(rawMsg, key) + case "diskMBpsReadWrite": + err = unpopulate(val, "DiskMBpsReadWrite", &v.DiskMBpsReadWrite) + delete(rawMsg, key) + case "diskSizeGB": + err = unpopulate(val, "DiskSizeGB", &v.DiskSizeGB) + delete(rawMsg, key) + case "lun": + err = unpopulate(val, "Lun", &v.Lun) + delete(rawMsg, key) + case "managedDisk": + err = unpopulate(val, "ManagedDisk", &v.ManagedDisk) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "writeAcceleratorEnabled": + err = unpopulate(val, "WriteAcceleratorEnabled", &v.WriteAcceleratorEnabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetExtension. +func (v VirtualMachineScaleSetExtension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetExtension. +func (v *VirtualMachineScaleSetExtension) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetExtensionProfile. +func (v VirtualMachineScaleSetExtensionProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extensions", v.Extensions) + populate(objectMap, "extensionsTimeBudget", v.ExtensionsTimeBudget) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetExtensionProfile. +func (v *VirtualMachineScaleSetExtensionProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extensions": + err = unpopulate(val, "Extensions", &v.Extensions) + delete(rawMsg, key) + case "extensionsTimeBudget": + err = unpopulate(val, "ExtensionsTimeBudget", &v.ExtensionsTimeBudget) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetExtensionProperties. +func (v VirtualMachineScaleSetExtensionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "autoUpgradeMinorVersion", v.AutoUpgradeMinorVersion) + populate(objectMap, "enableAutomaticUpgrade", v.EnableAutomaticUpgrade) + populate(objectMap, "forceUpdateTag", v.ForceUpdateTag) + populateAny(objectMap, "protectedSettings", v.ProtectedSettings) + populate(objectMap, "protectedSettingsFromKeyVault", v.ProtectedSettingsFromKeyVault) + populate(objectMap, "provisionAfterExtensions", v.ProvisionAfterExtensions) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "publisher", v.Publisher) + populateAny(objectMap, "settings", v.Settings) + populate(objectMap, "suppressFailures", v.SuppressFailures) + populate(objectMap, "type", v.Type) + populate(objectMap, "typeHandlerVersion", v.TypeHandlerVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetExtensionProperties. +func (v *VirtualMachineScaleSetExtensionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "autoUpgradeMinorVersion": + err = unpopulate(val, "AutoUpgradeMinorVersion", &v.AutoUpgradeMinorVersion) + delete(rawMsg, key) + case "enableAutomaticUpgrade": + err = unpopulate(val, "EnableAutomaticUpgrade", &v.EnableAutomaticUpgrade) + delete(rawMsg, key) + case "forceUpdateTag": + err = unpopulate(val, "ForceUpdateTag", &v.ForceUpdateTag) + delete(rawMsg, key) + case "protectedSettings": + err = unpopulate(val, "ProtectedSettings", &v.ProtectedSettings) + delete(rawMsg, key) + case "protectedSettingsFromKeyVault": + err = unpopulate(val, "ProtectedSettingsFromKeyVault", &v.ProtectedSettingsFromKeyVault) + delete(rawMsg, key) + case "provisionAfterExtensions": + err = unpopulate(val, "ProvisionAfterExtensions", &v.ProvisionAfterExtensions) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &v.Publisher) + delete(rawMsg, key) + case "settings": + err = unpopulate(val, "Settings", &v.Settings) + delete(rawMsg, key) + case "suppressFailures": + err = unpopulate(val, "SuppressFailures", &v.SuppressFailures) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + case "typeHandlerVersion": + err = unpopulate(val, "TypeHandlerVersion", &v.TypeHandlerVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetHardwareProfile. +func (v VirtualMachineScaleSetHardwareProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "vmSizeProperties", v.VMSizeProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetHardwareProfile. +func (v *VirtualMachineScaleSetHardwareProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "vmSizeProperties": + err = unpopulate(val, "VMSizeProperties", &v.VMSizeProperties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetIPConfiguration. +func (v VirtualMachineScaleSetIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetIPConfiguration. +func (v *VirtualMachineScaleSetIPConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetIPConfigurationProperties. +func (v VirtualMachineScaleSetIPConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "applicationGatewayBackendAddressPools", v.ApplicationGatewayBackendAddressPools) + populate(objectMap, "applicationSecurityGroups", v.ApplicationSecurityGroups) + populate(objectMap, "loadBalancerBackendAddressPools", v.LoadBalancerBackendAddressPools) + populate(objectMap, "loadBalancerInboundNatPools", v.LoadBalancerInboundNatPools) + populate(objectMap, "primary", v.Primary) + populate(objectMap, "privateIPAddressVersion", v.PrivateIPAddressVersion) + populate(objectMap, "publicIPAddressConfiguration", v.PublicIPAddressConfiguration) + populate(objectMap, "subnet", v.Subnet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetIPConfigurationProperties. +func (v *VirtualMachineScaleSetIPConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applicationGatewayBackendAddressPools": + err = unpopulate(val, "ApplicationGatewayBackendAddressPools", &v.ApplicationGatewayBackendAddressPools) + delete(rawMsg, key) + case "applicationSecurityGroups": + err = unpopulate(val, "ApplicationSecurityGroups", &v.ApplicationSecurityGroups) + delete(rawMsg, key) + case "loadBalancerBackendAddressPools": + err = unpopulate(val, "LoadBalancerBackendAddressPools", &v.LoadBalancerBackendAddressPools) + delete(rawMsg, key) + case "loadBalancerInboundNatPools": + err = unpopulate(val, "LoadBalancerInboundNatPools", &v.LoadBalancerInboundNatPools) + delete(rawMsg, key) + case "primary": + err = unpopulate(val, "Primary", &v.Primary) + delete(rawMsg, key) + case "privateIPAddressVersion": + err = unpopulate(val, "PrivateIPAddressVersion", &v.PrivateIPAddressVersion) + delete(rawMsg, key) + case "publicIPAddressConfiguration": + err = unpopulate(val, "PublicIPAddressConfiguration", &v.PublicIPAddressConfiguration) + delete(rawMsg, key) + case "subnet": + err = unpopulate(val, "Subnet", &v.Subnet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetIPTag. +func (v VirtualMachineScaleSetIPTag) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ipTagType", v.IPTagType) + populate(objectMap, "tag", v.Tag) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetIPTag. +func (v *VirtualMachineScaleSetIPTag) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ipTagType": + err = unpopulate(val, "IPTagType", &v.IPTagType) + delete(rawMsg, key) + case "tag": + err = unpopulate(val, "Tag", &v.Tag) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetListResult. +func (v VirtualMachineScaleSetListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetListResult. +func (v *VirtualMachineScaleSetListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetManagedDiskParameters. +func (v VirtualMachineScaleSetManagedDiskParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "diskEncryptionSet", v.DiskEncryptionSet) + populate(objectMap, "securityProfile", v.SecurityProfile) + populate(objectMap, "storageAccountType", v.StorageAccountType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetManagedDiskParameters. +func (v *VirtualMachineScaleSetManagedDiskParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskEncryptionSet": + err = unpopulate(val, "DiskEncryptionSet", &v.DiskEncryptionSet) + delete(rawMsg, key) + case "securityProfile": + err = unpopulate(val, "SecurityProfile", &v.SecurityProfile) + delete(rawMsg, key) + case "storageAccountType": + err = unpopulate(val, "StorageAccountType", &v.StorageAccountType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetNetworkConfiguration. +func (v VirtualMachineScaleSetNetworkConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetNetworkConfiguration. +func (v *VirtualMachineScaleSetNetworkConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetNetworkConfigurationDNSSettings. +func (v VirtualMachineScaleSetNetworkConfigurationDNSSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dnsServers", v.DNSServers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetNetworkConfigurationDNSSettings. +func (v *VirtualMachineScaleSetNetworkConfigurationDNSSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dnsServers": + err = unpopulate(val, "DNSServers", &v.DNSServers) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetNetworkConfigurationProperties. +func (v VirtualMachineScaleSetNetworkConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "auxiliaryMode", v.AuxiliaryMode) + populate(objectMap, "auxiliarySku", v.AuxiliarySKU) + populate(objectMap, "dnsSettings", v.DNSSettings) + populate(objectMap, "deleteOption", v.DeleteOption) + populate(objectMap, "disableTcpStateTracking", v.DisableTCPStateTracking) + populate(objectMap, "enableAcceleratedNetworking", v.EnableAcceleratedNetworking) + populate(objectMap, "enableFpga", v.EnableFpga) + populate(objectMap, "enableIPForwarding", v.EnableIPForwarding) + populate(objectMap, "ipConfigurations", v.IPConfigurations) + populate(objectMap, "networkSecurityGroup", v.NetworkSecurityGroup) + populate(objectMap, "primary", v.Primary) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetNetworkConfigurationProperties. +func (v *VirtualMachineScaleSetNetworkConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "auxiliaryMode": + err = unpopulate(val, "AuxiliaryMode", &v.AuxiliaryMode) + delete(rawMsg, key) + case "auxiliarySku": + err = unpopulate(val, "AuxiliarySKU", &v.AuxiliarySKU) + delete(rawMsg, key) + case "dnsSettings": + err = unpopulate(val, "DNSSettings", &v.DNSSettings) + delete(rawMsg, key) + case "deleteOption": + err = unpopulate(val, "DeleteOption", &v.DeleteOption) + delete(rawMsg, key) + case "disableTcpStateTracking": + err = unpopulate(val, "DisableTCPStateTracking", &v.DisableTCPStateTracking) + delete(rawMsg, key) + case "enableAcceleratedNetworking": + err = unpopulate(val, "EnableAcceleratedNetworking", &v.EnableAcceleratedNetworking) + delete(rawMsg, key) + case "enableFpga": + err = unpopulate(val, "EnableFpga", &v.EnableFpga) + delete(rawMsg, key) + case "enableIPForwarding": + err = unpopulate(val, "EnableIPForwarding", &v.EnableIPForwarding) + delete(rawMsg, key) + case "ipConfigurations": + err = unpopulate(val, "IPConfigurations", &v.IPConfigurations) + delete(rawMsg, key) + case "networkSecurityGroup": + err = unpopulate(val, "NetworkSecurityGroup", &v.NetworkSecurityGroup) + delete(rawMsg, key) + case "primary": + err = unpopulate(val, "Primary", &v.Primary) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetNetworkProfile. +func (v VirtualMachineScaleSetNetworkProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "healthProbe", v.HealthProbe) + populate(objectMap, "networkApiVersion", v.NetworkAPIVersion) + populate(objectMap, "networkInterfaceConfigurations", v.NetworkInterfaceConfigurations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetNetworkProfile. +func (v *VirtualMachineScaleSetNetworkProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "healthProbe": + err = unpopulate(val, "HealthProbe", &v.HealthProbe) + delete(rawMsg, key) + case "networkApiVersion": + err = unpopulate(val, "NetworkAPIVersion", &v.NetworkAPIVersion) + delete(rawMsg, key) + case "networkInterfaceConfigurations": + err = unpopulate(val, "NetworkInterfaceConfigurations", &v.NetworkInterfaceConfigurations) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetOSDisk. +func (v VirtualMachineScaleSetOSDisk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "caching", v.Caching) + populate(objectMap, "createOption", v.CreateOption) + populate(objectMap, "deleteOption", v.DeleteOption) + populate(objectMap, "diffDiskSettings", v.DiffDiskSettings) + populate(objectMap, "diskSizeGB", v.DiskSizeGB) + populate(objectMap, "image", v.Image) + populate(objectMap, "managedDisk", v.ManagedDisk) + populate(objectMap, "name", v.Name) + populate(objectMap, "osType", v.OSType) + populate(objectMap, "vhdContainers", v.VhdContainers) + populate(objectMap, "writeAcceleratorEnabled", v.WriteAcceleratorEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetOSDisk. +func (v *VirtualMachineScaleSetOSDisk) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "caching": + err = unpopulate(val, "Caching", &v.Caching) + delete(rawMsg, key) + case "createOption": + err = unpopulate(val, "CreateOption", &v.CreateOption) + delete(rawMsg, key) + case "deleteOption": + err = unpopulate(val, "DeleteOption", &v.DeleteOption) + delete(rawMsg, key) + case "diffDiskSettings": + err = unpopulate(val, "DiffDiskSettings", &v.DiffDiskSettings) + delete(rawMsg, key) + case "diskSizeGB": + err = unpopulate(val, "DiskSizeGB", &v.DiskSizeGB) + delete(rawMsg, key) + case "image": + err = unpopulate(val, "Image", &v.Image) + delete(rawMsg, key) + case "managedDisk": + err = unpopulate(val, "ManagedDisk", &v.ManagedDisk) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &v.OSType) + delete(rawMsg, key) + case "vhdContainers": + err = unpopulate(val, "VhdContainers", &v.VhdContainers) + delete(rawMsg, key) + case "writeAcceleratorEnabled": + err = unpopulate(val, "WriteAcceleratorEnabled", &v.WriteAcceleratorEnabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetOSProfile. +func (v VirtualMachineScaleSetOSProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "adminPassword", v.AdminPassword) + populate(objectMap, "adminUsername", v.AdminUsername) + populate(objectMap, "allowExtensionOperations", v.AllowExtensionOperations) + populate(objectMap, "computerNamePrefix", v.ComputerNamePrefix) + populate(objectMap, "customData", v.CustomData) + populate(objectMap, "linuxConfiguration", v.LinuxConfiguration) + populate(objectMap, "requireGuestProvisionSignal", v.RequireGuestProvisionSignal) + populate(objectMap, "secrets", v.Secrets) + populate(objectMap, "windowsConfiguration", v.WindowsConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetOSProfile. +func (v *VirtualMachineScaleSetOSProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "adminPassword": + err = unpopulate(val, "AdminPassword", &v.AdminPassword) + delete(rawMsg, key) + case "adminUsername": + err = unpopulate(val, "AdminUsername", &v.AdminUsername) + delete(rawMsg, key) + case "allowExtensionOperations": + err = unpopulate(val, "AllowExtensionOperations", &v.AllowExtensionOperations) + delete(rawMsg, key) + case "computerNamePrefix": + err = unpopulate(val, "ComputerNamePrefix", &v.ComputerNamePrefix) + delete(rawMsg, key) + case "customData": + err = unpopulate(val, "CustomData", &v.CustomData) + delete(rawMsg, key) + case "linuxConfiguration": + err = unpopulate(val, "LinuxConfiguration", &v.LinuxConfiguration) + delete(rawMsg, key) + case "requireGuestProvisionSignal": + err = unpopulate(val, "RequireGuestProvisionSignal", &v.RequireGuestProvisionSignal) + delete(rawMsg, key) + case "secrets": + err = unpopulate(val, "Secrets", &v.Secrets) + delete(rawMsg, key) + case "windowsConfiguration": + err = unpopulate(val, "WindowsConfiguration", &v.WindowsConfiguration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetPublicIPAddressConfiguration. +func (v VirtualMachineScaleSetPublicIPAddressConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "sku", v.SKU) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetPublicIPAddressConfiguration. +func (v *VirtualMachineScaleSetPublicIPAddressConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &v.SKU) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings. +func (v VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "domainNameLabel", v.DomainNameLabel) + populate(objectMap, "domainNameLabelScope", v.DomainNameLabelScope) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings. +func (v *VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "domainNameLabel": + err = unpopulate(val, "DomainNameLabel", &v.DomainNameLabel) + delete(rawMsg, key) + case "domainNameLabelScope": + err = unpopulate(val, "DomainNameLabelScope", &v.DomainNameLabelScope) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetPublicIPAddressConfigurationProperties. +func (v VirtualMachineScaleSetPublicIPAddressConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dnsSettings", v.DNSSettings) + populate(objectMap, "deleteOption", v.DeleteOption) + populate(objectMap, "ipTags", v.IPTags) + populate(objectMap, "idleTimeoutInMinutes", v.IdleTimeoutInMinutes) + populate(objectMap, "publicIPAddressVersion", v.PublicIPAddressVersion) + populate(objectMap, "publicIPPrefix", v.PublicIPPrefix) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetPublicIPAddressConfigurationProperties. +func (v *VirtualMachineScaleSetPublicIPAddressConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dnsSettings": + err = unpopulate(val, "DNSSettings", &v.DNSSettings) + delete(rawMsg, key) + case "deleteOption": + err = unpopulate(val, "DeleteOption", &v.DeleteOption) + delete(rawMsg, key) + case "ipTags": + err = unpopulate(val, "IPTags", &v.IPTags) + delete(rawMsg, key) + case "idleTimeoutInMinutes": + err = unpopulate(val, "IdleTimeoutInMinutes", &v.IdleTimeoutInMinutes) + delete(rawMsg, key) + case "publicIPAddressVersion": + err = unpopulate(val, "PublicIPAddressVersion", &v.PublicIPAddressVersion) + delete(rawMsg, key) + case "publicIPPrefix": + err = unpopulate(val, "PublicIPPrefix", &v.PublicIPPrefix) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetStorageProfile. +func (v VirtualMachineScaleSetStorageProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dataDisks", v.DataDisks) + populate(objectMap, "diskControllerType", v.DiskControllerType) + populate(objectMap, "imageReference", v.ImageReference) + populate(objectMap, "osDisk", v.OSDisk) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetStorageProfile. +func (v *VirtualMachineScaleSetStorageProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataDisks": + err = unpopulate(val, "DataDisks", &v.DataDisks) + delete(rawMsg, key) + case "diskControllerType": + err = unpopulate(val, "DiskControllerType", &v.DiskControllerType) + delete(rawMsg, key) + case "imageReference": + err = unpopulate(val, "ImageReference", &v.ImageReference) + delete(rawMsg, key) + case "osDisk": + err = unpopulate(val, "OSDisk", &v.OSDisk) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetVMProfile. +func (v VirtualMachineScaleSetVMProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "applicationProfile", v.ApplicationProfile) + populate(objectMap, "billingProfile", v.BillingProfile) + populate(objectMap, "capacityReservation", v.CapacityReservation) + populate(objectMap, "diagnosticsProfile", v.DiagnosticsProfile) + populate(objectMap, "evictionPolicy", v.EvictionPolicy) + populate(objectMap, "extensionProfile", v.ExtensionProfile) + populate(objectMap, "hardwareProfile", v.HardwareProfile) + populate(objectMap, "licenseType", v.LicenseType) + populate(objectMap, "networkProfile", v.NetworkProfile) + populate(objectMap, "osProfile", v.OSProfile) + populate(objectMap, "priority", v.Priority) + populate(objectMap, "scheduledEventsProfile", v.ScheduledEventsProfile) + populate(objectMap, "securityPostureReference", v.SecurityPostureReference) + populate(objectMap, "securityProfile", v.SecurityProfile) + populate(objectMap, "serviceArtifactReference", v.ServiceArtifactReference) + populate(objectMap, "storageProfile", v.StorageProfile) + populateDateTimeRFC3339(objectMap, "timeCreated", v.TimeCreated) + populate(objectMap, "userData", v.UserData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetVMProfile. +func (v *VirtualMachineScaleSetVMProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applicationProfile": + err = unpopulate(val, "ApplicationProfile", &v.ApplicationProfile) + delete(rawMsg, key) + case "billingProfile": + err = unpopulate(val, "BillingProfile", &v.BillingProfile) + delete(rawMsg, key) + case "capacityReservation": + err = unpopulate(val, "CapacityReservation", &v.CapacityReservation) + delete(rawMsg, key) + case "diagnosticsProfile": + err = unpopulate(val, "DiagnosticsProfile", &v.DiagnosticsProfile) + delete(rawMsg, key) + case "evictionPolicy": + err = unpopulate(val, "EvictionPolicy", &v.EvictionPolicy) + delete(rawMsg, key) + case "extensionProfile": + err = unpopulate(val, "ExtensionProfile", &v.ExtensionProfile) + delete(rawMsg, key) + case "hardwareProfile": + err = unpopulate(val, "HardwareProfile", &v.HardwareProfile) + delete(rawMsg, key) + case "licenseType": + err = unpopulate(val, "LicenseType", &v.LicenseType) + delete(rawMsg, key) + case "networkProfile": + err = unpopulate(val, "NetworkProfile", &v.NetworkProfile) + delete(rawMsg, key) + case "osProfile": + err = unpopulate(val, "OSProfile", &v.OSProfile) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &v.Priority) + delete(rawMsg, key) + case "scheduledEventsProfile": + err = unpopulate(val, "ScheduledEventsProfile", &v.ScheduledEventsProfile) + delete(rawMsg, key) + case "securityPostureReference": + err = unpopulate(val, "SecurityPostureReference", &v.SecurityPostureReference) + delete(rawMsg, key) + case "securityProfile": + err = unpopulate(val, "SecurityProfile", &v.SecurityProfile) + delete(rawMsg, key) + case "serviceArtifactReference": + err = unpopulate(val, "ServiceArtifactReference", &v.ServiceArtifactReference) + delete(rawMsg, key) + case "storageProfile": + err = unpopulate(val, "StorageProfile", &v.StorageProfile) + delete(rawMsg, key) + case "timeCreated": + err = unpopulateDateTimeRFC3339(val, "TimeCreated", &v.TimeCreated) + delete(rawMsg, key) + case "userData": + err = unpopulate(val, "UserData", &v.UserData) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WinRMConfiguration. +func (w WinRMConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "listeners", w.Listeners) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WinRMConfiguration. +func (w *WinRMConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "listeners": + err = unpopulate(val, "Listeners", &w.Listeners) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WinRMListener. +func (w WinRMListener) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "certificateUrl", w.CertificateURL) + populate(objectMap, "protocol", w.Protocol) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WinRMListener. +func (w *WinRMListener) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "certificateUrl": + err = unpopulate(val, "CertificateURL", &w.CertificateURL) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &w.Protocol) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WindowsConfiguration. +func (w WindowsConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalUnattendContent", w.AdditionalUnattendContent) + populate(objectMap, "enableAutomaticUpdates", w.EnableAutomaticUpdates) + populate(objectMap, "enableVMAgentPlatformUpdates", w.EnableVMAgentPlatformUpdates) + populate(objectMap, "patchSettings", w.PatchSettings) + populate(objectMap, "provisionVMAgent", w.ProvisionVMAgent) + populate(objectMap, "timeZone", w.TimeZone) + populate(objectMap, "winRM", w.WinRM) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WindowsConfiguration. +func (w *WindowsConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalUnattendContent": + err = unpopulate(val, "AdditionalUnattendContent", &w.AdditionalUnattendContent) + delete(rawMsg, key) + case "enableAutomaticUpdates": + err = unpopulate(val, "EnableAutomaticUpdates", &w.EnableAutomaticUpdates) + delete(rawMsg, key) + case "enableVMAgentPlatformUpdates": + err = unpopulate(val, "EnableVMAgentPlatformUpdates", &w.EnableVMAgentPlatformUpdates) + delete(rawMsg, key) + case "patchSettings": + err = unpopulate(val, "PatchSettings", &w.PatchSettings) + delete(rawMsg, key) + case "provisionVMAgent": + err = unpopulate(val, "ProvisionVMAgent", &w.ProvisionVMAgent) + delete(rawMsg, key) + case "timeZone": + err = unpopulate(val, "TimeZone", &w.TimeZone) + delete(rawMsg, key) + case "winRM": + err = unpopulate(val, "WinRM", &w.WinRM) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WindowsVMGuestPatchAutomaticByPlatformSettings. +func (w WindowsVMGuestPatchAutomaticByPlatformSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "bypassPlatformSafetyChecksOnUserSchedule", w.BypassPlatformSafetyChecksOnUserSchedule) + populate(objectMap, "rebootSetting", w.RebootSetting) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WindowsVMGuestPatchAutomaticByPlatformSettings. +func (w *WindowsVMGuestPatchAutomaticByPlatformSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "bypassPlatformSafetyChecksOnUserSchedule": + err = unpopulate(val, "BypassPlatformSafetyChecksOnUserSchedule", &w.BypassPlatformSafetyChecksOnUserSchedule) + delete(rawMsg, key) + case "rebootSetting": + err = unpopulate(val, "RebootSetting", &w.RebootSetting) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func populateAny(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil || string(data) == "null" { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/operations_client.go b/sdk/resourcemanager/computefleet/armcomputefleet/operations_client.go new file mode 100644 index 000000000000..e638e0763ec0 --- /dev/null +++ b/sdk/resourcemanager/computefleet/armcomputefleet/operations_client.go @@ -0,0 +1,88 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcomputefleet + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + internal *arm.Client +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - List the operations for the provider +// +// Generated from API version 2024-05-01-preview +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return OperationsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.AzureFleet/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { + result := OperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { + return OperationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/options.go b/sdk/resourcemanager/computefleet/armcomputefleet/options.go new file mode 100644 index 000000000000..bda73b82b856 --- /dev/null +++ b/sdk/resourcemanager/computefleet/armcomputefleet/options.go @@ -0,0 +1,55 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcomputefleet + +// FleetsClientBeginCreateOrUpdateOptions contains the optional parameters for the FleetsClient.BeginCreateOrUpdate method. +type FleetsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FleetsClientBeginDeleteOptions contains the optional parameters for the FleetsClient.BeginDelete method. +type FleetsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FleetsClientBeginUpdateOptions contains the optional parameters for the FleetsClient.BeginUpdate method. +type FleetsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FleetsClientGetOptions contains the optional parameters for the FleetsClient.Get method. +type FleetsClientGetOptions struct { + // placeholder for future optional parameters +} + +// FleetsClientListByResourceGroupOptions contains the optional parameters for the FleetsClient.NewListByResourceGroupPager +// method. +type FleetsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// FleetsClientListBySubscriptionOptions contains the optional parameters for the FleetsClient.NewListBySubscriptionPager +// method. +type FleetsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineScaleSetsClientListByFleetOptions contains the optional parameters for the VirtualMachineScaleSetsClient.NewListByFleetPager +// method. +type VirtualMachineScaleSetsClientListByFleetOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/responses.go b/sdk/resourcemanager/computefleet/armcomputefleet/responses.go new file mode 100644 index 000000000000..5c22482919ea --- /dev/null +++ b/sdk/resourcemanager/computefleet/armcomputefleet/responses.go @@ -0,0 +1,56 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcomputefleet + +// FleetsClientCreateOrUpdateResponse contains the response from method FleetsClient.BeginCreateOrUpdate. +type FleetsClientCreateOrUpdateResponse struct { + // An Compute Fleet resource + Fleet +} + +// FleetsClientDeleteResponse contains the response from method FleetsClient.BeginDelete. +type FleetsClientDeleteResponse struct { + // placeholder for future response values +} + +// FleetsClientGetResponse contains the response from method FleetsClient.Get. +type FleetsClientGetResponse struct { + // An Compute Fleet resource + Fleet +} + +// FleetsClientListByResourceGroupResponse contains the response from method FleetsClient.NewListByResourceGroupPager. +type FleetsClientListByResourceGroupResponse struct { + // The response of a Fleet list operation. + FleetListResult +} + +// FleetsClientListBySubscriptionResponse contains the response from method FleetsClient.NewListBySubscriptionPager. +type FleetsClientListBySubscriptionResponse struct { + // The response of a Fleet list operation. + FleetListResult +} + +// FleetsClientUpdateResponse contains the response from method FleetsClient.BeginUpdate. +type FleetsClientUpdateResponse struct { + // An Compute Fleet resource + Fleet +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + OperationListResult +} + +// VirtualMachineScaleSetsClientListByFleetResponse contains the response from method VirtualMachineScaleSetsClient.NewListByFleetPager. +type VirtualMachineScaleSetsClientListByFleetResponse struct { + // The response of a VirtualMachineScaleSet list operation. + VirtualMachineScaleSetListResult +} diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/time_rfc3339.go b/sdk/resourcemanager/computefleet/armcomputefleet/time_rfc3339.go new file mode 100644 index 000000000000..62438fce0f64 --- /dev/null +++ b/sdk/resourcemanager/computefleet/armcomputefleet/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcomputefleet + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/virtualmachinescalesets_client.go b/sdk/resourcemanager/computefleet/armcomputefleet/virtualmachinescalesets_client.go new file mode 100644 index 000000000000..27efe2e20ec1 --- /dev/null +++ b/sdk/resourcemanager/computefleet/armcomputefleet/virtualmachinescalesets_client.go @@ -0,0 +1,109 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcomputefleet + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VirtualMachineScaleSetsClient contains the methods for the VirtualMachineScaleSets group. +// Don't use this type directly, use NewVirtualMachineScaleSetsClient() instead. +type VirtualMachineScaleSetsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewVirtualMachineScaleSetsClient creates a new instance of VirtualMachineScaleSetsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewVirtualMachineScaleSetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualMachineScaleSetsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualMachineScaleSetsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListByFleetPager - List VirtualMachineScaleSet resources by Fleet +// +// Generated from API version 2024-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - name - The name of the Fleet +// - options - VirtualMachineScaleSetsClientListByFleetOptions contains the optional parameters for the VirtualMachineScaleSetsClient.NewListByFleetPager +// method. +func (client *VirtualMachineScaleSetsClient) NewListByFleetPager(resourceGroupName string, name string, options *VirtualMachineScaleSetsClientListByFleetOptions) *runtime.Pager[VirtualMachineScaleSetsClientListByFleetResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualMachineScaleSetsClientListByFleetResponse]{ + More: func(page VirtualMachineScaleSetsClientListByFleetResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualMachineScaleSetsClientListByFleetResponse) (VirtualMachineScaleSetsClientListByFleetResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VirtualMachineScaleSetsClient.NewListByFleetPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByFleetCreateRequest(ctx, resourceGroupName, name, options) + }, nil) + if err != nil { + return VirtualMachineScaleSetsClientListByFleetResponse{}, err + } + return client.listByFleetHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByFleetCreateRequest creates the ListByFleet request. +func (client *VirtualMachineScaleSetsClient) listByFleetCreateRequest(ctx context.Context, resourceGroupName string, name string, options *VirtualMachineScaleSetsClientListByFleetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureFleet/fleets/{name}/virtualMachineScaleSets" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByFleetHandleResponse handles the ListByFleet response. +func (client *VirtualMachineScaleSetsClient) listByFleetHandleResponse(resp *http.Response) (VirtualMachineScaleSetsClientListByFleetResponse, error) { + result := VirtualMachineScaleSetsClientListByFleetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetListResult); err != nil { + return VirtualMachineScaleSetsClientListByFleetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/CHANGELOG.md b/sdk/resourcemanager/mongocluster/armmongocluster/CHANGELOG.md new file mode 100644 index 000000000000..d6b62e2cd30a --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/CHANGELOG.md @@ -0,0 +1,7 @@ +# Release History + +## 0.1.0 (2024-06-13) + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/LICENSE.txt b/sdk/resourcemanager/mongocluster/armmongocluster/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/README.md b/sdk/resourcemanager/mongocluster/armmongocluster/README.md new file mode 100644 index 000000000000..7f9ab7b5801e --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/README.md @@ -0,0 +1,92 @@ +# Azure Mongocluster Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster) + +The `armmongocluster` module provides operations for working with Azure Mongocluster. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/mongocluster/armmongocluster) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).) + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Mongocluster module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Mongocluster. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Client Factory + +Azure Mongocluster module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armmongocluster.NewClientFactory(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +clientFactory, err := armmongocluster.NewClientFactory(, cred, &options) +``` + +## Clients + +A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. + +```go +client := clientFactory.NewFirewallRulesClient() +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Mongocluster` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/autorest.md b/sdk/resourcemanager/mongocluster/armmongocluster/autorest.md new file mode 100644 index 000000000000..e2ea9f5eaf12 --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/autorest.md @@ -0,0 +1,13 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +azure-arm: true +require: +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/mongocluster/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/mongocluster/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 0.1.0 + +``` \ No newline at end of file diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/build.go b/sdk/resourcemanager/mongocluster/armmongocluster/build.go new file mode 100644 index 000000000000..4b6cf8d90d18 --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/build.go @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file enables 'go generate' to regenerate this specific SDK +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -alwaysSetBodyParamRequired -removeUnreferencedTypes resourcemanager/mongocluster/armmongocluster + +package armmongocluster diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/ci.yml b/sdk/resourcemanager/mongocluster/armmongocluster/ci.yml new file mode 100644 index 000000000000..e1668f9aada5 --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/ci.yml @@ -0,0 +1,28 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/mongocluster/armmongocluster/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/mongocluster/armmongocluster/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/mongocluster/armmongocluster' diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/client_factory.go b/sdk/resourcemanager/mongocluster/armmongocluster/client_factory.go new file mode 100644 index 000000000000..7efba05f3a0e --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/client_factory.go @@ -0,0 +1,76 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmongocluster + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + internal *arm.Client +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, + internal: internal, + }, nil +} + +// NewFirewallRulesClient creates a new instance of FirewallRulesClient. +func (c *ClientFactory) NewFirewallRulesClient() *FirewallRulesClient { + return &FirewallRulesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewMongoClustersClient creates a new instance of MongoClustersClient. +func (c *ClientFactory) NewMongoClustersClient() *MongoClustersClient { + return &MongoClustersClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + return &OperationsClient{ + internal: c.internal, + } +} + +// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient. +func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { + return &PrivateEndpointConnectionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewPrivateLinksClient creates a new instance of PrivateLinksClient. +func (c *ClientFactory) NewPrivateLinksClient() *PrivateLinksClient { + return &PrivateLinksClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/constants.go b/sdk/resourcemanager/mongocluster/armmongocluster/constants.go new file mode 100644 index 000000000000..a5699fe76553 --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/constants.go @@ -0,0 +1,236 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmongocluster + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster" + moduleVersion = "v0.1.0" +) + +// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + +// CheckNameAvailabilityReason - The reason why the given name is not available. +type CheckNameAvailabilityReason string + +const ( + CheckNameAvailabilityReasonAlreadyExists CheckNameAvailabilityReason = "AlreadyExists" + CheckNameAvailabilityReasonInvalid CheckNameAvailabilityReason = "Invalid" +) + +// PossibleCheckNameAvailabilityReasonValues returns the possible values for the CheckNameAvailabilityReason const type. +func PossibleCheckNameAvailabilityReasonValues() []CheckNameAvailabilityReason { + return []CheckNameAvailabilityReason{ + CheckNameAvailabilityReasonAlreadyExists, + CheckNameAvailabilityReasonInvalid, + } +} + +// CreateMode - The mode that the Mongo Cluster is created with. +type CreateMode string + +const ( + // CreateModeDefault - Create a new mongo cluster. + CreateModeDefault CreateMode = "Default" + // CreateModePointInTimeRestore - Create a mongo cluster from a restore point-in-time. + CreateModePointInTimeRestore CreateMode = "PointInTimeRestore" +) + +// PossibleCreateModeValues returns the possible values for the CreateMode const type. +func PossibleCreateModeValues() []CreateMode { + return []CreateMode{ + CreateModeDefault, + CreateModePointInTimeRestore, + } +} + +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// MongoClusterStatus - The status of the Mongo cluster resource. +type MongoClusterStatus string + +const ( + // MongoClusterStatusDropping - The mongo cluster resource is being dropped. + MongoClusterStatusDropping MongoClusterStatus = "Dropping" + // MongoClusterStatusProvisioning - The mongo cluster resource is being provisioned. + MongoClusterStatusProvisioning MongoClusterStatus = "Provisioning" + // MongoClusterStatusReady - The mongo cluster resource is ready for use. + MongoClusterStatusReady MongoClusterStatus = "Ready" + // MongoClusterStatusStarting - The mongo cluster resource is being started. + MongoClusterStatusStarting MongoClusterStatus = "Starting" + // MongoClusterStatusStopped - The mongo cluster resource is stopped. + MongoClusterStatusStopped MongoClusterStatus = "Stopped" + // MongoClusterStatusStopping - The mongo cluster resource is being stopped. + MongoClusterStatusStopping MongoClusterStatus = "Stopping" + // MongoClusterStatusUpdating - The mongo cluster resource is being updated. + MongoClusterStatusUpdating MongoClusterStatus = "Updating" +) + +// PossibleMongoClusterStatusValues returns the possible values for the MongoClusterStatus const type. +func PossibleMongoClusterStatusValues() []MongoClusterStatus { + return []MongoClusterStatus{ + MongoClusterStatusDropping, + MongoClusterStatusProvisioning, + MongoClusterStatusReady, + MongoClusterStatusStarting, + MongoClusterStatusStopped, + MongoClusterStatusStopping, + MongoClusterStatusUpdating, + } +} + +// NodeKind - The kind of the node on the cluster. +type NodeKind string + +const ( + // NodeKindShard - The node is a shard kind. + NodeKindShard NodeKind = "Shard" +) + +// PossibleNodeKindValues returns the possible values for the NodeKind const type. +func PossibleNodeKindValues() []NodeKind { + return []NodeKind{ + NodeKindShard, + } +} + +// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default +// value is "user,system" +type Origin string + +const ( + OriginSystem Origin = "system" + OriginUser Origin = "user" + OriginUserSystem Origin = "user,system" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + +// PrivateEndpointConnectionProvisioningState - The current provisioning state. +type PrivateEndpointConnectionProvisioningState string + +const ( + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" +) + +// PossiblePrivateEndpointConnectionProvisioningStateValues returns the possible values for the PrivateEndpointConnectionProvisioningState const type. +func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { + return []PrivateEndpointConnectionProvisioningState{ + PrivateEndpointConnectionProvisioningStateCreating, + PrivateEndpointConnectionProvisioningStateDeleting, + PrivateEndpointConnectionProvisioningStateFailed, + PrivateEndpointConnectionProvisioningStateSucceeded, + } +} + +// PrivateEndpointServiceConnectionStatus - The private endpoint connection status. +type PrivateEndpointServiceConnectionStatus string + +const ( + PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" + PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" +) + +// PossiblePrivateEndpointServiceConnectionStatusValues returns the possible values for the PrivateEndpointServiceConnectionStatus const type. +func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointServiceConnectionStatus { + return []PrivateEndpointServiceConnectionStatus{ + PrivateEndpointServiceConnectionStatusApproved, + PrivateEndpointServiceConnectionStatusPending, + PrivateEndpointServiceConnectionStatusRejected, + } +} + +// ProvisioningState - The provisioning state of the last accepted operation. +type ProvisioningState string + +const ( + // ProvisioningStateCanceled - Resource creation was canceled. + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateDropping - A drop operation is in-progress on the resource. + ProvisioningStateDropping ProvisioningState = "Dropping" + // ProvisioningStateFailed - Resource creation failed. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateInProgress - An operation is in-progress on the resource. + ProvisioningStateInProgress ProvisioningState = "InProgress" + // ProvisioningStateSucceeded - Resource has been created. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating - An update operation is in-progress on the resource. + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateCanceled, + ProvisioningStateDropping, + ProvisioningStateFailed, + ProvisioningStateInProgress, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + } +} + +// PublicNetworkAccess - Whether or not public endpoint access is allowed for this Mongo cluster. Value is optional and default +// value is 'Enabled' +type PublicNetworkAccess string + +const ( + // PublicNetworkAccessDisabled - If set, the private endpoints are the exclusive access method. + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + // PublicNetworkAccessEnabled - If set, mongo cluster can be accessed through private and public methods. + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +// PossiblePublicNetworkAccessValues returns the possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{ + PublicNetworkAccessDisabled, + PublicNetworkAccessEnabled, + } +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/fake/firewallrules_server.go b/sdk/resourcemanager/mongocluster/armmongocluster/fake/firewallrules_server.go new file mode 100644 index 000000000000..5e8bbbea674f --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/fake/firewallrules_server.go @@ -0,0 +1,272 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster" + "net/http" + "net/url" + "regexp" +) + +// FirewallRulesServer is a fake server for instances of the armmongocluster.FirewallRulesClient type. +type FirewallRulesServer struct { + // BeginCreateOrUpdate is the fake for method FirewallRulesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated, http.StatusAccepted + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, mongoClusterName string, firewallRuleName string, resource armmongocluster.FirewallRule, options *armmongocluster.FirewallRulesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armmongocluster.FirewallRulesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method FirewallRulesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, mongoClusterName string, firewallRuleName string, options *armmongocluster.FirewallRulesClientBeginDeleteOptions) (resp azfake.PollerResponder[armmongocluster.FirewallRulesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method FirewallRulesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, mongoClusterName string, firewallRuleName string, options *armmongocluster.FirewallRulesClientGetOptions) (resp azfake.Responder[armmongocluster.FirewallRulesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByMongoClusterPager is the fake for method FirewallRulesClient.NewListByMongoClusterPager + // HTTP status codes to indicate success: http.StatusOK + NewListByMongoClusterPager func(resourceGroupName string, mongoClusterName string, options *armmongocluster.FirewallRulesClientListByMongoClusterOptions) (resp azfake.PagerResponder[armmongocluster.FirewallRulesClientListByMongoClusterResponse]) +} + +// NewFirewallRulesServerTransport creates a new instance of FirewallRulesServerTransport with the provided implementation. +// The returned FirewallRulesServerTransport instance is connected to an instance of armmongocluster.FirewallRulesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewFirewallRulesServerTransport(srv *FirewallRulesServer) *FirewallRulesServerTransport { + return &FirewallRulesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armmongocluster.FirewallRulesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armmongocluster.FirewallRulesClientDeleteResponse]](), + newListByMongoClusterPager: newTracker[azfake.PagerResponder[armmongocluster.FirewallRulesClientListByMongoClusterResponse]](), + } +} + +// FirewallRulesServerTransport connects instances of armmongocluster.FirewallRulesClient to instances of FirewallRulesServer. +// Don't use this type directly, use NewFirewallRulesServerTransport instead. +type FirewallRulesServerTransport struct { + srv *FirewallRulesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armmongocluster.FirewallRulesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armmongocluster.FirewallRulesClientDeleteResponse]] + newListByMongoClusterPager *tracker[azfake.PagerResponder[armmongocluster.FirewallRulesClientListByMongoClusterResponse]] +} + +// Do implements the policy.Transporter interface for FirewallRulesServerTransport. +func (f *FirewallRulesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "FirewallRulesClient.BeginCreateOrUpdate": + resp, err = f.dispatchBeginCreateOrUpdate(req) + case "FirewallRulesClient.BeginDelete": + resp, err = f.dispatchBeginDelete(req) + case "FirewallRulesClient.Get": + resp, err = f.dispatchGet(req) + case "FirewallRulesClient.NewListByMongoClusterPager": + resp, err = f.dispatchNewListByMongoClusterPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (f *FirewallRulesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if f.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := f.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/firewallRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmongocluster.FirewallRule](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + mongoClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("mongoClusterName")]) + if err != nil { + return nil, err + } + firewallRuleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("firewallRuleName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, mongoClusterNameParam, firewallRuleNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + f.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { + f.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + f.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (f *FirewallRulesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if f.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := f.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/firewallRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + mongoClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("mongoClusterName")]) + if err != nil { + return nil, err + } + firewallRuleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("firewallRuleName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginDelete(req.Context(), resourceGroupNameParam, mongoClusterNameParam, firewallRuleNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + f.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + f.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + f.beginDelete.remove(req) + } + + return resp, nil +} + +func (f *FirewallRulesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if f.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/firewallRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + mongoClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("mongoClusterName")]) + if err != nil { + return nil, err + } + firewallRuleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("firewallRuleName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.Get(req.Context(), resourceGroupNameParam, mongoClusterNameParam, firewallRuleNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).FirewallRule, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (f *FirewallRulesServerTransport) dispatchNewListByMongoClusterPager(req *http.Request) (*http.Response, error) { + if f.srv.NewListByMongoClusterPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByMongoClusterPager not implemented")} + } + newListByMongoClusterPager := f.newListByMongoClusterPager.get(req) + if newListByMongoClusterPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/firewallRules` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + mongoClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("mongoClusterName")]) + if err != nil { + return nil, err + } + resp := f.srv.NewListByMongoClusterPager(resourceGroupNameParam, mongoClusterNameParam, nil) + newListByMongoClusterPager = &resp + f.newListByMongoClusterPager.add(req, newListByMongoClusterPager) + server.PagerResponderInjectNextLinks(newListByMongoClusterPager, req, func(page *armmongocluster.FirewallRulesClientListByMongoClusterResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByMongoClusterPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + f.newListByMongoClusterPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByMongoClusterPager) { + f.newListByMongoClusterPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/fake/internal.go b/sdk/resourcemanager/mongocluster/armmongocluster/fake/internal.go new file mode 100644 index 000000000000..5f75802a569e --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/fake/internal.go @@ -0,0 +1,64 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "net/http" + "sync" +) + +type nonRetriableError struct { + error +} + +func (nonRetriableError) NonRetriable() { + // marker method +} + +func contains[T comparable](s []T, v T) bool { + for _, vv := range s { + if vv == v { + return true + } + } + return false +} + +func newTracker[T any]() *tracker[T] { + return &tracker[T]{ + items: map[string]*T{}, + } +} + +type tracker[T any] struct { + items map[string]*T + mu sync.Mutex +} + +func (p *tracker[T]) get(req *http.Request) *T { + p.mu.Lock() + defer p.mu.Unlock() + if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok { + return item + } + return nil +} + +func (p *tracker[T]) add(req *http.Request, item *T) { + p.mu.Lock() + defer p.mu.Unlock() + p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item +} + +func (p *tracker[T]) remove(req *http.Request) { + p.mu.Lock() + defer p.mu.Unlock() + delete(p.items, server.SanitizePagerPollerPath(req.URL.Path)) +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/fake/mongoclusters_server.go b/sdk/resourcemanager/mongocluster/armmongocluster/fake/mongoclusters_server.go new file mode 100644 index 000000000000..8cca92b323c3 --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/fake/mongoclusters_server.go @@ -0,0 +1,431 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster" + "net/http" + "net/url" + "regexp" +) + +// MongoClustersServer is a fake server for instances of the armmongocluster.MongoClustersClient type. +type MongoClustersServer struct { + // CheckNameAvailability is the fake for method MongoClustersClient.CheckNameAvailability + // HTTP status codes to indicate success: http.StatusOK + CheckNameAvailability func(ctx context.Context, location string, body armmongocluster.CheckNameAvailabilityRequest, options *armmongocluster.MongoClustersClientCheckNameAvailabilityOptions) (resp azfake.Responder[armmongocluster.MongoClustersClientCheckNameAvailabilityResponse], errResp azfake.ErrorResponder) + + // BeginCreateOrUpdate is the fake for method MongoClustersClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, mongoClusterName string, resource armmongocluster.MongoCluster, options *armmongocluster.MongoClustersClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armmongocluster.MongoClustersClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method MongoClustersClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, mongoClusterName string, options *armmongocluster.MongoClustersClientBeginDeleteOptions) (resp azfake.PollerResponder[armmongocluster.MongoClustersClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method MongoClustersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, mongoClusterName string, options *armmongocluster.MongoClustersClientGetOptions) (resp azfake.Responder[armmongocluster.MongoClustersClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method MongoClustersClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armmongocluster.MongoClustersClientListOptions) (resp azfake.PagerResponder[armmongocluster.MongoClustersClientListResponse]) + + // NewListByResourceGroupPager is the fake for method MongoClustersClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armmongocluster.MongoClustersClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmongocluster.MongoClustersClientListByResourceGroupResponse]) + + // ListConnectionStrings is the fake for method MongoClustersClient.ListConnectionStrings + // HTTP status codes to indicate success: http.StatusOK + ListConnectionStrings func(ctx context.Context, resourceGroupName string, mongoClusterName string, options *armmongocluster.MongoClustersClientListConnectionStringsOptions) (resp azfake.Responder[armmongocluster.MongoClustersClientListConnectionStringsResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method MongoClustersClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, mongoClusterName string, properties armmongocluster.Update, options *armmongocluster.MongoClustersClientBeginUpdateOptions) (resp azfake.PollerResponder[armmongocluster.MongoClustersClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewMongoClustersServerTransport creates a new instance of MongoClustersServerTransport with the provided implementation. +// The returned MongoClustersServerTransport instance is connected to an instance of armmongocluster.MongoClustersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewMongoClustersServerTransport(srv *MongoClustersServer) *MongoClustersServerTransport { + return &MongoClustersServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armmongocluster.MongoClustersClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armmongocluster.MongoClustersClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armmongocluster.MongoClustersClientListResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmongocluster.MongoClustersClientListByResourceGroupResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armmongocluster.MongoClustersClientUpdateResponse]](), + } +} + +// MongoClustersServerTransport connects instances of armmongocluster.MongoClustersClient to instances of MongoClustersServer. +// Don't use this type directly, use NewMongoClustersServerTransport instead. +type MongoClustersServerTransport struct { + srv *MongoClustersServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armmongocluster.MongoClustersClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armmongocluster.MongoClustersClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armmongocluster.MongoClustersClientListResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armmongocluster.MongoClustersClientListByResourceGroupResponse]] + beginUpdate *tracker[azfake.PollerResponder[armmongocluster.MongoClustersClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for MongoClustersServerTransport. +func (m *MongoClustersServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "MongoClustersClient.CheckNameAvailability": + resp, err = m.dispatchCheckNameAvailability(req) + case "MongoClustersClient.BeginCreateOrUpdate": + resp, err = m.dispatchBeginCreateOrUpdate(req) + case "MongoClustersClient.BeginDelete": + resp, err = m.dispatchBeginDelete(req) + case "MongoClustersClient.Get": + resp, err = m.dispatchGet(req) + case "MongoClustersClient.NewListPager": + resp, err = m.dispatchNewListPager(req) + case "MongoClustersClient.NewListByResourceGroupPager": + resp, err = m.dispatchNewListByResourceGroupPager(req) + case "MongoClustersClient.ListConnectionStrings": + resp, err = m.dispatchListConnectionStrings(req) + case "MongoClustersClient.BeginUpdate": + resp, err = m.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (m *MongoClustersServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { + if m.srv.CheckNameAvailability == nil { + return nil, &nonRetriableError{errors.New("fake for method CheckNameAvailability not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/checkMongoClusterNameAvailability` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmongocluster.CheckNameAvailabilityRequest](req) + if err != nil { + return nil, err + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.CheckNameAvailability(req.Context(), locationParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CheckNameAvailabilityResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *MongoClustersServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if m.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := m.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmongocluster.MongoCluster](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + mongoClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("mongoClusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, mongoClusterNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + m.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + m.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + m.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (m *MongoClustersServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if m.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := m.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + mongoClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("mongoClusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginDelete(req.Context(), resourceGroupNameParam, mongoClusterNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + m.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + m.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + m.beginDelete.remove(req) + } + + return resp, nil +} + +func (m *MongoClustersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if m.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + mongoClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("mongoClusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.Get(req.Context(), resourceGroupNameParam, mongoClusterNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MongoCluster, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *MongoClustersServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if m.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := m.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := m.srv.NewListPager(nil) + newListPager = &resp + m.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armmongocluster.MongoClustersClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + m.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + m.newListPager.remove(req) + } + return resp, nil +} + +func (m *MongoClustersServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if m.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := m.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := m.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + m.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armmongocluster.MongoClustersClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + m.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + m.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (m *MongoClustersServerTransport) dispatchListConnectionStrings(req *http.Request) (*http.Response, error) { + if m.srv.ListConnectionStrings == nil { + return nil, &nonRetriableError{errors.New("fake for method ListConnectionStrings not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listConnectionStrings` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + mongoClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("mongoClusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.ListConnectionStrings(req.Context(), resourceGroupNameParam, mongoClusterNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ListConnectionStringsResult, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *MongoClustersServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if m.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := m.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmongocluster.Update](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + mongoClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("mongoClusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginUpdate(req.Context(), resourceGroupNameParam, mongoClusterNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + m.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + m.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + m.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/fake/operations_server.go b/sdk/resourcemanager/mongocluster/armmongocluster/fake/operations_server.go new file mode 100644 index 000000000000..957d961a8713 --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/fake/operations_server.go @@ -0,0 +1,96 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster" + "net/http" +) + +// OperationsServer is a fake server for instances of the armmongocluster.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armmongocluster.OperationsClientListOptions) (resp azfake.PagerResponder[armmongocluster.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armmongocluster.OperationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { + return &OperationsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armmongocluster.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armmongocluster.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armmongocluster.OperationsClientListResponse]] +} + +// Do implements the policy.Transporter interface for OperationsServerTransport. +func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "OperationsClient.NewListPager": + resp, err = o.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := o.newListPager.get(req) + if newListPager == nil { + resp := o.srv.NewListPager(nil) + newListPager = &resp + o.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armmongocluster.OperationsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + o.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + o.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/fake/privateendpointconnections_server.go b/sdk/resourcemanager/mongocluster/armmongocluster/fake/privateendpointconnections_server.go new file mode 100644 index 000000000000..01d0e21918e0 --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/fake/privateendpointconnections_server.go @@ -0,0 +1,272 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster" + "net/http" + "net/url" + "regexp" +) + +// PrivateEndpointConnectionsServer is a fake server for instances of the armmongocluster.PrivateEndpointConnectionsClient type. +type PrivateEndpointConnectionsServer struct { + // BeginCreate is the fake for method PrivateEndpointConnectionsClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated, http.StatusAccepted + BeginCreate func(ctx context.Context, resourceGroupName string, mongoClusterName string, privateEndpointConnectionName string, resource armmongocluster.PrivateEndpointConnectionResource, options *armmongocluster.PrivateEndpointConnectionsClientBeginCreateOptions) (resp azfake.PollerResponder[armmongocluster.PrivateEndpointConnectionsClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method PrivateEndpointConnectionsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, mongoClusterName string, privateEndpointConnectionName string, options *armmongocluster.PrivateEndpointConnectionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armmongocluster.PrivateEndpointConnectionsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method PrivateEndpointConnectionsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, mongoClusterName string, privateEndpointConnectionName string, options *armmongocluster.PrivateEndpointConnectionsClientGetOptions) (resp azfake.Responder[armmongocluster.PrivateEndpointConnectionsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByMongoClusterPager is the fake for method PrivateEndpointConnectionsClient.NewListByMongoClusterPager + // HTTP status codes to indicate success: http.StatusOK + NewListByMongoClusterPager func(resourceGroupName string, mongoClusterName string, options *armmongocluster.PrivateEndpointConnectionsClientListByMongoClusterOptions) (resp azfake.PagerResponder[armmongocluster.PrivateEndpointConnectionsClientListByMongoClusterResponse]) +} + +// NewPrivateEndpointConnectionsServerTransport creates a new instance of PrivateEndpointConnectionsServerTransport with the provided implementation. +// The returned PrivateEndpointConnectionsServerTransport instance is connected to an instance of armmongocluster.PrivateEndpointConnectionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPrivateEndpointConnectionsServerTransport(srv *PrivateEndpointConnectionsServer) *PrivateEndpointConnectionsServerTransport { + return &PrivateEndpointConnectionsServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armmongocluster.PrivateEndpointConnectionsClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armmongocluster.PrivateEndpointConnectionsClientDeleteResponse]](), + newListByMongoClusterPager: newTracker[azfake.PagerResponder[armmongocluster.PrivateEndpointConnectionsClientListByMongoClusterResponse]](), + } +} + +// PrivateEndpointConnectionsServerTransport connects instances of armmongocluster.PrivateEndpointConnectionsClient to instances of PrivateEndpointConnectionsServer. +// Don't use this type directly, use NewPrivateEndpointConnectionsServerTransport instead. +type PrivateEndpointConnectionsServerTransport struct { + srv *PrivateEndpointConnectionsServer + beginCreate *tracker[azfake.PollerResponder[armmongocluster.PrivateEndpointConnectionsClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armmongocluster.PrivateEndpointConnectionsClientDeleteResponse]] + newListByMongoClusterPager *tracker[azfake.PagerResponder[armmongocluster.PrivateEndpointConnectionsClientListByMongoClusterResponse]] +} + +// Do implements the policy.Transporter interface for PrivateEndpointConnectionsServerTransport. +func (p *PrivateEndpointConnectionsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "PrivateEndpointConnectionsClient.BeginCreate": + resp, err = p.dispatchBeginCreate(req) + case "PrivateEndpointConnectionsClient.BeginDelete": + resp, err = p.dispatchBeginDelete(req) + case "PrivateEndpointConnectionsClient.Get": + resp, err = p.dispatchGet(req) + case "PrivateEndpointConnectionsClient.NewListByMongoClusterPager": + resp, err = p.dispatchNewListByMongoClusterPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if p.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := p.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmongocluster.PrivateEndpointConnectionResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + mongoClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("mongoClusterName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginCreate(req.Context(), resourceGroupNameParam, mongoClusterNameParam, privateEndpointConnectionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + p.beginCreate.add(req, beginCreate) + } + + resp, err := server.PollerResponderNext(beginCreate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { + p.beginCreate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreate) { + p.beginCreate.remove(req) + } + + return resp, nil +} + +func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if p.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := p.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + mongoClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("mongoClusterName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, mongoClusterNameParam, privateEndpointConnectionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + p.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + p.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + p.beginDelete.remove(req) + } + + return resp, nil +} + +func (p *PrivateEndpointConnectionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + mongoClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("mongoClusterName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, mongoClusterNameParam, privateEndpointConnectionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnectionResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PrivateEndpointConnectionsServerTransport) dispatchNewListByMongoClusterPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListByMongoClusterPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByMongoClusterPager not implemented")} + } + newListByMongoClusterPager := p.newListByMongoClusterPager.get(req) + if newListByMongoClusterPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + mongoClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("mongoClusterName")]) + if err != nil { + return nil, err + } + resp := p.srv.NewListByMongoClusterPager(resourceGroupNameParam, mongoClusterNameParam, nil) + newListByMongoClusterPager = &resp + p.newListByMongoClusterPager.add(req, newListByMongoClusterPager) + server.PagerResponderInjectNextLinks(newListByMongoClusterPager, req, func(page *armmongocluster.PrivateEndpointConnectionsClientListByMongoClusterResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByMongoClusterPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListByMongoClusterPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByMongoClusterPager) { + p.newListByMongoClusterPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/fake/privatelinks_server.go b/sdk/resourcemanager/mongocluster/armmongocluster/fake/privatelinks_server.go new file mode 100644 index 000000000000..7aaae6415ebb --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/fake/privatelinks_server.go @@ -0,0 +1,112 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster" + "net/http" + "net/url" + "regexp" +) + +// PrivateLinksServer is a fake server for instances of the armmongocluster.PrivateLinksClient type. +type PrivateLinksServer struct { + // NewListByMongoClusterPager is the fake for method PrivateLinksClient.NewListByMongoClusterPager + // HTTP status codes to indicate success: http.StatusOK + NewListByMongoClusterPager func(resourceGroupName string, mongoClusterName string, options *armmongocluster.PrivateLinksClientListByMongoClusterOptions) (resp azfake.PagerResponder[armmongocluster.PrivateLinksClientListByMongoClusterResponse]) +} + +// NewPrivateLinksServerTransport creates a new instance of PrivateLinksServerTransport with the provided implementation. +// The returned PrivateLinksServerTransport instance is connected to an instance of armmongocluster.PrivateLinksClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPrivateLinksServerTransport(srv *PrivateLinksServer) *PrivateLinksServerTransport { + return &PrivateLinksServerTransport{ + srv: srv, + newListByMongoClusterPager: newTracker[azfake.PagerResponder[armmongocluster.PrivateLinksClientListByMongoClusterResponse]](), + } +} + +// PrivateLinksServerTransport connects instances of armmongocluster.PrivateLinksClient to instances of PrivateLinksServer. +// Don't use this type directly, use NewPrivateLinksServerTransport instead. +type PrivateLinksServerTransport struct { + srv *PrivateLinksServer + newListByMongoClusterPager *tracker[azfake.PagerResponder[armmongocluster.PrivateLinksClientListByMongoClusterResponse]] +} + +// Do implements the policy.Transporter interface for PrivateLinksServerTransport. +func (p *PrivateLinksServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "PrivateLinksClient.NewListByMongoClusterPager": + resp, err = p.dispatchNewListByMongoClusterPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *PrivateLinksServerTransport) dispatchNewListByMongoClusterPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListByMongoClusterPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByMongoClusterPager not implemented")} + } + newListByMongoClusterPager := p.newListByMongoClusterPager.get(req) + if newListByMongoClusterPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + mongoClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("mongoClusterName")]) + if err != nil { + return nil, err + } + resp := p.srv.NewListByMongoClusterPager(resourceGroupNameParam, mongoClusterNameParam, nil) + newListByMongoClusterPager = &resp + p.newListByMongoClusterPager.add(req, newListByMongoClusterPager) + server.PagerResponderInjectNextLinks(newListByMongoClusterPager, req, func(page *armmongocluster.PrivateLinksClientListByMongoClusterResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByMongoClusterPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListByMongoClusterPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByMongoClusterPager) { + p.newListByMongoClusterPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/fake/server_factory.go b/sdk/resourcemanager/mongocluster/armmongocluster/fake/server_factory.go new file mode 100644 index 000000000000..ad55bbfb1d7a --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/fake/server_factory.go @@ -0,0 +1,101 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" + "sync" +) + +// ServerFactory is a fake server for instances of the armmongocluster.ClientFactory type. +type ServerFactory struct { + FirewallRulesServer FirewallRulesServer + MongoClustersServer MongoClustersServer + OperationsServer OperationsServer + PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer + PrivateLinksServer PrivateLinksServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armmongocluster.ClientFactory via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { + return &ServerFactoryTransport{ + srv: srv, + } +} + +// ServerFactoryTransport connects instances of armmongocluster.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trFirewallRulesServer *FirewallRulesServerTransport + trMongoClustersServer *MongoClustersServerTransport + trOperationsServer *OperationsServerTransport + trPrivateEndpointConnectionsServer *PrivateEndpointConnectionsServerTransport + trPrivateLinksServer *PrivateLinksServerTransport +} + +// Do implements the policy.Transporter interface for ServerFactoryTransport. +func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + client := method[:strings.Index(method, ".")] + var resp *http.Response + var err error + + switch client { + case "FirewallRulesClient": + initServer(s, &s.trFirewallRulesServer, func() *FirewallRulesServerTransport { + return NewFirewallRulesServerTransport(&s.srv.FirewallRulesServer) + }) + resp, err = s.trFirewallRulesServer.Do(req) + case "MongoClustersClient": + initServer(s, &s.trMongoClustersServer, func() *MongoClustersServerTransport { + return NewMongoClustersServerTransport(&s.srv.MongoClustersServer) + }) + resp, err = s.trMongoClustersServer.Do(req) + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + case "PrivateEndpointConnectionsClient": + initServer(s, &s.trPrivateEndpointConnectionsServer, func() *PrivateEndpointConnectionsServerTransport { + return NewPrivateEndpointConnectionsServerTransport(&s.srv.PrivateEndpointConnectionsServer) + }) + resp, err = s.trPrivateEndpointConnectionsServer.Do(req) + case "PrivateLinksClient": + initServer(s, &s.trPrivateLinksServer, func() *PrivateLinksServerTransport { return NewPrivateLinksServerTransport(&s.srv.PrivateLinksServer) }) + resp, err = s.trPrivateLinksServer.Do(req) + default: + err = fmt.Errorf("unhandled client %s", client) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { + s.trMu.Lock() + if *dst == nil { + *dst = src() + } + s.trMu.Unlock() +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/fake/time_rfc3339.go b/sdk/resourcemanager/mongocluster/armmongocluster/fake/time_rfc3339.go new file mode 100644 index 000000000000..81f308b0d343 --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/fake/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/firewallrules_client.go b/sdk/resourcemanager/mongocluster/armmongocluster/firewallrules_client.go new file mode 100644 index 000000000000..dfa9dbd0a5d2 --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/firewallrules_client.go @@ -0,0 +1,346 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmongocluster + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// FirewallRulesClient contains the methods for the FirewallRules group. +// Don't use this type directly, use NewFirewallRulesClient() instead. +type FirewallRulesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewFirewallRulesClient creates a new instance of FirewallRulesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewFirewallRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FirewallRulesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FirewallRulesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - mongoClusterName - The name of the mongo cluster. +// - firewallRuleName - The name of the mongo cluster firewall rule. +// - resource - Resource create parameters. +// - options - FirewallRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the FirewallRulesClient.BeginCreateOrUpdate +// method. +func (client *FirewallRulesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, mongoClusterName string, firewallRuleName string, resource FirewallRule, options *FirewallRulesClientBeginCreateOrUpdateOptions) (*runtime.Poller[FirewallRulesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, mongoClusterName, firewallRuleName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FirewallRulesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FirewallRulesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-01-preview +func (client *FirewallRulesClient) createOrUpdate(ctx context.Context, resourceGroupName string, mongoClusterName string, firewallRuleName string, resource FirewallRule, options *FirewallRulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "FirewallRulesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, mongoClusterName, firewallRuleName, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *FirewallRulesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, mongoClusterName string, firewallRuleName string, resource FirewallRule, options *FirewallRulesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if mongoClusterName == "" { + return nil, errors.New("parameter mongoClusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{mongoClusterName}", url.PathEscape(mongoClusterName)) + if firewallRuleName == "" { + return nil, errors.New("parameter firewallRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallRuleName}", url.PathEscape(firewallRuleName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a mongo cluster firewall rule. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - mongoClusterName - The name of the mongo cluster. +// - firewallRuleName - The name of the mongo cluster firewall rule. +// - options - FirewallRulesClientBeginDeleteOptions contains the optional parameters for the FirewallRulesClient.BeginDelete +// method. +func (client *FirewallRulesClient) BeginDelete(ctx context.Context, resourceGroupName string, mongoClusterName string, firewallRuleName string, options *FirewallRulesClientBeginDeleteOptions) (*runtime.Poller[FirewallRulesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, mongoClusterName, firewallRuleName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FirewallRulesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FirewallRulesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a mongo cluster firewall rule. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-01-preview +func (client *FirewallRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, mongoClusterName string, firewallRuleName string, options *FirewallRulesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "FirewallRulesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, mongoClusterName, firewallRuleName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *FirewallRulesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, mongoClusterName string, firewallRuleName string, options *FirewallRulesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if mongoClusterName == "" { + return nil, errors.New("parameter mongoClusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{mongoClusterName}", url.PathEscape(mongoClusterName)) + if firewallRuleName == "" { + return nil, errors.New("parameter firewallRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallRuleName}", url.PathEscape(firewallRuleName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets information about a mongo cluster firewall rule. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - mongoClusterName - The name of the mongo cluster. +// - firewallRuleName - The name of the mongo cluster firewall rule. +// - options - FirewallRulesClientGetOptions contains the optional parameters for the FirewallRulesClient.Get method. +func (client *FirewallRulesClient) Get(ctx context.Context, resourceGroupName string, mongoClusterName string, firewallRuleName string, options *FirewallRulesClientGetOptions) (FirewallRulesClientGetResponse, error) { + var err error + const operationName = "FirewallRulesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, mongoClusterName, firewallRuleName, options) + if err != nil { + return FirewallRulesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FirewallRulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FirewallRulesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *FirewallRulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, mongoClusterName string, firewallRuleName string, options *FirewallRulesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if mongoClusterName == "" { + return nil, errors.New("parameter mongoClusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{mongoClusterName}", url.PathEscape(mongoClusterName)) + if firewallRuleName == "" { + return nil, errors.New("parameter firewallRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallRuleName}", url.PathEscape(firewallRuleName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FirewallRulesClient) getHandleResponse(resp *http.Response) (FirewallRulesClientGetResponse, error) { + result := FirewallRulesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FirewallRule); err != nil { + return FirewallRulesClientGetResponse{}, err + } + return result, nil +} + +// NewListByMongoClusterPager - List all the firewall rules in a given mongo cluster. +// +// Generated from API version 2024-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - mongoClusterName - The name of the mongo cluster. +// - options - FirewallRulesClientListByMongoClusterOptions contains the optional parameters for the FirewallRulesClient.NewListByMongoClusterPager +// method. +func (client *FirewallRulesClient) NewListByMongoClusterPager(resourceGroupName string, mongoClusterName string, options *FirewallRulesClientListByMongoClusterOptions) *runtime.Pager[FirewallRulesClientListByMongoClusterResponse] { + return runtime.NewPager(runtime.PagingHandler[FirewallRulesClientListByMongoClusterResponse]{ + More: func(page FirewallRulesClientListByMongoClusterResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FirewallRulesClientListByMongoClusterResponse) (FirewallRulesClientListByMongoClusterResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "FirewallRulesClient.NewListByMongoClusterPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByMongoClusterCreateRequest(ctx, resourceGroupName, mongoClusterName, options) + }, nil) + if err != nil { + return FirewallRulesClientListByMongoClusterResponse{}, err + } + return client.listByMongoClusterHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByMongoClusterCreateRequest creates the ListByMongoCluster request. +func (client *FirewallRulesClient) listByMongoClusterCreateRequest(ctx context.Context, resourceGroupName string, mongoClusterName string, options *FirewallRulesClientListByMongoClusterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if mongoClusterName == "" { + return nil, errors.New("parameter mongoClusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{mongoClusterName}", url.PathEscape(mongoClusterName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByMongoClusterHandleResponse handles the ListByMongoCluster response. +func (client *FirewallRulesClient) listByMongoClusterHandleResponse(resp *http.Response) (FirewallRulesClientListByMongoClusterResponse, error) { + result := FirewallRulesClientListByMongoClusterResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FirewallRuleListResult); err != nil { + return FirewallRulesClientListByMongoClusterResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/go.mod b/sdk/resourcemanager/mongocluster/armmongocluster/go.mod new file mode 100644 index 000000000000..cf6fdb6f1ad1 --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/go.mod @@ -0,0 +1,11 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster + +go 1.18 + +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/text v0.14.0 // indirect +) diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/go.sum b/sdk/resourcemanager/mongocluster/armmongocluster/go.sum new file mode 100644 index 000000000000..03ce617a1873 --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/go.sum @@ -0,0 +1,12 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 h1:c4k2FIYIh4xtwqrQwV0Ct1v5+ehlNXj5NI/MWVsiTkQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2/go.mod h1:5FDJtLEO/GxwNgUxbwrY3LP0pEoThTQJtk2oysdXHxM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 h1:LqbJ/WzJUwBf8UiaSzgX7aMclParm9/5Vgp+TY51uBQ= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2/go.mod h1:yInRyqWXAuaPrgI7p70+lDDgh3mlBohis29jGMISnmc= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/models.go b/sdk/resourcemanager/mongocluster/armmongocluster/models.go new file mode 100644 index 000000000000..6037a662c5a3 --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/models.go @@ -0,0 +1,402 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmongocluster + +import "time" + +// CheckNameAvailabilityRequest - The check availability request body. +type CheckNameAvailabilityRequest struct { + // The name of the resource for which availability needs to be checked. + Name *string + + // The resource type. + Type *string +} + +// CheckNameAvailabilityResponse - The check availability result. +type CheckNameAvailabilityResponse struct { + // Detailed reason why the given name is available. + Message *string + + // Indicates if the resource name is available. + NameAvailable *bool + + // The reason why the given name is not available. + Reason *CheckNameAvailabilityReason +} + +// ConnectionString - Connection string for the mongo cluster +type ConnectionString struct { + // READ-ONLY; Value of the connection string + ConnectionString *string + + // READ-ONLY; Description of the connection string + Description *string +} + +// FirewallRule - Represents a mongo cluster firewall rule. +type FirewallRule struct { + // The resource-specific properties for this resource. + Properties *FirewallRuleProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// FirewallRuleListResult - The response of a FirewallRule list operation. +type FirewallRuleListResult struct { + // REQUIRED; The FirewallRule items on this page + Value []*FirewallRule + + // The link to the next page of items + NextLink *string +} + +// FirewallRuleProperties - The properties of a mongo cluster firewall rule. +type FirewallRuleProperties struct { + // REQUIRED; The end IP address of the mongo cluster firewall rule. Must be IPv4 format. + EndIPAddress *string + + // REQUIRED; The start IP address of the mongo cluster firewall rule. Must be IPv4 format. + StartIPAddress *string + + // READ-ONLY; The provisioning state of the firewall rule. + ProvisioningState *ProvisioningState +} + +// ListConnectionStringsResult - The connection strings for the given mongo cluster. +type ListConnectionStringsResult struct { + // READ-ONLY; An array that contains the connection strings for a mongo cluster. + ConnectionStrings []*ConnectionString +} + +// ListResult - The response of a MongoCluster list operation. +type ListResult struct { + // REQUIRED; The MongoCluster items on this page + Value []*MongoCluster + + // The link to the next page of items + NextLink *string +} + +// MongoCluster - Represents a mongo cluster resource. +type MongoCluster struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *Properties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// NodeGroupSpec - Specification for a node group. +type NodeGroupSpec struct { + // The disk storage size for the node group in GB. Example values: 128, 256, 512, 1024. + DiskSizeGB *int64 + + // Whether high availability is enabled on the node group. + EnableHa *bool + + // The node type deployed in the node group. + Kind *NodeKind + + // The number of nodes in the node group. + NodeCount *int32 + + // The resource sku for the node group. This defines the size of CPU and memory that is provisioned for each node. Example + // values: 'M30', 'M40'. + SKU *string +} + +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane + // operations. + IsDataAction *bool + + // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", + // "Microsoft.Compute/virtualMachines/capture/action" + Name *string + + // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + // value is "user,system" + Origin *Origin +} + +// OperationDisplay - Localized display information for this particular operation. +type OperationDisplay struct { + // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. + Description *string + + // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + // Machine", "Restart Virtual Machine". + Operation *string + + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". + Provider *string + + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". + Resource *string +} + +// OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to +// get the next set of results. +type OperationListResult struct { + // READ-ONLY; URL to get the next set of operation list results (if there are any). + NextLink *string + + // READ-ONLY; List of operations supported by the resource provider + Value []*Operation +} + +// PrivateEndpoint - The private endpoint resource. +type PrivateEndpoint struct { + // READ-ONLY; The ARM identifier for private endpoint. + ID *string +} + +// PrivateEndpointConnection - The private endpoint connection resource. +type PrivateEndpointConnection struct { + // Resource properties. + Properties *PrivateEndpointConnectionProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// PrivateEndpointConnectionProperties - Properties of the private endpoint connection. +type PrivateEndpointConnectionProperties struct { + // REQUIRED; A collection of information about the state of the connection between service consumer and provider. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState + + // The private endpoint resource. + PrivateEndpoint *PrivateEndpoint + + // READ-ONLY; The group ids for the private endpoint resource. + GroupIDs []*string + + // READ-ONLY; The provisioning state of the private endpoint connection resource. + ProvisioningState *PrivateEndpointConnectionProvisioningState +} + +// PrivateEndpointConnectionResource - Concrete proxy resource types can be created by aliasing this type using a specific +// property type. +type PrivateEndpointConnectionResource struct { + // The resource-specific properties for this resource. + Properties *PrivateEndpointConnectionProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// PrivateEndpointConnectionResourceListResult - The response of a PrivateEndpointConnectionResource list operation. +type PrivateEndpointConnectionResourceListResult struct { + // REQUIRED; The PrivateEndpointConnectionResource items on this page + Value []*PrivateEndpointConnectionResource + + // The link to the next page of items + NextLink *string +} + +// PrivateLinkResource - Concrete proxy resource types can be created by aliasing this type using a specific property type. +type PrivateLinkResource struct { + // The resource-specific properties for this resource. + Properties *PrivateLinkResourceProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// PrivateLinkResourceListResult - The response of a PrivateLinkResource list operation. +type PrivateLinkResourceListResult struct { + // REQUIRED; The PrivateLinkResource items on this page + Value []*PrivateLinkResource + + // The link to the next page of items + NextLink *string +} + +// PrivateLinkResourceProperties - Properties of a private link resource. +type PrivateLinkResourceProperties struct { + // The private link resource private link DNS zone name. + RequiredZoneNames []*string + + // READ-ONLY; The private link resource group id. + GroupID *string + + // READ-ONLY; The private link resource required member names. + RequiredMembers []*string +} + +// PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer +// and provider. +type PrivateLinkServiceConnectionState struct { + // A message indicating if changes on the service provider require any updates on the consumer. + ActionsRequired *string + + // The reason for approval/rejection of the connection. + Description *string + + // Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + Status *PrivateEndpointServiceConnectionStatus +} + +// Properties - The properties of a mongo cluster. +type Properties struct { + // The administrator's login for the mongo cluster. + AdministratorLogin *string + + // The password of the administrator login. + AdministratorLoginPassword *string + + // The mode to create a mongo cluster. + CreateMode *CreateMode + + // The list of node group specs in the cluster. + NodeGroupSpecs []*NodeGroupSpec + + // Whether or not public endpoint access is allowed for this mongo cluster. + PublicNetworkAccess *PublicNetworkAccess + + // The parameters to create a point-in-time restore mongo cluster. + RestoreParameters *RestoreParameters + + // The Mongo DB server version. Defaults to the latest available version if not specified. + ServerVersion *string + + // READ-ONLY; The status of the mongo cluster. + ClusterStatus *MongoClusterStatus + + // READ-ONLY; The default mongo connection string for the cluster. + ConnectionString *string + + // READ-ONLY; Earliest restore timestamp in UTC ISO8601 format. + EarliestRestoreTime *string + + // READ-ONLY; List of private endpoint connections. + PrivateEndpointConnections []*PrivateEndpointConnection + + // READ-ONLY; The provisioning state of the mongo cluster. + ProvisioningState *ProvisioningState +} + +// RestoreParameters - Parameters used for restore operations +type RestoreParameters struct { + // UTC point in time to restore a mongo cluster + PointInTimeUTC *time.Time + + // Resource ID to locate the source cluster to restore + SourceResourceID *string +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // The identity that created the resource. + CreatedBy *string + + // The type of identity that created the resource. + CreatedByType *CreatedByType + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time + + // The identity that last modified the resource. + LastModifiedBy *string + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType +} + +// Update - The type used for update operations of the MongoCluster. +type Update struct { + // The updatable properties of the MongoCluster. + Properties *UpdateProperties + + // Resource tags. + Tags map[string]*string +} + +// UpdateProperties - The updatable properties of the MongoCluster. +type UpdateProperties struct { + // The administrator's login for the mongo cluster. + AdministratorLogin *string + + // The password of the administrator login. + AdministratorLoginPassword *string + + // The list of node group specs in the cluster. + NodeGroupSpecs []*NodeGroupSpec + + // Whether or not public endpoint access is allowed for this mongo cluster. + PublicNetworkAccess *PublicNetworkAccess + + // The Mongo DB server version. Defaults to the latest available version if not specified. + ServerVersion *string +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/models_serde.go b/sdk/resourcemanager/mongocluster/armmongocluster/models_serde.go new file mode 100644 index 000000000000..2e285498b5e9 --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/models_serde.go @@ -0,0 +1,1057 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmongocluster + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityRequest. +func (c CheckNameAvailabilityRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", c.Name) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityRequest. +func (c *CheckNameAvailabilityRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityResponse. +func (c CheckNameAvailabilityResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "message", c.Message) + populate(objectMap, "nameAvailable", c.NameAvailable) + populate(objectMap, "reason", c.Reason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityResponse. +func (c *CheckNameAvailabilityResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "message": + err = unpopulate(val, "Message", &c.Message) + delete(rawMsg, key) + case "nameAvailable": + err = unpopulate(val, "NameAvailable", &c.NameAvailable) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &c.Reason) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionString. +func (c ConnectionString) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "connectionString", c.ConnectionString) + populate(objectMap, "description", c.Description) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionString. +func (c *ConnectionString) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectionString": + err = unpopulate(val, "ConnectionString", &c.ConnectionString) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallRule. +func (f FirewallRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallRule. +func (f *FirewallRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallRuleListResult. +func (f FirewallRuleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallRuleListResult. +func (f *FirewallRuleListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallRuleProperties. +func (f FirewallRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "endIpAddress", f.EndIPAddress) + populate(objectMap, "provisioningState", f.ProvisioningState) + populate(objectMap, "startIpAddress", f.StartIPAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallRuleProperties. +func (f *FirewallRuleProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endIpAddress": + err = unpopulate(val, "EndIPAddress", &f.EndIPAddress) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) + delete(rawMsg, key) + case "startIpAddress": + err = unpopulate(val, "StartIPAddress", &f.StartIPAddress) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListConnectionStringsResult. +func (l ListConnectionStringsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "connectionStrings", l.ConnectionStrings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListConnectionStringsResult. +func (l *ListConnectionStringsResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectionStrings": + err = unpopulate(val, "ConnectionStrings", &l.ConnectionStrings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListResult. +func (l ListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListResult. +func (l *ListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MongoCluster. +func (m MongoCluster) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + populate(objectMap, "location", m.Location) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MongoCluster. +func (m *MongoCluster) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &m.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NodeGroupSpec. +func (n NodeGroupSpec) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "diskSizeGB", n.DiskSizeGB) + populate(objectMap, "enableHa", n.EnableHa) + populate(objectMap, "kind", n.Kind) + populate(objectMap, "nodeCount", n.NodeCount) + populate(objectMap, "sku", n.SKU) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NodeGroupSpec. +func (n *NodeGroupSpec) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskSizeGB": + err = unpopulate(val, "DiskSizeGB", &n.DiskSizeGB) + delete(rawMsg, key) + case "enableHa": + err = unpopulate(val, "EnableHa", &n.EnableHa) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &n.Kind) + delete(rawMsg, key) + case "nodeCount": + err = unpopulate(val, "NodeCount", &n.NodeCount) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &n.SKU) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint. +func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint. +func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. +func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupIds", p.GroupIDs) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. +func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupIds": + err = unpopulate(val, "GroupIDs", &p.GroupIDs) + delete(rawMsg, key) + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionResource. +func (p PrivateEndpointConnectionResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionResource. +func (p *PrivateEndpointConnectionResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionResourceListResult. +func (p PrivateEndpointConnectionResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionResourceListResult. +func (p *PrivateEndpointConnectionResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. +func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. +func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. +func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceListResult. +func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. +func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) + delete(rawMsg, key) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) + delete(rawMsg, key) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState. +func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionsRequired", p.ActionsRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState. +func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionsRequired": + err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Properties. +func (p Properties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "administratorLogin", p.AdministratorLogin) + populate(objectMap, "administratorLoginPassword", p.AdministratorLoginPassword) + populate(objectMap, "clusterStatus", p.ClusterStatus) + populate(objectMap, "connectionString", p.ConnectionString) + populate(objectMap, "createMode", p.CreateMode) + populate(objectMap, "earliestRestoreTime", p.EarliestRestoreTime) + populate(objectMap, "nodeGroupSpecs", p.NodeGroupSpecs) + populate(objectMap, "privateEndpointConnections", p.PrivateEndpointConnections) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) + populate(objectMap, "restoreParameters", p.RestoreParameters) + populate(objectMap, "serverVersion", p.ServerVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Properties. +func (p *Properties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "administratorLogin": + err = unpopulate(val, "AdministratorLogin", &p.AdministratorLogin) + delete(rawMsg, key) + case "administratorLoginPassword": + err = unpopulate(val, "AdministratorLoginPassword", &p.AdministratorLoginPassword) + delete(rawMsg, key) + case "clusterStatus": + err = unpopulate(val, "ClusterStatus", &p.ClusterStatus) + delete(rawMsg, key) + case "connectionString": + err = unpopulate(val, "ConnectionString", &p.ConnectionString) + delete(rawMsg, key) + case "createMode": + err = unpopulate(val, "CreateMode", &p.CreateMode) + delete(rawMsg, key) + case "earliestRestoreTime": + err = unpopulate(val, "EarliestRestoreTime", &p.EarliestRestoreTime) + delete(rawMsg, key) + case "nodeGroupSpecs": + err = unpopulate(val, "NodeGroupSpecs", &p.NodeGroupSpecs) + delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &p.PrivateEndpointConnections) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &p.PublicNetworkAccess) + delete(rawMsg, key) + case "restoreParameters": + err = unpopulate(val, "RestoreParameters", &p.RestoreParameters) + delete(rawMsg, key) + case "serverVersion": + err = unpopulate(val, "ServerVersion", &p.ServerVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RestoreParameters. +func (r RestoreParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "pointInTimeUTC", r.PointInTimeUTC) + populate(objectMap, "sourceResourceId", r.SourceResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RestoreParameters. +func (r *RestoreParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "pointInTimeUTC": + err = unpopulateDateTimeRFC3339(val, "PointInTimeUTC", &r.PointInTimeUTC) + delete(rawMsg, key) + case "sourceResourceId": + err = unpopulate(val, "SourceResourceID", &r.SourceResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Update. +func (u Update) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", u.Properties) + populate(objectMap, "tags", u.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Update. +func (u *Update) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &u.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &u.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpdateProperties. +func (u UpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "administratorLogin", u.AdministratorLogin) + populate(objectMap, "administratorLoginPassword", u.AdministratorLoginPassword) + populate(objectMap, "nodeGroupSpecs", u.NodeGroupSpecs) + populate(objectMap, "publicNetworkAccess", u.PublicNetworkAccess) + populate(objectMap, "serverVersion", u.ServerVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateProperties. +func (u *UpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "administratorLogin": + err = unpopulate(val, "AdministratorLogin", &u.AdministratorLogin) + delete(rawMsg, key) + case "administratorLoginPassword": + err = unpopulate(val, "AdministratorLoginPassword", &u.AdministratorLoginPassword) + delete(rawMsg, key) + case "nodeGroupSpecs": + err = unpopulate(val, "NodeGroupSpecs", &u.NodeGroupSpecs) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &u.PublicNetworkAccess) + delete(rawMsg, key) + case "serverVersion": + err = unpopulate(val, "ServerVersion", &u.ServerVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil || string(data) == "null" { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/mongoclusters_client.go b/sdk/resourcemanager/mongocluster/armmongocluster/mongoclusters_client.go new file mode 100644 index 000000000000..0c7d5f79a3b0 --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/mongoclusters_client.go @@ -0,0 +1,595 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmongocluster + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// MongoClustersClient contains the methods for the MongoClusters group. +// Don't use this type directly, use NewMongoClustersClient() instead. +type MongoClustersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewMongoClustersClient creates a new instance of MongoClustersClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewMongoClustersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MongoClustersClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &MongoClustersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CheckNameAvailability - Check if mongo cluster name is available for use. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-01-preview +// - location - The name of the Azure region. +// - body - The CheckAvailability request +// - options - MongoClustersClientCheckNameAvailabilityOptions contains the optional parameters for the MongoClustersClient.CheckNameAvailability +// method. +func (client *MongoClustersClient) CheckNameAvailability(ctx context.Context, location string, body CheckNameAvailabilityRequest, options *MongoClustersClientCheckNameAvailabilityOptions) (MongoClustersClientCheckNameAvailabilityResponse, error) { + var err error + const operationName = "MongoClustersClient.CheckNameAvailability" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.checkNameAvailabilityCreateRequest(ctx, location, body, options) + if err != nil { + return MongoClustersClientCheckNameAvailabilityResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MongoClustersClientCheckNameAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MongoClustersClientCheckNameAvailabilityResponse{}, err + } + resp, err := client.checkNameAvailabilityHandleResponse(httpResp) + return resp, err +} + +// checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. +func (client *MongoClustersClient) checkNameAvailabilityCreateRequest(ctx context.Context, location string, body CheckNameAvailabilityRequest, options *MongoClustersClientCheckNameAvailabilityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/checkMongoClusterNameAvailability" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. +func (client *MongoClustersClient) checkNameAvailabilityHandleResponse(resp *http.Response) (MongoClustersClientCheckNameAvailabilityResponse, error) { + result := MongoClustersClientCheckNameAvailabilityResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResponse); err != nil { + return MongoClustersClientCheckNameAvailabilityResponse{}, err + } + return result, nil +} + +// BeginCreateOrUpdate - Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify +// some of the properties, use PATCH. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - mongoClusterName - The name of the mongo cluster. +// - resource - Resource create parameters. +// - options - MongoClustersClientBeginCreateOrUpdateOptions contains the optional parameters for the MongoClustersClient.BeginCreateOrUpdate +// method. +func (client *MongoClustersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, mongoClusterName string, resource MongoCluster, options *MongoClustersClientBeginCreateOrUpdateOptions) (*runtime.Poller[MongoClustersClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, mongoClusterName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoClustersClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[MongoClustersClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some +// of the properties, use PATCH. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-01-preview +func (client *MongoClustersClient) createOrUpdate(ctx context.Context, resourceGroupName string, mongoClusterName string, resource MongoCluster, options *MongoClustersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "MongoClustersClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, mongoClusterName, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *MongoClustersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, mongoClusterName string, resource MongoCluster, options *MongoClustersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if mongoClusterName == "" { + return nil, errors.New("parameter mongoClusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{mongoClusterName}", url.PathEscape(mongoClusterName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a mongo cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - mongoClusterName - The name of the mongo cluster. +// - options - MongoClustersClientBeginDeleteOptions contains the optional parameters for the MongoClustersClient.BeginDelete +// method. +func (client *MongoClustersClient) BeginDelete(ctx context.Context, resourceGroupName string, mongoClusterName string, options *MongoClustersClientBeginDeleteOptions) (*runtime.Poller[MongoClustersClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, mongoClusterName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoClustersClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[MongoClustersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a mongo cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-01-preview +func (client *MongoClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, mongoClusterName string, options *MongoClustersClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "MongoClustersClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, mongoClusterName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *MongoClustersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, mongoClusterName string, options *MongoClustersClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if mongoClusterName == "" { + return nil, errors.New("parameter mongoClusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{mongoClusterName}", url.PathEscape(mongoClusterName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets information about a mongo cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - mongoClusterName - The name of the mongo cluster. +// - options - MongoClustersClientGetOptions contains the optional parameters for the MongoClustersClient.Get method. +func (client *MongoClustersClient) Get(ctx context.Context, resourceGroupName string, mongoClusterName string, options *MongoClustersClientGetOptions) (MongoClustersClientGetResponse, error) { + var err error + const operationName = "MongoClustersClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, mongoClusterName, options) + if err != nil { + return MongoClustersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MongoClustersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MongoClustersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *MongoClustersClient) getCreateRequest(ctx context.Context, resourceGroupName string, mongoClusterName string, options *MongoClustersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if mongoClusterName == "" { + return nil, errors.New("parameter mongoClusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{mongoClusterName}", url.PathEscape(mongoClusterName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *MongoClustersClient) getHandleResponse(resp *http.Response) (MongoClustersClientGetResponse, error) { + result := MongoClustersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MongoCluster); err != nil { + return MongoClustersClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List all the mongo clusters in a given subscription. +// +// Generated from API version 2024-03-01-preview +// - options - MongoClustersClientListOptions contains the optional parameters for the MongoClustersClient.NewListPager method. +func (client *MongoClustersClient) NewListPager(options *MongoClustersClientListOptions) *runtime.Pager[MongoClustersClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[MongoClustersClientListResponse]{ + More: func(page MongoClustersClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *MongoClustersClientListResponse) (MongoClustersClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MongoClustersClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return MongoClustersClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *MongoClustersClient) listCreateRequest(ctx context.Context, options *MongoClustersClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/mongoClusters" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *MongoClustersClient) listHandleResponse(resp *http.Response) (MongoClustersClientListResponse, error) { + result := MongoClustersClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListResult); err != nil { + return MongoClustersClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List all the mongo clusters in a given resource group. +// +// Generated from API version 2024-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - MongoClustersClientListByResourceGroupOptions contains the optional parameters for the MongoClustersClient.NewListByResourceGroupPager +// method. +func (client *MongoClustersClient) NewListByResourceGroupPager(resourceGroupName string, options *MongoClustersClientListByResourceGroupOptions) *runtime.Pager[MongoClustersClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[MongoClustersClientListByResourceGroupResponse]{ + More: func(page MongoClustersClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *MongoClustersClientListByResourceGroupResponse) (MongoClustersClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MongoClustersClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return MongoClustersClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *MongoClustersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *MongoClustersClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *MongoClustersClient) listByResourceGroupHandleResponse(resp *http.Response) (MongoClustersClientListByResourceGroupResponse, error) { + result := MongoClustersClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListResult); err != nil { + return MongoClustersClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// ListConnectionStrings - List mongo cluster connection strings. This includes the default connection string using SCRAM-SHA-256, +// as well as other connection strings supported by the cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - mongoClusterName - The name of the mongo cluster. +// - options - MongoClustersClientListConnectionStringsOptions contains the optional parameters for the MongoClustersClient.ListConnectionStrings +// method. +func (client *MongoClustersClient) ListConnectionStrings(ctx context.Context, resourceGroupName string, mongoClusterName string, options *MongoClustersClientListConnectionStringsOptions) (MongoClustersClientListConnectionStringsResponse, error) { + var err error + const operationName = "MongoClustersClient.ListConnectionStrings" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listConnectionStringsCreateRequest(ctx, resourceGroupName, mongoClusterName, options) + if err != nil { + return MongoClustersClientListConnectionStringsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MongoClustersClientListConnectionStringsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MongoClustersClientListConnectionStringsResponse{}, err + } + resp, err := client.listConnectionStringsHandleResponse(httpResp) + return resp, err +} + +// listConnectionStringsCreateRequest creates the ListConnectionStrings request. +func (client *MongoClustersClient) listConnectionStringsCreateRequest(ctx context.Context, resourceGroupName string, mongoClusterName string, options *MongoClustersClientListConnectionStringsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/listConnectionStrings" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if mongoClusterName == "" { + return nil, errors.New("parameter mongoClusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{mongoClusterName}", url.PathEscape(mongoClusterName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listConnectionStringsHandleResponse handles the ListConnectionStrings response. +func (client *MongoClustersClient) listConnectionStringsHandleResponse(resp *http.Response) (MongoClustersClientListConnectionStringsResponse, error) { + result := MongoClustersClientListConnectionStringsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListConnectionStringsResult); err != nil { + return MongoClustersClientListConnectionStringsResponse{}, err + } + return result, nil +} + +// BeginUpdate - Updates an existing mongo cluster. The request body can contain one to many of the properties present in +// the normal mongo cluster definition. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - mongoClusterName - The name of the mongo cluster. +// - properties - The resource properties to be updated. +// - options - MongoClustersClientBeginUpdateOptions contains the optional parameters for the MongoClustersClient.BeginUpdate +// method. +func (client *MongoClustersClient) BeginUpdate(ctx context.Context, resourceGroupName string, mongoClusterName string, properties Update, options *MongoClustersClientBeginUpdateOptions) (*runtime.Poller[MongoClustersClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, mongoClusterName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoClustersClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[MongoClustersClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal +// mongo cluster definition. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-01-preview +func (client *MongoClustersClient) update(ctx context.Context, resourceGroupName string, mongoClusterName string, properties Update, options *MongoClustersClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "MongoClustersClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, mongoClusterName, properties, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *MongoClustersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, mongoClusterName string, properties Update, options *MongoClustersClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if mongoClusterName == "" { + return nil, errors.New("parameter mongoClusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{mongoClusterName}", url.PathEscape(mongoClusterName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/operations_client.go b/sdk/resourcemanager/mongocluster/armmongocluster/operations_client.go new file mode 100644 index 000000000000..077d454b61f9 --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/operations_client.go @@ -0,0 +1,88 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmongocluster + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + internal *arm.Client +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - List the operations for the provider +// +// Generated from API version 2024-03-01-preview +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return OperationsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.DocumentDB/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { + result := OperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { + return OperationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/options.go b/sdk/resourcemanager/mongocluster/armmongocluster/options.go new file mode 100644 index 000000000000..2630ac044b44 --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/options.go @@ -0,0 +1,117 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmongocluster + +// FirewallRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the FirewallRulesClient.BeginCreateOrUpdate +// method. +type FirewallRulesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FirewallRulesClientBeginDeleteOptions contains the optional parameters for the FirewallRulesClient.BeginDelete method. +type FirewallRulesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FirewallRulesClientGetOptions contains the optional parameters for the FirewallRulesClient.Get method. +type FirewallRulesClientGetOptions struct { + // placeholder for future optional parameters +} + +// FirewallRulesClientListByMongoClusterOptions contains the optional parameters for the FirewallRulesClient.NewListByMongoClusterPager +// method. +type FirewallRulesClientListByMongoClusterOptions struct { + // placeholder for future optional parameters +} + +// MongoClustersClientBeginCreateOrUpdateOptions contains the optional parameters for the MongoClustersClient.BeginCreateOrUpdate +// method. +type MongoClustersClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MongoClustersClientBeginDeleteOptions contains the optional parameters for the MongoClustersClient.BeginDelete method. +type MongoClustersClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MongoClustersClientBeginUpdateOptions contains the optional parameters for the MongoClustersClient.BeginUpdate method. +type MongoClustersClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MongoClustersClientCheckNameAvailabilityOptions contains the optional parameters for the MongoClustersClient.CheckNameAvailability +// method. +type MongoClustersClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// MongoClustersClientGetOptions contains the optional parameters for the MongoClustersClient.Get method. +type MongoClustersClientGetOptions struct { + // placeholder for future optional parameters +} + +// MongoClustersClientListByResourceGroupOptions contains the optional parameters for the MongoClustersClient.NewListByResourceGroupPager +// method. +type MongoClustersClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// MongoClustersClientListConnectionStringsOptions contains the optional parameters for the MongoClustersClient.ListConnectionStrings +// method. +type MongoClustersClientListConnectionStringsOptions struct { + // placeholder for future optional parameters +} + +// MongoClustersClientListOptions contains the optional parameters for the MongoClustersClient.NewListPager method. +type MongoClustersClientListOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientBeginCreateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreate +// method. +type PrivateEndpointConnectionsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +type PrivateEndpointConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +type PrivateEndpointConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientListByMongoClusterOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByMongoClusterPager +// method. +type PrivateEndpointConnectionsClientListByMongoClusterOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinksClientListByMongoClusterOptions contains the optional parameters for the PrivateLinksClient.NewListByMongoClusterPager +// method. +type PrivateLinksClientListByMongoClusterOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/privateendpointconnections_client.go b/sdk/resourcemanager/mongocluster/armmongocluster/privateendpointconnections_client.go new file mode 100644 index 000000000000..89814df2e42b --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/privateendpointconnections_client.go @@ -0,0 +1,347 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmongocluster + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. +// Don't use this type directly, use NewPrivateEndpointConnectionsClient() instead. +type PrivateEndpointConnectionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateEndpointConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Create a Private endpoint connection +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - mongoClusterName - The name of the mongo cluster. +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. +// - resource - Resource create parameters. +// - options - PrivateEndpointConnectionsClientBeginCreateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreate +// method. +func (client *PrivateEndpointConnectionsClient) BeginCreate(ctx context.Context, resourceGroupName string, mongoClusterName string, privateEndpointConnectionName string, resource PrivateEndpointConnectionResource, options *PrivateEndpointConnectionsClientBeginCreateOptions) (*runtime.Poller[PrivateEndpointConnectionsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, mongoClusterName, privateEndpointConnectionName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateEndpointConnectionsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Create a Private endpoint connection +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-01-preview +func (client *PrivateEndpointConnectionsClient) create(ctx context.Context, resourceGroupName string, mongoClusterName string, privateEndpointConnectionName string, resource PrivateEndpointConnectionResource, options *PrivateEndpointConnectionsClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "PrivateEndpointConnectionsClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, mongoClusterName, privateEndpointConnectionName, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *PrivateEndpointConnectionsClient) createCreateRequest(ctx context.Context, resourceGroupName string, mongoClusterName string, privateEndpointConnectionName string, resource PrivateEndpointConnectionResource, options *PrivateEndpointConnectionsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections/{privateEndpointConnectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if mongoClusterName == "" { + return nil, errors.New("parameter mongoClusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{mongoClusterName}", url.PathEscape(mongoClusterName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete the private endpoint connection +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - mongoClusterName - The name of the mongo cluster. +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. +// - options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, mongoClusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, mongoClusterName, privateEndpointConnectionName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateEndpointConnectionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete the private endpoint connection +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-01-preview +func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, mongoClusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "PrivateEndpointConnectionsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, mongoClusterName, privateEndpointConnectionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, mongoClusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections/{privateEndpointConnectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if mongoClusterName == "" { + return nil, errors.New("parameter mongoClusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{mongoClusterName}", url.PathEscape(mongoClusterName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a specific private connection +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - mongoClusterName - The name of the mongo cluster. +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. +// - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, mongoClusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { + var err error + const operationName = "PrivateEndpointConnectionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, mongoClusterName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, mongoClusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections/{privateEndpointConnectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if mongoClusterName == "" { + return nil, errors.New("parameter mongoClusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{mongoClusterName}", url.PathEscape(mongoClusterName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientGetResponse, error) { + result := PrivateEndpointConnectionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionResource); err != nil { + return PrivateEndpointConnectionsClientGetResponse{}, err + } + return result, nil +} + +// NewListByMongoClusterPager - List existing private connections +// +// Generated from API version 2024-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - mongoClusterName - The name of the mongo cluster. +// - options - PrivateEndpointConnectionsClientListByMongoClusterOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByMongoClusterPager +// method. +func (client *PrivateEndpointConnectionsClient) NewListByMongoClusterPager(resourceGroupName string, mongoClusterName string, options *PrivateEndpointConnectionsClientListByMongoClusterOptions) *runtime.Pager[PrivateEndpointConnectionsClientListByMongoClusterResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateEndpointConnectionsClientListByMongoClusterResponse]{ + More: func(page PrivateEndpointConnectionsClientListByMongoClusterResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionsClientListByMongoClusterResponse) (PrivateEndpointConnectionsClientListByMongoClusterResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateEndpointConnectionsClient.NewListByMongoClusterPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByMongoClusterCreateRequest(ctx, resourceGroupName, mongoClusterName, options) + }, nil) + if err != nil { + return PrivateEndpointConnectionsClientListByMongoClusterResponse{}, err + } + return client.listByMongoClusterHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByMongoClusterCreateRequest creates the ListByMongoCluster request. +func (client *PrivateEndpointConnectionsClient) listByMongoClusterCreateRequest(ctx context.Context, resourceGroupName string, mongoClusterName string, options *PrivateEndpointConnectionsClientListByMongoClusterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if mongoClusterName == "" { + return nil, errors.New("parameter mongoClusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{mongoClusterName}", url.PathEscape(mongoClusterName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByMongoClusterHandleResponse handles the ListByMongoCluster response. +func (client *PrivateEndpointConnectionsClient) listByMongoClusterHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientListByMongoClusterResponse, error) { + result := PrivateEndpointConnectionsClientListByMongoClusterResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionResourceListResult); err != nil { + return PrivateEndpointConnectionsClientListByMongoClusterResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/privatelinks_client.go b/sdk/resourcemanager/mongocluster/armmongocluster/privatelinks_client.go new file mode 100644 index 000000000000..40f020add9a6 --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/privatelinks_client.go @@ -0,0 +1,109 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmongocluster + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PrivateLinksClient contains the methods for the PrivateLinks group. +// Don't use this type directly, use NewPrivateLinksClient() instead. +type PrivateLinksClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPrivateLinksClient creates a new instance of PrivateLinksClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPrivateLinksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinksClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateLinksClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListByMongoClusterPager - list private links on the given resource +// +// Generated from API version 2024-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - mongoClusterName - The name of the mongo cluster. +// - options - PrivateLinksClientListByMongoClusterOptions contains the optional parameters for the PrivateLinksClient.NewListByMongoClusterPager +// method. +func (client *PrivateLinksClient) NewListByMongoClusterPager(resourceGroupName string, mongoClusterName string, options *PrivateLinksClientListByMongoClusterOptions) *runtime.Pager[PrivateLinksClientListByMongoClusterResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateLinksClientListByMongoClusterResponse]{ + More: func(page PrivateLinksClientListByMongoClusterResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateLinksClientListByMongoClusterResponse) (PrivateLinksClientListByMongoClusterResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateLinksClient.NewListByMongoClusterPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByMongoClusterCreateRequest(ctx, resourceGroupName, mongoClusterName, options) + }, nil) + if err != nil { + return PrivateLinksClientListByMongoClusterResponse{}, err + } + return client.listByMongoClusterHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByMongoClusterCreateRequest creates the ListByMongoCluster request. +func (client *PrivateLinksClient) listByMongoClusterCreateRequest(ctx context.Context, resourceGroupName string, mongoClusterName string, options *PrivateLinksClientListByMongoClusterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateLinkResources" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if mongoClusterName == "" { + return nil, errors.New("parameter mongoClusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{mongoClusterName}", url.PathEscape(mongoClusterName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByMongoClusterHandleResponse handles the ListByMongoCluster response. +func (client *PrivateLinksClient) listByMongoClusterHandleResponse(resp *http.Response) (PrivateLinksClientListByMongoClusterResponse, error) { + result := PrivateLinksClientListByMongoClusterResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { + return PrivateLinksClientListByMongoClusterResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/responses.go b/sdk/resourcemanager/mongocluster/armmongocluster/responses.go new file mode 100644 index 000000000000..a302651046bf --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/responses.go @@ -0,0 +1,114 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmongocluster + +// FirewallRulesClientCreateOrUpdateResponse contains the response from method FirewallRulesClient.BeginCreateOrUpdate. +type FirewallRulesClientCreateOrUpdateResponse struct { + // Represents a mongo cluster firewall rule. + FirewallRule +} + +// FirewallRulesClientDeleteResponse contains the response from method FirewallRulesClient.BeginDelete. +type FirewallRulesClientDeleteResponse struct { + // placeholder for future response values +} + +// FirewallRulesClientGetResponse contains the response from method FirewallRulesClient.Get. +type FirewallRulesClientGetResponse struct { + // Represents a mongo cluster firewall rule. + FirewallRule +} + +// FirewallRulesClientListByMongoClusterResponse contains the response from method FirewallRulesClient.NewListByMongoClusterPager. +type FirewallRulesClientListByMongoClusterResponse struct { + // The response of a FirewallRule list operation. + FirewallRuleListResult +} + +// MongoClustersClientCheckNameAvailabilityResponse contains the response from method MongoClustersClient.CheckNameAvailability. +type MongoClustersClientCheckNameAvailabilityResponse struct { + // The check availability result. + CheckNameAvailabilityResponse +} + +// MongoClustersClientCreateOrUpdateResponse contains the response from method MongoClustersClient.BeginCreateOrUpdate. +type MongoClustersClientCreateOrUpdateResponse struct { + // Represents a mongo cluster resource. + MongoCluster +} + +// MongoClustersClientDeleteResponse contains the response from method MongoClustersClient.BeginDelete. +type MongoClustersClientDeleteResponse struct { + // placeholder for future response values +} + +// MongoClustersClientGetResponse contains the response from method MongoClustersClient.Get. +type MongoClustersClientGetResponse struct { + // Represents a mongo cluster resource. + MongoCluster +} + +// MongoClustersClientListByResourceGroupResponse contains the response from method MongoClustersClient.NewListByResourceGroupPager. +type MongoClustersClientListByResourceGroupResponse struct { + // The response of a MongoCluster list operation. + ListResult +} + +// MongoClustersClientListConnectionStringsResponse contains the response from method MongoClustersClient.ListConnectionStrings. +type MongoClustersClientListConnectionStringsResponse struct { + // The connection strings for the given mongo cluster. + ListConnectionStringsResult +} + +// MongoClustersClientListResponse contains the response from method MongoClustersClient.NewListPager. +type MongoClustersClientListResponse struct { + // The response of a MongoCluster list operation. + ListResult +} + +// MongoClustersClientUpdateResponse contains the response from method MongoClustersClient.BeginUpdate. +type MongoClustersClientUpdateResponse struct { + // Represents a mongo cluster resource. + MongoCluster +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + OperationListResult +} + +// PrivateEndpointConnectionsClientCreateResponse contains the response from method PrivateEndpointConnectionsClient.BeginCreate. +type PrivateEndpointConnectionsClientCreateResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. + PrivateEndpointConnectionResource +} + +// PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.BeginDelete. +type PrivateEndpointConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. +type PrivateEndpointConnectionsClientGetResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. + PrivateEndpointConnectionResource +} + +// PrivateEndpointConnectionsClientListByMongoClusterResponse contains the response from method PrivateEndpointConnectionsClient.NewListByMongoClusterPager. +type PrivateEndpointConnectionsClientListByMongoClusterResponse struct { + // The response of a PrivateEndpointConnectionResource list operation. + PrivateEndpointConnectionResourceListResult +} + +// PrivateLinksClientListByMongoClusterResponse contains the response from method PrivateLinksClient.NewListByMongoClusterPager. +type PrivateLinksClientListByMongoClusterResponse struct { + // The response of a PrivateLinkResource list operation. + PrivateLinkResourceListResult +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/time_rfc3339.go b/sdk/resourcemanager/mongocluster/armmongocluster/time_rfc3339.go new file mode 100644 index 000000000000..8be267f810fd --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmongocluster + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md b/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md index c4347fe6a0d5..9e4668ff0259 100644 --- a/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md +++ b/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md @@ -1,5 +1,161 @@ # Release History +## 0.12.0 (2024-06-13) +### Breaking Changes + +- Function `*PrivateEndpointConnectionsClient.BeginCreateOrUpdate` parameter(s) have been changed from `(context.Context, string, string, string, PrivateEndpointConnection, *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions)` to `(context.Context, string, string, string, PrivateEndpointConnectionAutoGenerated, *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions)` +- Type of `AzureMonitorPrivateLinkScopeProperties.PrivateEndpointConnections` has been changed from `[]*PrivateEndpointConnection` to `[]*PrivateEndpointConnectionAutoGenerated` +- Type of `DefaultErrorResponse.Error` has been changed from `*ErrorDetail` to `*ErrorDetailAutoGenerated2` +- Type of `ErrorContract.Error` has been changed from `*ErrorResponse` to `*ErrorResponseAutoGenerated2` +- Type of `ErrorResponseCommonV2.Error` has been changed from `*ErrorDetail` to `*ErrorDetailAutoGenerated2` +- Type of `EventCategoryCollection.Value` has been changed from `[]*LocalizableString` to `[]*LocalizableStringAutoGenerated` +- Type of `EventData.Category` has been changed from `*LocalizableString` to `*LocalizableStringAutoGenerated` +- Type of `EventData.EventName` has been changed from `*LocalizableString` to `*LocalizableStringAutoGenerated` +- Type of `EventData.OperationName` has been changed from `*LocalizableString` to `*LocalizableStringAutoGenerated` +- Type of `EventData.ResourceProviderName` has been changed from `*LocalizableString` to `*LocalizableStringAutoGenerated` +- Type of `EventData.ResourceType` has been changed from `*LocalizableString` to `*LocalizableStringAutoGenerated` +- Type of `EventData.Status` has been changed from `*LocalizableString` to `*LocalizableStringAutoGenerated` +- Type of `EventData.SubStatus` has been changed from `*LocalizableString` to `*LocalizableStringAutoGenerated` +- Type of `Metric.Unit` has been changed from `*Unit` to `*MetricUnit` +- Type of `OperationStatus.Error` has been changed from `*ErrorDetail` to `*ErrorDetailAutoGenerated2` +- Type of `PrivateEndpointConnectionListResult.Value` has been changed from `[]*PrivateEndpointConnection` to `[]*PrivateEndpointConnectionAutoGenerated` +- Type of `SubscriptionScopeMetricsRequestBodyParameters.Timespan` has been changed from `*time.Time` to `*string` +- `PublicNetworkAccessSecuredByPerimeter` from enum `PublicNetworkAccess` has been removed +- Enum `Unit` has been removed +- Operation `*AzureMonitorWorkspacesClient.Delete` has been changed to LRO, use `*AzureMonitorWorkspacesClient.BeginDelete` instead. +- Struct `ErrorContractAutoGenerated` has been removed +- Struct `ErrorResponseAdditionalInfo` has been removed +- Struct `ErrorResponseDetails` has been removed +- Struct `SubscriptionScopeMetric` has been removed +- Struct `SubscriptionScopeMetricResponse` has been removed +- Field `Code`, `Message` of struct `ErrorResponse` has been removed +- Field `Error` of struct `ErrorResponseAutoGenerated2` has been removed +- Field `SubscriptionScopeMetricResponse` of struct `MetricsClientListAtSubscriptionScopePostResponse` has been removed +- Field `SubscriptionScopeMetricResponse` of struct `MetricsClientListAtSubscriptionScopeResponse` has been removed +- Field `ActionType`, `IsDataAction`, `Origin` of struct `OperationAutoGenerated` has been removed +- Field `Description` of struct `OperationDisplayAutoGenerated` has been removed +- Field `OperationListResult` of struct `OperationsClientListResponse` has been removed +- Field `OperationListResultAutoGenerated` of struct `OperationsForMonitorClientListResponse` has been removed +- Field `PrivateEndpointConnection` of struct `PrivateEndpointConnectionsClientCreateOrUpdateResponse` has been removed +- Field `PrivateEndpointConnection` of struct `PrivateEndpointConnectionsClientGetResponse` has been removed +- Field `Location`, `Tags` of struct `Resource` has been removed +- Field `Location`, `Tags` of struct `ResourceAutoGenerated` has been removed +- Field `Location`, `Tags` of struct `ResourceAutoGenerated2` has been removed +- Field `SystemData` of struct `ResourceAutoGenerated5` has been removed +- Field `PublicNetworkAccess` of struct `ScheduledQueryRuleProperties` has been removed +- Field `SystemData` of struct `TrackedResourceAutoGenerated` has been removed + +### Features Added + +- New value `KnownLogFilesDataSourceFormatJSON` added to enum type `KnownLogFilesDataSourceFormat` +- New value `KnownSyslogDataSourceFacilityNamesAlert`, `KnownSyslogDataSourceFacilityNamesAudit`, `KnownSyslogDataSourceFacilityNamesClock`, `KnownSyslogDataSourceFacilityNamesFtp`, `KnownSyslogDataSourceFacilityNamesNopri`, `KnownSyslogDataSourceFacilityNamesNtp` added to enum type `KnownSyslogDataSourceFacilityNames` +- New enum type `AccessRuleDirection` with values `AccessRuleDirectionInbound`, `AccessRuleDirectionOutbound` +- New enum type `IncidentManagementService` with values `IncidentManagementServiceIcm` +- New enum type `IssueType` with values `IssueTypeConfigurationPropagationFailure`, `IssueTypeMissingIdentityConfiguration`, `IssueTypeMissingPerimeterConfiguration`, `IssueTypeUnknown` +- New enum type `KnownAgentSettingName` with values `KnownAgentSettingNameMaxDiskQuotaInMB`, `KnownAgentSettingNameUseTimeReceivedForForwardedEvents` +- New enum type `KnownStorageBlobLookupType` with values `KnownStorageBlobLookupTypeCidr`, `KnownStorageBlobLookupTypeString` +- New enum type `KnownWindowsFirewallLogsDataSourceProfileFilter` with values `KnownWindowsFirewallLogsDataSourceProfileFilterDomain`, `KnownWindowsFirewallLogsDataSourceProfileFilterPrivate`, `KnownWindowsFirewallLogsDataSourceProfileFilterPublic` +- New enum type `NetworkSecurityPerimeterConfigurationProvisioningState` with values `NetworkSecurityPerimeterConfigurationProvisioningStateAccepted`, `NetworkSecurityPerimeterConfigurationProvisioningStateCanceled`, `NetworkSecurityPerimeterConfigurationProvisioningStateCreating`, `NetworkSecurityPerimeterConfigurationProvisioningStateDeleting`, `NetworkSecurityPerimeterConfigurationProvisioningStateFailed`, `NetworkSecurityPerimeterConfigurationProvisioningStateSucceeded`, `NetworkSecurityPerimeterConfigurationProvisioningStateUpdating` +- New enum type `ResourceAssociationAccessMode` with values `ResourceAssociationAccessModeAudit`, `ResourceAssociationAccessModeEnforced`, `ResourceAssociationAccessModeLearning` +- New enum type `Severity` with values `SeverityError`, `SeverityWarning` +- New function `*ActionGroupsClient.GetNSP(context.Context, string, string, string, *ActionGroupsClientGetNSPOptions) (ActionGroupsClientGetNSPResponse, error)` +- New function `*ActionGroupsClient.NewListNSPPager(string, string, *ActionGroupsClientListNSPOptions) *runtime.Pager[ActionGroupsClientListNSPResponse]` +- New function `*ActionGroupsClient.BeginReconcileNSP(context.Context, string, string, string, *ActionGroupsClientBeginReconcileNSPOptions) (*runtime.Poller[ActionGroupsClientReconcileNSPResponse], error)` +- New function `NewClient(azcore.TokenCredential, *arm.ClientOptions) (*Client, error)` +- New function `*Client.BeginCreateNotificationsAtTenantActionGroupResourceLevel(context.Context, string, string, string, TenantNotificationRequestBody, *ClientBeginCreateNotificationsAtTenantActionGroupResourceLevelOptions) (*runtime.Poller[ClientCreateNotificationsAtTenantActionGroupResourceLevelResponse], error)` +- New function `*Client.GetTestNotificationsAtTenantActionGroupResourceLevel(context.Context, string, string, string, string, *ClientGetTestNotificationsAtTenantActionGroupResourceLevelOptions) (ClientGetTestNotificationsAtTenantActionGroupResourceLevelResponse, error)` +- New function `*ClientFactory.NewClient() *Client` +- New function `*ClientFactory.NewScheduledQueryRuleClient() *ScheduledQueryRuleClient` +- New function `*DataCollectionEndpointsClient.GetNSP(context.Context, string, string, string, *DataCollectionEndpointsClientGetNSPOptions) (DataCollectionEndpointsClientGetNSPResponse, error)` +- New function `*DataCollectionEndpointsClient.NewListNSPPager(string, string, *DataCollectionEndpointsClientListNSPOptions) *runtime.Pager[DataCollectionEndpointsClientListNSPResponse]` +- New function `*DataCollectionEndpointsClient.BeginReconcileNSP(context.Context, string, string, string, *DataCollectionEndpointsClientBeginReconcileNSPOptions) (*runtime.Poller[DataCollectionEndpointsClientReconcileNSPResponse], error)` +- New function `NewScheduledQueryRuleClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ScheduledQueryRuleClient, error)` +- New function `*ScheduledQueryRuleClient.GetNSP(context.Context, string, string, string, *ScheduledQueryRuleClientGetNSPOptions) (ScheduledQueryRuleClientGetNSPResponse, error)` +- New function `*ScheduledQueryRuleClient.NewListNSPPager(string, string, *ScheduledQueryRuleClientListNSPOptions) *runtime.Pager[ScheduledQueryRuleClientListNSPResponse]` +- New function `*ScheduledQueryRuleClient.BeginReconcileNSP(context.Context, string, string, string, *ScheduledQueryRuleClientBeginReconcileNSPOptions) (*runtime.Poller[ScheduledQueryRuleClientReconcileNSPResponse], error)` +- New struct `AccessRule` +- New struct `AccessRuleProperties` +- New struct `AccessRulePropertiesSubscriptionsItem` +- New struct `ActionDetailAutoGenerated` +- New struct `AdxDestination` +- New struct `AgentSetting` +- New struct `AgentSettingsSpec` +- New struct `DataCollectionRuleAgentSettings` +- New struct `DataCollectionRuleEndpoints` +- New struct `DataCollectionRuleReferences` +- New struct `EndpointsSpec` +- New struct `EnrichmentData` +- New struct `ErrorDetailAutoGenerated2` +- New struct `ErrorResponseAutoGenerated3` +- New struct `ErrorResponseAutoGenerated4` +- New struct `ErrorResponseAutoGenerated5` +- New struct `IncidentReceiver` +- New struct `IncidentServiceConnection` +- New struct `LocalizableStringAutoGenerated` +- New struct `MicrosoftFabricDestination` +- New struct `NetworkSecurityPerimeter` +- New struct `NetworkSecurityPerimeterConfiguration` +- New struct `NetworkSecurityPerimeterConfigurationListResult` +- New struct `NetworkSecurityPerimeterConfigurationProperties` +- New struct `NetworkSecurityProfile` +- New struct `PrivateEndpointAutoGenerated` +- New struct `PrivateEndpointConnectionAutoGenerated` +- New struct `PrivateEndpointConnectionPropertiesAutoGenerated` +- New struct `ProvisioningIssue` +- New struct `ProvisioningIssueProperties` +- New struct `ProxyResourceAutoGenerated2` +- New struct `ReferencesSpec` +- New struct `ReferencesSpecEnrichmentData` +- New struct `ResourceAssociation` +- New struct `ResourceAutoGenerated6` +- New struct `ResourceAutoGenerated7` +- New struct `StorageBlob` +- New struct `TenantNotificationRequestBody` +- New struct `TestNotificationDetailsResponseAutoGenerated` +- New field `IncidentReceivers` in struct `ActionGroup` +- New field `ActionProperties` in struct `Actions` +- New field `PrivateEndpointConnections`, `PublicNetworkAccess` in struct `AzureMonitorWorkspace` +- New field `PrivateEndpointConnections`, `PublicNetworkAccess` in struct `AzureMonitorWorkspaceResourceProperties` +- New field `ProvisionedByImmutableID` in struct `DataCollectionEndpointMetadata` +- New field `AgentSettings`, `Endpoints`, `References` in struct `DataCollectionRule` +- New field `ProvisionedByImmutableID` in struct `DataCollectionRuleAssociationMetadata` +- New field `AzureDataExplorer`, `MicrosoftFabric` in struct `DataCollectionRuleDestinations` +- New field `ProvisionedByImmutableID` in struct `DataCollectionRuleMetadata` +- New field `AgentSettings`, `Endpoints`, `References` in struct `DataCollectionRuleResourceProperties` +- New field `DeleteAssociations` in struct `DataCollectionRulesClientDeleteOptions` +- New field `CaptureOverflow` in struct `DataFlow` +- New field `AzureDataExplorer`, `MicrosoftFabric` in struct `DestinationsSpec` +- New field `Error` in struct `ErrorResponse` +- New field `AdditionalInfo`, `Code`, `Details`, `Message`, `Target` in struct `ErrorResponseAutoGenerated2` +- New field `TransformKql` in struct `IisLogsDataSource` +- New field `TransformKql` in struct `LogFilesDataSource` +- New field `ProvisionedByImmutableID` in struct `Metadata` +- New field `Rollupby` in struct `MetricsClientListAtSubscriptionScopeOptions` +- New field `Rollupby` in struct `MetricsClientListAtSubscriptionScopePostOptions` +- New anonymous field `Response` in struct `MetricsClientListAtSubscriptionScopePostResponse` +- New anonymous field `Response` in struct `MetricsClientListAtSubscriptionScopeResponse` +- New field `Rollupby` in struct `MetricsClientListOptions` +- New field `IncidentReceivers` in struct `NotificationRequestBody` +- New field `ActionType`, `IsDataAction`, `Origin` in struct `Operation` +- New field `Description` in struct `OperationDisplay` +- New anonymous field `OperationListResultAutoGenerated` in struct `OperationsClientListResponse` +- New anonymous field `OperationListResult` in struct `OperationsForMonitorClientListResponse` +- New field `TransformKql` in struct `PerfCounterDataSource` +- New field `SystemData` in struct `PrivateEndpointConnection` +- New field `GroupIDs` in struct `PrivateEndpointConnectionProperties` +- New anonymous field `PrivateEndpointConnectionAutoGenerated` in struct `PrivateEndpointConnectionsClientCreateOrUpdateResponse` +- New anonymous field `PrivateEndpointConnectionAutoGenerated` in struct `PrivateEndpointConnectionsClientGetResponse` +- New field `SystemData` in struct `ProxyResource` +- New field `SystemData` in struct `ResourceAutoGenerated` +- New field `SystemData` in struct `ResourceAutoGenerated2` +- New field `Location`, `SystemData`, `Tags` in struct `ResourceAutoGenerated3` +- New field `Location`, `Tags` in struct `ResourceAutoGenerated5` +- New field `TransformKql` in struct `SyslogDataSource` +- New field `SystemData` in struct `TrackedResource` +- New field `TransformKql` in struct `WindowsEventLogDataSource` +- New field `ProfileFilter` in struct `WindowsFirewallLogsDataSource` + + ## 0.11.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/monitor/armmonitor/README.md b/sdk/resourcemanager/monitor/armmonitor/README.md index 52e9ed62b3b9..7d462f61237f 100644 --- a/sdk/resourcemanager/monitor/armmonitor/README.md +++ b/sdk/resourcemanager/monitor/armmonitor/README.md @@ -57,7 +57,7 @@ clientFactory, err := armmonitor.NewClientFactory(, cred, &opti A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. ```go -client := clientFactory.NewAlertRuleIncidentsClient() +client := clientFactory.NewActionGroupsClient() ``` ## Fakes diff --git a/sdk/resourcemanager/monitor/armmonitor/actiongroups_client.go b/sdk/resourcemanager/monitor/armmonitor/actiongroups_client.go index c5d4fc18bd19..1b08e128d600 100644 --- a/sdk/resourcemanager/monitor/armmonitor/actiongroups_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/actiongroups_client.go @@ -28,7 +28,7 @@ type ActionGroupsClient struct { } // NewActionGroupsClient creates a new instance of ActionGroupsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewActionGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ActionGroupsClient, error) { @@ -46,7 +46,7 @@ func NewActionGroupsClient(subscriptionID string, credential azcore.TokenCredent // BeginCreateNotificationsAtActionGroupResourceLevel - Send test notifications to a set of provided receivers // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01 +// Generated from API version 2023-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - actionGroupName - The name of the action group. // - notificationRequest - The notification request body which includes the contact details @@ -73,7 +73,7 @@ func (client *ActionGroupsClient) BeginCreateNotificationsAtActionGroupResourceL // CreateNotificationsAtActionGroupResourceLevel - Send test notifications to a set of provided receivers // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01 +// Generated from API version 2023-09-01-preview func (client *ActionGroupsClient) createNotificationsAtActionGroupResourceLevel(ctx context.Context, resourceGroupName string, actionGroupName string, notificationRequest NotificationRequestBody, options *ActionGroupsClientBeginCreateNotificationsAtActionGroupResourceLevelOptions) (*http.Response, error) { var err error const operationName = "ActionGroupsClient.BeginCreateNotificationsAtActionGroupResourceLevel" @@ -115,7 +115,7 @@ func (client *ActionGroupsClient) createNotificationsAtActionGroupResourceLevelC return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") + reqQP.Set("api-version", "2023-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, notificationRequest); err != nil { @@ -127,7 +127,7 @@ func (client *ActionGroupsClient) createNotificationsAtActionGroupResourceLevelC // CreateOrUpdate - Create a new action group or update an existing one. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01 +// Generated from API version 2023-09-01-preview // - 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. @@ -175,7 +175,7 @@ func (client *ActionGroupsClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") + reqQP.Set("api-version", "2023-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, actionGroup); err != nil { @@ -196,7 +196,7 @@ func (client *ActionGroupsClient) createOrUpdateHandleResponse(resp *http.Respon // Delete - Delete an action group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01 +// Generated from API version 2023-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - actionGroupName - The name of the action group. // - options - ActionGroupsClientDeleteOptions contains the optional parameters for the ActionGroupsClient.Delete method. @@ -241,7 +241,7 @@ func (client *ActionGroupsClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") + reqQP.Set("api-version", "2023-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -251,7 +251,7 @@ func (client *ActionGroupsClient) deleteCreateRequest(ctx context.Context, resou // operation is only supported for Email or SMS receivers. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01 +// Generated from API version 2023-09-01-preview // - 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. @@ -298,7 +298,7 @@ func (client *ActionGroupsClient) enableReceiverCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") + reqQP.Set("api-version", "2023-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, enableRequest); err != nil { @@ -310,7 +310,7 @@ func (client *ActionGroupsClient) enableReceiverCreateRequest(ctx context.Contex // Get - Get an action group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01 +// Generated from API version 2023-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - actionGroupName - The name of the action group. // - options - ActionGroupsClientGetOptions contains the optional parameters for the ActionGroupsClient.Get method. @@ -356,7 +356,7 @@ func (client *ActionGroupsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") + reqQP.Set("api-version", "2023-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -371,10 +371,79 @@ func (client *ActionGroupsClient) getHandleResponse(resp *http.Response) (Action return result, nil } +// GetNSP - Gets a specified NSP configuration for specified action group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - actionGroupName - The name of the action group. +// - networkSecurityPerimeterConfigurationName - The name for a network security perimeter configuration +// - options - ActionGroupsClientGetNSPOptions contains the optional parameters for the ActionGroupsClient.GetNSP method. +func (client *ActionGroupsClient) GetNSP(ctx context.Context, resourceGroupName string, actionGroupName string, networkSecurityPerimeterConfigurationName string, options *ActionGroupsClientGetNSPOptions) (ActionGroupsClientGetNSPResponse, error) { + var err error + const operationName = "ActionGroupsClient.GetNSP" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getNSPCreateRequest(ctx, resourceGroupName, actionGroupName, networkSecurityPerimeterConfigurationName, options) + if err != nil { + return ActionGroupsClientGetNSPResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ActionGroupsClientGetNSPResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ActionGroupsClientGetNSPResponse{}, err + } + resp, err := client.getNSPHandleResponse(httpResp) + return resp, err +} + +// getNSPCreateRequest creates the GetNSP request. +func (client *ActionGroupsClient) getNSPCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, networkSecurityPerimeterConfigurationName string, options *ActionGroupsClientGetNSPOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}/networkSecurityPerimeterConfigurations/{networkSecurityPerimeterConfigurationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if actionGroupName == "" { + return nil, errors.New("parameter actionGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{actionGroupName}", url.PathEscape(actionGroupName)) + if networkSecurityPerimeterConfigurationName == "" { + return nil, errors.New("parameter networkSecurityPerimeterConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkSecurityPerimeterConfigurationName}", url.PathEscape(networkSecurityPerimeterConfigurationName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getNSPHandleResponse handles the GetNSP response. +func (client *ActionGroupsClient) getNSPHandleResponse(resp *http.Response) (ActionGroupsClientGetNSPResponse, error) { + result := ActionGroupsClientGetNSPResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkSecurityPerimeterConfiguration); err != nil { + return ActionGroupsClientGetNSPResponse{}, err + } + return result, nil +} + // GetTestNotificationsAtActionGroupResourceLevel - Get the test notifications by the notification id // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01 +// Generated from API version 2023-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - actionGroupName - The name of the action group. // - notificationID - The notification id @@ -426,7 +495,7 @@ func (client *ActionGroupsClient) getTestNotificationsAtActionGroupResourceLevel return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") + reqQP.Set("api-version", "2023-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -443,7 +512,7 @@ func (client *ActionGroupsClient) getTestNotificationsAtActionGroupResourceLevel // NewListByResourceGroupPager - Get a list of all action groups in a resource group. // -// Generated from API version 2023-01-01 +// Generated from API version 2023-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ActionGroupsClientListByResourceGroupOptions contains the optional parameters for the ActionGroupsClient.NewListByResourceGroupPager // method. @@ -487,7 +556,7 @@ func (client *ActionGroupsClient) listByResourceGroupCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") + reqQP.Set("api-version", "2023-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -504,7 +573,7 @@ func (client *ActionGroupsClient) listByResourceGroupHandleResponse(resp *http.R // NewListBySubscriptionIDPager - Get a list of all action groups in a subscription. // -// Generated from API version 2023-01-01 +// Generated from API version 2023-09-01-preview // - options - ActionGroupsClientListBySubscriptionIDOptions contains the optional parameters for the ActionGroupsClient.NewListBySubscriptionIDPager // method. func (client *ActionGroupsClient) NewListBySubscriptionIDPager(options *ActionGroupsClientListBySubscriptionIDOptions) *runtime.Pager[ActionGroupsClientListBySubscriptionIDResponse] { @@ -543,7 +612,7 @@ func (client *ActionGroupsClient) listBySubscriptionIDCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") + reqQP.Set("api-version", "2023-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -558,10 +627,157 @@ func (client *ActionGroupsClient) listBySubscriptionIDHandleResponse(resp *http. return result, nil } +// NewListNSPPager - Gets a list of NSP configurations for specified action group. +// +// Generated from API version 2021-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - actionGroupName - The name of the action group. +// - options - ActionGroupsClientListNSPOptions contains the optional parameters for the ActionGroupsClient.NewListNSPPager +// method. +func (client *ActionGroupsClient) NewListNSPPager(resourceGroupName string, actionGroupName string, options *ActionGroupsClientListNSPOptions) *runtime.Pager[ActionGroupsClientListNSPResponse] { + return runtime.NewPager(runtime.PagingHandler[ActionGroupsClientListNSPResponse]{ + More: func(page ActionGroupsClientListNSPResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ActionGroupsClientListNSPResponse) (ActionGroupsClientListNSPResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ActionGroupsClient.NewListNSPPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listNSPCreateRequest(ctx, resourceGroupName, actionGroupName, options) + }, nil) + if err != nil { + return ActionGroupsClientListNSPResponse{}, err + } + return client.listNSPHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listNSPCreateRequest creates the ListNSP request. +func (client *ActionGroupsClient) listNSPCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, options *ActionGroupsClientListNSPOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}/networkSecurityPerimeterConfigurations" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if actionGroupName == "" { + return nil, errors.New("parameter actionGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{actionGroupName}", url.PathEscape(actionGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listNSPHandleResponse handles the ListNSP response. +func (client *ActionGroupsClient) listNSPHandleResponse(resp *http.Response) (ActionGroupsClientListNSPResponse, error) { + result := ActionGroupsClientListNSPResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkSecurityPerimeterConfigurationListResult); err != nil { + return ActionGroupsClientListNSPResponse{}, err + } + return result, nil +} + +// BeginReconcileNSP - Reconciles a specified NSP configuration for specified action group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - actionGroupName - The name of the action group. +// - networkSecurityPerimeterConfigurationName - The name for a network security perimeter configuration +// - options - ActionGroupsClientBeginReconcileNSPOptions contains the optional parameters for the ActionGroupsClient.BeginReconcileNSP +// method. +func (client *ActionGroupsClient) BeginReconcileNSP(ctx context.Context, resourceGroupName string, actionGroupName string, networkSecurityPerimeterConfigurationName string, options *ActionGroupsClientBeginReconcileNSPOptions) (*runtime.Poller[ActionGroupsClientReconcileNSPResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.reconcileNSP(ctx, resourceGroupName, actionGroupName, networkSecurityPerimeterConfigurationName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ActionGroupsClientReconcileNSPResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ActionGroupsClientReconcileNSPResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ReconcileNSP - Reconciles a specified NSP configuration for specified action group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-10-01 +func (client *ActionGroupsClient) reconcileNSP(ctx context.Context, resourceGroupName string, actionGroupName string, networkSecurityPerimeterConfigurationName string, options *ActionGroupsClientBeginReconcileNSPOptions) (*http.Response, error) { + var err error + const operationName = "ActionGroupsClient.BeginReconcileNSP" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.reconcileNSPCreateRequest(ctx, resourceGroupName, actionGroupName, networkSecurityPerimeterConfigurationName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// reconcileNSPCreateRequest creates the ReconcileNSP request. +func (client *ActionGroupsClient) reconcileNSPCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, networkSecurityPerimeterConfigurationName string, options *ActionGroupsClientBeginReconcileNSPOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}/networkSecurityPerimeterConfigurations/{networkSecurityPerimeterConfigurationName}/reconcile" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if actionGroupName == "" { + return nil, errors.New("parameter actionGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{actionGroupName}", url.PathEscape(actionGroupName)) + if networkSecurityPerimeterConfigurationName == "" { + return nil, errors.New("parameter networkSecurityPerimeterConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkSecurityPerimeterConfigurationName}", url.PathEscape(networkSecurityPerimeterConfigurationName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + // Update - Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01 +// Generated from API version 2023-09-01-preview // - 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. @@ -608,7 +824,7 @@ func (client *ActionGroupsClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") + reqQP.Set("api-version", "2023-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, actionGroupPatch); err != nil { diff --git a/sdk/resourcemanager/monitor/armmonitor/actiongroups_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/actiongroups_client_example_test.go deleted file mode 100644 index 1c00a65a8bdc..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/actiongroups_client_example_test.go +++ /dev/null @@ -1,938 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/createOrUpdateActionGroup.json -func ExampleActionGroupsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActionGroupsClient().CreateOrUpdate(ctx, "Default-NotificationRules", "SampleActionGroup", armmonitor.ActionGroupResource{ - Location: to.Ptr("Global"), - Tags: map[string]*string{}, - Properties: &armmonitor.ActionGroup{ - ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ - { - Name: to.Ptr("Sample armRole"), - RoleID: to.Ptr("8e3af657-a8ff-443c-a75c-2fe8c4bcb635"), - UseCommonAlertSchema: to.Ptr(true), - }}, - AutomationRunbookReceivers: []*armmonitor.AutomationRunbookReceiver{ - { - Name: to.Ptr("testRunbook"), - AutomationAccountID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest"), - IsGlobalRunbook: to.Ptr(false), - RunbookName: to.Ptr("Sample runbook"), - ServiceURI: to.Ptr(""), - UseCommonAlertSchema: to.Ptr(true), - WebhookResourceID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest/webhooks/Alert1510184037084"), - }}, - AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiver{ - { - Name: to.Ptr("Sample azureAppPush"), - EmailAddress: to.Ptr("johndoe@email.com"), - }}, - AzureFunctionReceivers: []*armmonitor.AzureFunctionReceiver{ - { - Name: to.Ptr("Sample azureFunction"), - FunctionAppResourceID: to.Ptr("/subscriptions/5def922a-3ed4-49c1-b9fd-05ec533819a3/resourceGroups/aznsTest/providers/Microsoft.Web/sites/testFunctionApp"), - FunctionName: to.Ptr("HttpTriggerCSharp1"), - HTTPTriggerURL: to.Ptr("http://test.me"), - UseCommonAlertSchema: to.Ptr(true), - }}, - EmailReceivers: []*armmonitor.EmailReceiver{ - { - Name: to.Ptr("John Doe's email"), - EmailAddress: to.Ptr("johndoe@email.com"), - UseCommonAlertSchema: to.Ptr(false), - }, - { - Name: to.Ptr("Jane Smith's email"), - EmailAddress: to.Ptr("janesmith@email.com"), - UseCommonAlertSchema: to.Ptr(true), - }}, - Enabled: to.Ptr(true), - EventHubReceivers: []*armmonitor.EventHubReceiver{ - { - Name: to.Ptr("Sample eventHub"), - EventHubName: to.Ptr("testEventHub"), - EventHubNameSpace: to.Ptr("testEventHubNameSpace"), - SubscriptionID: to.Ptr("187f412d-1758-44d9-b052-169e2564721d"), - TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - }}, - GroupShortName: to.Ptr("sample"), - ItsmReceivers: []*armmonitor.ItsmReceiver{ - { - Name: to.Ptr("Sample itsm"), - ConnectionID: to.Ptr("a3b9076c-ce8e-434e-85b4-aff10cb3c8f1"), - Region: to.Ptr("westcentralus"), - TicketConfiguration: to.Ptr("{\"PayloadRevision\":0,\"WorkItemType\":\"Incident\",\"UseTemplate\":false,\"WorkItemData\":\"{}\",\"CreateOneWIPerCI\":false}"), - WorkspaceID: to.Ptr("5def922a-3ed4-49c1-b9fd-05ec533819a3|55dfd1f8-7e59-4f89-bf56-4c82f5ace23c"), - }}, - LogicAppReceivers: []*armmonitor.LogicAppReceiver{ - { - Name: to.Ptr("Sample logicApp"), - CallbackURL: to.Ptr("https://prod-27.northcentralus.logic.azure.com/workflows/68e572e818e5457ba898763b7db90877/triggers/manual/paths/invoke/azns/test?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=Abpsb72UYJxPPvmDo937uzofupO5r_vIeWEx7KVHo7w"), - ResourceID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/LogicApp/providers/Microsoft.Logic/workflows/testLogicApp"), - UseCommonAlertSchema: to.Ptr(false), - }}, - SmsReceivers: []*armmonitor.SmsReceiver{ - { - Name: to.Ptr("John Doe's mobile"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("1234567890"), - }, - { - Name: to.Ptr("Jane Smith's mobile"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("0987654321"), - }}, - VoiceReceivers: []*armmonitor.VoiceReceiver{ - { - Name: to.Ptr("Sample voice"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("1234567890"), - }}, - WebhookReceivers: []*armmonitor.WebhookReceiver{ - { - Name: to.Ptr("Sample webhook 1"), - ServiceURI: to.Ptr("http://www.example.com/webhook1"), - UseCommonAlertSchema: to.Ptr(true), - }, - { - Name: to.Ptr("Sample webhook 2"), - IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - ServiceURI: to.Ptr("http://www.example.com/webhook2"), - TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - UseAADAuth: to.Ptr(true), - UseCommonAlertSchema: to.Ptr(true), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ActionGroupResource = armmonitor.ActionGroupResource{ - // Name: to.Ptr("SampleActionGroup"), - // Type: to.Ptr("Microsoft.Insights/ActionGroups"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-NotificationRules/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.ActionGroup{ - // ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ - // { - // Name: to.Ptr("Sample armRole"), - // RoleID: to.Ptr("8e3af657-a8ff-443c-a75c-2fe8c4bcb635"), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // AutomationRunbookReceivers: []*armmonitor.AutomationRunbookReceiver{ - // { - // Name: to.Ptr("testRunbook"), - // AutomationAccountID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest"), - // IsGlobalRunbook: to.Ptr(false), - // RunbookName: to.Ptr("Sample runbook"), - // ServiceURI: to.Ptr(""), - // UseCommonAlertSchema: to.Ptr(true), - // WebhookResourceID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest/webhooks/Alert1510184037084"), - // }}, - // AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiver{ - // { - // Name: to.Ptr("Sample azureAppPush"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // }}, - // AzureFunctionReceivers: []*armmonitor.AzureFunctionReceiver{ - // { - // Name: to.Ptr("Sample azureFunction"), - // FunctionAppResourceID: to.Ptr("/subscriptions/5def922a-3ed4-49c1-b9fd-05ec533819a3/resourceGroups/aznsTest/providers/Microsoft.Web/sites/testFunctionApp"), - // FunctionName: to.Ptr("HttpTriggerCSharp1"), - // HTTPTriggerURL: to.Ptr(""), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // EmailReceivers: []*armmonitor.EmailReceiver{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(true), - // EventHubReceivers: []*armmonitor.EventHubReceiver{ - // { - // Name: to.Ptr("Sample eventHub"), - // EventHubName: to.Ptr("testEventHub"), - // EventHubNameSpace: to.Ptr("testEventHubNameSpace"), - // SubscriptionID: to.Ptr("187f412d-1758-44d9-b052-169e2564721d"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseCommonAlertSchema: to.Ptr(false), - // }}, - // GroupShortName: to.Ptr("sample"), - // ItsmReceivers: []*armmonitor.ItsmReceiver{ - // { - // Name: to.Ptr("Sample itsm"), - // ConnectionID: to.Ptr("a3b9076c-ce8e-434e-85b4-aff10cb3c8f1"), - // Region: to.Ptr("westcentralus"), - // TicketConfiguration: to.Ptr("{\"PayloadRevision\":0,\"WorkItemType\":\"Incident\",\"UseTemplate\":false,\"WorkItemData\":\"{}\",\"CreateOneWIPerCI\":false}"), - // WorkspaceID: to.Ptr("5def922a-3ed4-49c1-b9fd-05ec533819a3|55dfd1f8-7e59-4f89-bf56-4c82f5ace23c"), - // }}, - // LogicAppReceivers: []*armmonitor.LogicAppReceiver{ - // { - // Name: to.Ptr("Sample logicApp"), - // CallbackURL: to.Ptr("https://prod-27.northcentralus.logic.azure.com/workflows/68e572e818e5457ba898763b7db90877/triggers/manual/paths/invoke/azns/test?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=Abpsb72UYJxPPvmDo937uzofupO5r_vIeWEx7KVHo7w"), - // ResourceID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/LogicApp/providers/Microsoft.Logic/workflows/testLogicApp"), - // UseCommonAlertSchema: to.Ptr(false), - // }}, - // SmsReceivers: []*armmonitor.SmsReceiver{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("1234567890"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiver{ - // { - // Name: to.Ptr("Sample voice"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("1234567890"), - // }}, - // WebhookReceivers: []*armmonitor.WebhookReceiver{ - // { - // Name: to.Ptr("Sample webhook 1"), - // ServiceURI: to.Ptr("http://www.example.com/webhook1"), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/getActionGroup.json -func ExampleActionGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActionGroupsClient().Get(ctx, "Default-NotificationRules", "SampleActionGroup", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ActionGroupResource = armmonitor.ActionGroupResource{ - // Name: to.Ptr("SampleActionGroup"), - // Type: to.Ptr("Microsoft.Insights/ActionGroups"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-NotificationRules/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.ActionGroup{ - // ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ - // }, - // AutomationRunbookReceivers: []*armmonitor.AutomationRunbookReceiver{ - // }, - // AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiver{ - // }, - // AzureFunctionReceivers: []*armmonitor.AzureFunctionReceiver{ - // }, - // EmailReceivers: []*armmonitor.EmailReceiver{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusDisabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(true), - // EventHubReceivers: []*armmonitor.EventHubReceiver{ - // }, - // GroupShortName: to.Ptr("sample"), - // ItsmReceivers: []*armmonitor.ItsmReceiver{ - // }, - // LogicAppReceivers: []*armmonitor.LogicAppReceiver{ - // }, - // SmsReceivers: []*armmonitor.SmsReceiver{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("1234567890"), - // Status: to.Ptr(armmonitor.ReceiverStatusDisabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiver{ - // }, - // WebhookReceivers: []*armmonitor.WebhookReceiver{ - // { - // Name: to.Ptr("Sample webhook"), - // ServiceURI: to.Ptr("http://www.example.com/webhook"), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/deleteActionGroup.json -func ExampleActionGroupsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewActionGroupsClient().Delete(ctx, "Default-NotificationRules", "SampleActionGroup", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/patchActionGroup.json -func ExampleActionGroupsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActionGroupsClient().Update(ctx, "Default-NotificationRules", "SampleActionGroup", armmonitor.ActionGroupPatchBody{ - Properties: &armmonitor.ActionGroupPatch{ - Enabled: to.Ptr(false), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ActionGroupResource = armmonitor.ActionGroupResource{ - // Name: to.Ptr("SampleActionGroup"), - // Type: to.Ptr("Microsoft.Insights/ActionGroups"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-NotificationRules/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armmonitor.ActionGroup{ - // ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ - // }, - // AutomationRunbookReceivers: []*armmonitor.AutomationRunbookReceiver{ - // }, - // AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiver{ - // }, - // AzureFunctionReceivers: []*armmonitor.AzureFunctionReceiver{ - // }, - // EmailReceivers: []*armmonitor.EmailReceiver{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(true), - // EventHubReceivers: []*armmonitor.EventHubReceiver{ - // }, - // GroupShortName: to.Ptr("sample"), - // ItsmReceivers: []*armmonitor.ItsmReceiver{ - // }, - // LogicAppReceivers: []*armmonitor.LogicAppReceiver{ - // }, - // SmsReceivers: []*armmonitor.SmsReceiver{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("1234567890"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiver{ - // }, - // WebhookReceivers: []*armmonitor.WebhookReceiver{ - // { - // Name: to.Ptr("Sample webhook"), - // ServiceURI: to.Ptr("http://www.example.com/webhook"), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/postTestNotificationsAtActionGroupResourceLevel.json -func ExampleActionGroupsClient_BeginCreateNotificationsAtActionGroupResourceLevel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewActionGroupsClient().BeginCreateNotificationsAtActionGroupResourceLevel(ctx, "TestRgName", "TestAgName", armmonitor.NotificationRequestBody{ - AlertType: to.Ptr("budget"), - ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ - { - Name: to.Ptr("ArmRole-Common"), - RoleID: to.Ptr("11111111-1111-1111-1111-111111111111"), - UseCommonAlertSchema: to.Ptr(true), - }, - { - Name: to.Ptr("ArmRole-nonCommon"), - RoleID: to.Ptr("11111111-1111-1111-1111-111111111111"), - UseCommonAlertSchema: to.Ptr(false), - }}, - AutomationRunbookReceivers: []*armmonitor.AutomationRunbookReceiver{ - { - Name: to.Ptr("testRunbook"), - AutomationAccountID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest"), - IsGlobalRunbook: to.Ptr(false), - RunbookName: to.Ptr("Sample runbook"), - ServiceURI: to.Ptr("http://test.me"), - UseCommonAlertSchema: to.Ptr(true), - WebhookResourceID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest/webhooks/Alert1510184037084"), - }}, - AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiver{ - { - Name: to.Ptr("Sample azureAppPush"), - EmailAddress: to.Ptr("johndoe@email.com"), - }}, - AzureFunctionReceivers: []*armmonitor.AzureFunctionReceiver{ - { - Name: to.Ptr("Sample azureFunction"), - FunctionAppResourceID: to.Ptr("/subscriptions/5def922a-3ed4-49c1-b9fd-05ec533819a3/resourceGroups/aznsTest/providers/Microsoft.Web/sites/testFunctionApp"), - FunctionName: to.Ptr("HttpTriggerCSharp1"), - HTTPTriggerURL: to.Ptr("http://test.me"), - UseCommonAlertSchema: to.Ptr(true), - }}, - EmailReceivers: []*armmonitor.EmailReceiver{ - { - Name: to.Ptr("John Doe's email"), - EmailAddress: to.Ptr("johndoe@email.com"), - UseCommonAlertSchema: to.Ptr(false), - }, - { - Name: to.Ptr("Jane Smith's email"), - EmailAddress: to.Ptr("janesmith@email.com"), - UseCommonAlertSchema: to.Ptr(true), - }}, - EventHubReceivers: []*armmonitor.EventHubReceiver{ - { - Name: to.Ptr("Sample eventHub"), - EventHubName: to.Ptr("testEventHub"), - EventHubNameSpace: to.Ptr("testEventHubNameSpace"), - SubscriptionID: to.Ptr("187f412d-1758-44d9-b052-169e2564721d"), - TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - }}, - ItsmReceivers: []*armmonitor.ItsmReceiver{ - { - Name: to.Ptr("Sample itsm"), - ConnectionID: to.Ptr("a3b9076c-ce8e-434e-85b4-aff10cb3c8f1"), - Region: to.Ptr("westcentralus"), - TicketConfiguration: to.Ptr("{\"PayloadRevision\":0,\"WorkItemType\":\"Incident\",\"UseTemplate\":false,\"WorkItemData\":\"{}\",\"CreateOneWIPerCI\":false}"), - WorkspaceID: to.Ptr("5def922a-3ed4-49c1-b9fd-05ec533819a3|55dfd1f8-7e59-4f89-bf56-4c82f5ace23c"), - }}, - LogicAppReceivers: []*armmonitor.LogicAppReceiver{ - { - Name: to.Ptr("Sample logicApp"), - CallbackURL: to.Ptr("https://prod-27.northcentralus.logic.azure.com/workflows/68e572e818e5457ba898763b7db90877/triggers/manual/paths/invoke/azns/test?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=Abpsb72UYJxPPvmDo937uzofupO5r_vIeWEx7KVHo7w"), - ResourceID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/LogicApp/providers/Microsoft.Logic/workflows/testLogicApp"), - UseCommonAlertSchema: to.Ptr(false), - }}, - SmsReceivers: []*armmonitor.SmsReceiver{ - { - Name: to.Ptr("John Doe's mobile"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("1234567890"), - }, - { - Name: to.Ptr("Jane Smith's mobile"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("0987654321"), - }}, - VoiceReceivers: []*armmonitor.VoiceReceiver{ - { - Name: to.Ptr("Sample voice"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("1234567890"), - }}, - WebhookReceivers: []*armmonitor.WebhookReceiver{ - { - Name: to.Ptr("Sample webhook 1"), - ServiceURI: to.Ptr("http://www.example.com/webhook1"), - UseCommonAlertSchema: to.Ptr(true), - }, - { - Name: to.Ptr("Sample webhook 2"), - IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - ServiceURI: to.Ptr("http://www.example.com/webhook2"), - TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - UseAADAuth: to.Ptr(true), - UseCommonAlertSchema: to.Ptr(true), - }}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TestNotificationDetailsResponse = armmonitor.TestNotificationDetailsResponse{ - // ActionDetails: []*armmonitor.ActionDetail{ - // { - // MechanismType: to.Ptr("AzureAppPush"), - // Name: to.Ptr("AzureAppPush-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.8620629+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("AzureFunction"), - // Name: to.Ptr("AzureFunction-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0623319+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Email"), - // Name: to.Ptr("Email-name"), - // SendTime: to.Ptr("2021-09-21T04:52:40.7480368+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("LogicApp"), - // Name: to.Ptr("LogicApp-Name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.2473419+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Webhook"), - // Name: to.Ptr("Webhook-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("SecureWebhook"), - // Name: to.Ptr("SecureWebhook-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Sms"), - // Name: to.Ptr("Sms-name"), - // SendTime: to.Ptr("2021-09-21T04:52:41.353015+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Voice"), - // Name: to.Ptr("Voice-name"), - // SendTime: to.Ptr("2021-09-21T04:52:41.6330734+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("EventHub"), - // Name: to.Ptr("EventHub-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("AutomationRunbook"), - // Name: to.Ptr("AutomationRunbook-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Itsm"), - // Name: to.Ptr("Itsm-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }}, - // CompletedTime: to.Ptr("0001-01-01T00:00:00+00:00"), - // Context: &armmonitor.Context{ - // ContextType: to.Ptr("Microsoft.Insights/Budget"), - // NotificationSource: to.Ptr("Microsoft.Insights/TestNotification"), - // }, - // CreatedTime: to.Ptr("2021-09-21T04:52:29.5091168+00:00"), - // State: to.Ptr("Completed"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/getTestNotificationsAtActionGroupResourceLevel.json -func ExampleActionGroupsClient_GetTestNotificationsAtActionGroupResourceLevel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActionGroupsClient().GetTestNotificationsAtActionGroupResourceLevel(ctx, "TestRgName", "TestAgName", "11000222191287", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TestNotificationDetailsResponse = armmonitor.TestNotificationDetailsResponse{ - // ActionDetails: []*armmonitor.ActionDetail{ - // { - // MechanismType: to.Ptr("AzureAppPush"), - // Name: to.Ptr("AzureAppPush-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.8620629+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("AzureFunction"), - // Name: to.Ptr("AzureFunction-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0623319+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Email"), - // Name: to.Ptr("Email-name"), - // SendTime: to.Ptr("2021-09-21T04:52:40.7480368+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("LogicApp"), - // Name: to.Ptr("LogicApp-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.2473419+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Webhook"), - // Name: to.Ptr("Webhook-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("SecureWebhook"), - // Name: to.Ptr("SecureWebhook-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Sms"), - // Name: to.Ptr("Sms-name"), - // SendTime: to.Ptr("2021-09-21T04:52:41.353015+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Voice"), - // Name: to.Ptr("Voice-name"), - // SendTime: to.Ptr("2021-09-21T04:52:41.6330734+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("EventHub"), - // Name: to.Ptr("EventHub-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("AutomationRunbook"), - // Name: to.Ptr("AutomationRunbook-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Itsm"), - // Name: to.Ptr("Itsm-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }}, - // CompletedTime: to.Ptr("0001-01-01T00:00:00+00:00"), - // Context: &armmonitor.Context{ - // ContextType: to.Ptr("Microsoft.Insights/Budget"), - // NotificationSource: to.Ptr("Microsoft.Insights/TestNotification"), - // }, - // CreatedTime: to.Ptr("2021-09-21T04:52:29.5091168+00:00"), - // State: to.Ptr("Completed"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/listActionGroups.json -func ExampleActionGroupsClient_NewListBySubscriptionIDPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewActionGroupsClient().NewListBySubscriptionIDPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ActionGroupList = armmonitor.ActionGroupList{ - // Value: []*armmonitor.ActionGroupResource{ - // { - // Name: to.Ptr("SampleActionGroup"), - // Type: to.Ptr("Microsoft.Insights/ActionGroups"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-NotificationRules/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.ActionGroup{ - // ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ - // }, - // AutomationRunbookReceivers: []*armmonitor.AutomationRunbookReceiver{ - // }, - // AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiver{ - // }, - // AzureFunctionReceivers: []*armmonitor.AzureFunctionReceiver{ - // }, - // EmailReceivers: []*armmonitor.EmailReceiver{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusDisabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(true), - // EventHubReceivers: []*armmonitor.EventHubReceiver{ - // }, - // GroupShortName: to.Ptr("sample"), - // ItsmReceivers: []*armmonitor.ItsmReceiver{ - // }, - // LogicAppReceivers: []*armmonitor.LogicAppReceiver{ - // }, - // SmsReceivers: []*armmonitor.SmsReceiver{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("1234567890"), - // Status: to.Ptr(armmonitor.ReceiverStatusDisabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiver{ - // }, - // WebhookReceivers: []*armmonitor.WebhookReceiver{ - // { - // Name: to.Ptr("Sample webhook"), - // ServiceURI: to.Ptr("http://www.example.com/webhook"), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // }, - // { - // Name: to.Ptr("SampleActionGroup2"), - // Type: to.Ptr("Microsoft.Insights/ActionGroups"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-NotificationRules/providers/microsoft.insights/actionGroups/SampleActionGroup2"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.ActionGroup{ - // ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ - // }, - // AutomationRunbookReceivers: []*armmonitor.AutomationRunbookReceiver{ - // }, - // AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiver{ - // }, - // AzureFunctionReceivers: []*armmonitor.AzureFunctionReceiver{ - // }, - // EmailReceivers: []*armmonitor.EmailReceiver{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(false), - // EventHubReceivers: []*armmonitor.EventHubReceiver{ - // }, - // GroupShortName: to.Ptr("sample2"), - // ItsmReceivers: []*armmonitor.ItsmReceiver{ - // }, - // LogicAppReceivers: []*armmonitor.LogicAppReceiver{ - // }, - // SmsReceivers: []*armmonitor.SmsReceiver{ - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiver{ - // }, - // WebhookReceivers: []*armmonitor.WebhookReceiver{ - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/enableReceiver.json -func ExampleActionGroupsClient_EnableReceiver() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewActionGroupsClient().EnableReceiver(ctx, "Default-NotificationRules", "SampleActionGroup", armmonitor.EnableRequest{ - ReceiverName: to.Ptr("John Doe's mobile"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client.go b/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client.go index 73bf59a32024..c7403262ddae 100644 --- a/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client.go @@ -28,7 +28,7 @@ type ActivityLogAlertsClient struct { } // NewActivityLogAlertsClient creates a new instance of ActivityLogAlertsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewActivityLogAlertsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ActivityLogAlertsClient, error) { diff --git a/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client_example_test.go deleted file mode 100644 index 200ad713e952..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client_example_test.go +++ /dev/null @@ -1,611 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_CreateOrUpdate.json -func ExampleActivityLogAlertsClient_CreateOrUpdate_createOrUpdateAnActivityLogAlertRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActivityLogAlertsClient().CreateOrUpdate(ctx, "MyResourceGroup", "SampleActivityLogAlertRule", armmonitor.ActivityLogAlertResource{ - Location: to.Ptr("Global"), - Tags: map[string]*string{}, - Properties: &armmonitor.AlertRuleProperties{ - Description: to.Ptr("Description of sample Activity Log Alert rule."), - Actions: &armmonitor.ActionList{ - ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - { - ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup"), - WebhookProperties: map[string]*string{ - "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - }, - }}, - }, - Condition: &armmonitor.AlertRuleAllOfCondition{ - AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - { - Equals: to.Ptr("Administrative"), - Field: to.Ptr("category"), - }, - { - Equals: to.Ptr("Error"), - Field: to.Ptr("level"), - }}, - }, - Enabled: to.Ptr(true), - Scopes: []*string{ - to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ActivityLogAlertResource = armmonitor.ActivityLogAlertResource{ - // Name: to.Ptr("SampleActivityLogAlertRule"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("Administrative"), - // Field: to.Ptr("Category"), - // }, - // { - // Equals: to.Ptr("Error"), - // Field: to.Ptr("Level"), - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_CreateOrUpdateRuleWithAnyOfCondition.json -func ExampleActivityLogAlertsClient_CreateOrUpdate_createOrUpdateAnActivityLogAlertRuleWithAnyOfCondition() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActivityLogAlertsClient().CreateOrUpdate(ctx, "MyResourceGroup", "SampleActivityLogAlertRuleWithAnyOfCondition", armmonitor.ActivityLogAlertResource{ - Location: to.Ptr("Global"), - Tags: map[string]*string{}, - Properties: &armmonitor.AlertRuleProperties{ - Description: to.Ptr("Description of sample Activity Log Alert rule with 'anyOf' condition."), - Actions: &armmonitor.ActionList{ - ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - { - ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup"), - WebhookProperties: map[string]*string{ - "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - }, - }}, - }, - Condition: &armmonitor.AlertRuleAllOfCondition{ - AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - { - Equals: to.Ptr("ServiceHealth"), - Field: to.Ptr("category"), - }, - { - AnyOf: []*armmonitor.AlertRuleLeafCondition{ - { - Equals: to.Ptr("Incident"), - Field: to.Ptr("properties.incidentType"), - }, - { - Equals: to.Ptr("Maintenance"), - Field: to.Ptr("properties.incidentType"), - }}, - }}, - }, - Enabled: to.Ptr(true), - Scopes: []*string{ - to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ActivityLogAlertResource = armmonitor.ActivityLogAlertResource{ - // Name: to.Ptr("SampleActivityLogAlertRuleWithAnyOfCondition"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRuleWithAnyOfCondition"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule with 'anyOf' condition."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("ServiceHealth"), - // Field: to.Ptr("category"), - // }, - // { - // AnyOf: []*armmonitor.AlertRuleLeafCondition{ - // { - // Equals: to.Ptr("Incident"), - // Field: to.Ptr("properties.incidentType"), - // }, - // { - // Equals: to.Ptr("Maintenance"), - // Field: to.Ptr("properties.incidentType"), - // }}, - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_CreateOrUpdateRuleWithContainsAny.json -func ExampleActivityLogAlertsClient_CreateOrUpdate_createOrUpdateAnActivityLogAlertRuleWithContainsAny() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActivityLogAlertsClient().CreateOrUpdate(ctx, "MyResourceGroup", "SampleActivityLogAlertRuleWithContainsAny", armmonitor.ActivityLogAlertResource{ - Location: to.Ptr("Global"), - Tags: map[string]*string{}, - Properties: &armmonitor.AlertRuleProperties{ - Description: to.Ptr("Description of sample Activity Log Alert rule with 'containsAny'."), - Actions: &armmonitor.ActionList{ - ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - { - ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup"), - WebhookProperties: map[string]*string{ - "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - }, - }}, - }, - Condition: &armmonitor.AlertRuleAllOfCondition{ - AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - { - Equals: to.Ptr("ServiceHealth"), - Field: to.Ptr("category"), - }, - { - ContainsAny: []*string{ - to.Ptr("North Europe"), - to.Ptr("West Europe")}, - Field: to.Ptr("properties.impactedServices[*].ImpactedRegions[*].RegionName"), - }}, - }, - Enabled: to.Ptr(true), - Scopes: []*string{ - to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ActivityLogAlertResource = armmonitor.ActivityLogAlertResource{ - // Name: to.Ptr("SampleActivityLogAlertRuleWithContainsAny"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRuleWithContainsAny"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule with 'containsAny'."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("ServiceHealth"), - // Field: to.Ptr("category"), - // }, - // { - // ContainsAny: []*string{ - // to.Ptr("North Europe"), - // to.Ptr("West Europe")}, - // Field: to.Ptr("properties.impactedServices[*].ImpactedRegions[*].RegionName"), - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_Get.json -func ExampleActivityLogAlertsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActivityLogAlertsClient().Get(ctx, "MyResourceGroup", "SampleActivityLogAlertRule", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ActivityLogAlertResource = armmonitor.ActivityLogAlertResource{ - // Name: to.Ptr("SampleActivityLogAlertRule"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("Administrative"), - // Field: to.Ptr("category"), - // }, - // { - // Equals: to.Ptr("Error"), - // Field: to.Ptr("level"), - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_Delete.json -func ExampleActivityLogAlertsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewActivityLogAlertsClient().Delete(ctx, "MyResourceGroup", "SampleActivityLogAlertRule", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_Update.json -func ExampleActivityLogAlertsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActivityLogAlertsClient().Update(ctx, "MyResourceGroup", "SampleActivityLogAlertRule", armmonitor.AlertRulePatchObject{ - Properties: &armmonitor.AlertRulePatchProperties{ - Enabled: to.Ptr(false), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ActivityLogAlertResource = armmonitor.ActivityLogAlertResource{ - // Name: to.Ptr("SampleActivityLogAlertRule"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("Administrative"), - // Field: to.Ptr("category"), - // }, - // { - // Equals: to.Ptr("Error"), - // Field: to.Ptr("level"), - // }}, - // }, - // Enabled: to.Ptr(false), - // Scopes: []*string{ - // to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_ListBySubscriptionId.json -func ExampleActivityLogAlertsClient_NewListBySubscriptionIDPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewActivityLogAlertsClient().NewListBySubscriptionIDPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AlertRuleList = armmonitor.AlertRuleList{ - // Value: []*armmonitor.ActivityLogAlertResource{ - // { - // Name: to.Ptr("SampleActivityLogAlertRule1"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup1/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule1"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup1/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("Administrative"), - // Field: to.Ptr("category"), - // }, - // { - // Equals: to.Ptr("Error"), - // Field: to.Ptr("level"), - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - // }, - // }, - // { - // Name: to.Ptr("SampleActivityLogAlertRule2"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup2/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule2"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup2/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("Administrative"), - // Field: to.Ptr("category"), - // }, - // { - // Equals: to.Ptr("Succeeded"), - // Field: to.Ptr("status"), - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup2")}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_ListByResourceGroupName.json -func ExampleActivityLogAlertsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewActivityLogAlertsClient().NewListByResourceGroupPager("MyResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AlertRuleList = armmonitor.AlertRuleList{ - // Value: []*armmonitor.ActivityLogAlertResource{ - // { - // Name: to.Ptr("SampleActivityLogAlertRule1"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule1"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("Administrative"), - // Field: to.Ptr("category"), - // }, - // { - // Equals: to.Ptr("Error"), - // Field: to.Ptr("level"), - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - // }, - // }, - // { - // Name: to.Ptr("SampleActivityLogAlertRule2"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule2"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("Administrative"), - // Field: to.Ptr("category"), - // }, - // { - // Equals: to.Ptr("Succeeded"), - // Field: to.Ptr("status"), - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup")}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/activitylogs_client.go b/sdk/resourcemanager/monitor/armmonitor/activitylogs_client.go index 492b618e1a55..5d41fdc11311 100644 --- a/sdk/resourcemanager/monitor/armmonitor/activitylogs_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/activitylogs_client.go @@ -28,7 +28,7 @@ type ActivityLogsClient struct { } // NewActivityLogsClient creates a new instance of ActivityLogsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewActivityLogsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ActivityLogsClient, error) { @@ -96,11 +96,11 @@ func (client *ActivityLogsClient) listCreateRequest(ctx context.Context, filter return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-04-01") reqQP.Set("$filter", filter) if options != nil && options.Select != nil { reqQP.Set("$select", *options.Select) } + reqQP.Set("api-version", "2015-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/monitor/armmonitor/activitylogs_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/activitylogs_client_example_test.go deleted file mode 100644 index f77fa9b69702..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/activitylogs_client_example_test.go +++ /dev/null @@ -1,168 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetActivityLogsFiltered.json -func ExampleActivityLogsClient_NewListPager_getActivityLogsWithFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewActivityLogsClient().NewListPager("eventTimestamp ge '2015-01-21T20:00:00Z' and eventTimestamp le '2015-01-23T20:00:00Z' and resourceGroupName eq 'MSSupportGroup'", &armmonitor.ActivityLogsClientListOptions{Select: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EventDataCollection = armmonitor.EventDataCollection{ - // Value: []*armmonitor.EventData{ - // { - // OperationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // Description: to.Ptr(""), - // Authorization: &armmonitor.SenderAuthorization{ - // Action: to.Ptr("microsoft.support/supporttickets/write"), - // Role: to.Ptr("Subscription Admin"), - // Scope: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841"), - // }, - // Caller: to.Ptr("admin@contoso.com"), - // Claims: map[string]*string{ - // "name": to.Ptr("John Smith"), - // "appid": to.Ptr("c44b4083-3bq0-49c1-b47d-974e53cbdf3c"), - // "appidacr": to.Ptr("2"), - // "aud": to.Ptr("https://management.core.windows.net/"), - // "exp": to.Ptr("1421880271"), - // "groups": to.Ptr("cacfe77c-e058-4712-83qw-f9b08849fd60,7f71d11d-4c41-4b23-99d2-d32ce7aa621c,31522864-0578-4ea0-9gdc-e66cc564d18c"), - // "http://schemas.microsoft.com/claims/authnclassreference": to.Ptr("1"), - // "http://schemas.microsoft.com/claims/authnmethodsreferences": to.Ptr("pwd"), - // "http://schemas.microsoft.com/identity/claims/objectidentifier": to.Ptr("2468adf0-8211-44e3-95xq-85137af64708"), - // "http://schemas.microsoft.com/identity/claims/scope": to.Ptr("user_impersonation"), - // "http://schemas.microsoft.com/identity/claims/tenantid": to.Ptr("1e8d8218-c5e7-4578-9acc-9abbd5d23315"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname": to.Ptr("John"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name": to.Ptr("admin@contoso.com"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier": to.Ptr("9vckmEGF7zDKk1YzIY8k0t1_EAPaXoeHyPRn6f413zM"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname": to.Ptr("Smith"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn": to.Ptr("admin@contoso.com"), - // "iat": to.Ptr("1421876371"), - // "iss": to.Ptr("https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/"), - // "nbf": to.Ptr("1421876371"), - // "puid": to.Ptr("20030000801A118C"), - // "ver": to.Ptr("1.0"), - // }, - // CorrelationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // EventDataID: to.Ptr("44ade6b4-3813-45e6-ae27-7420a95fa2f8"), - // EventName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("End request"), - // Value: to.Ptr("EndRequest"), - // }, - // EventTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:26.979Z"); return t}()), - // HTTPRequest: &armmonitor.HTTPRequestInfo{ - // Method: to.Ptr("PUT"), - // ClientIPAddress: to.Ptr("192.168.35.115"), - // ClientRequestID: to.Ptr("27003b25-91d3-418f-8eb1-29e537dcb249"), - // }, - // ID: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841/events/44ade6b4-3813-45e6-ae27-7420a95fa2f8/ticks/635574752669792776"), - // Level: to.Ptr(armmonitor.EventLevelInformational), - // OperationName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support/supporttickets/write"), - // Value: to.Ptr("microsoft.support/supporttickets/write"), - // }, - // Properties: map[string]*string{ - // "statusCode": to.Ptr("Created"), - // }, - // ResourceGroupName: to.Ptr("MSSupportGroup"), - // ResourceProviderName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support"), - // Value: to.Ptr("microsoft.support"), - // }, - // Status: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Succeeded"), - // Value: to.Ptr("Succeeded"), - // }, - // SubStatus: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Created (HTTP Status Code: 201)"), - // Value: to.Ptr("Created"), - // }, - // SubmissionTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:39.993Z"); return t}()), - // SubscriptionID: to.Ptr("089bd33f-d4ec-47fe-8ba5-0753aa5c5b33"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetActivityLogsFilteredAndSelected.json -func ExampleActivityLogsClient_NewListPager_getActivityLogsWithFilterAndSelect() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewActivityLogsClient().NewListPager("eventTimestamp ge '2015-01-21T20:00:00Z' and eventTimestamp le '2015-01-23T20:00:00Z' and resourceGroupName eq 'MSSupportGroup'", &armmonitor.ActivityLogsClientListOptions{Select: to.Ptr("eventName,id,resourceGroupName,resourceProviderName,operationName,status,eventTimestamp,correlationId,submissionTimestamp,level")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EventDataCollection = armmonitor.EventDataCollection{ - // Value: []*armmonitor.EventData{ - // { - // CorrelationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // EventName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("End request"), - // Value: to.Ptr("EndRequest"), - // }, - // EventTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:26.979Z"); return t}()), - // ID: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841/events/44ade6b4-3813-45e6-ae27-7420a95fa2f8/ticks/635574752669792776"), - // Level: to.Ptr(armmonitor.EventLevelInformational), - // OperationName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support/supporttickets/write"), - // Value: to.Ptr("microsoft.support/supporttickets/write"), - // }, - // ResourceGroupName: to.Ptr("MSSupportGroup"), - // ResourceProviderName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support"), - // Value: to.Ptr("microsoft.support"), - // }, - // Status: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Succeeded"), - // Value: to.Ptr("Succeeded"), - // }, - // SubmissionTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:39.993Z"); return t}()), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client.go b/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client.go index caf0f7b0d2bb..f6a2c015ff6d 100644 --- a/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client.go @@ -28,7 +28,7 @@ type AlertRuleIncidentsClient struct { } // NewAlertRuleIncidentsClient creates a new instance of AlertRuleIncidentsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAlertRuleIncidentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertRuleIncidentsClient, error) { diff --git a/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client_example_test.go deleted file mode 100644 index a7ea44b05299..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client_example_test.go +++ /dev/null @@ -1,80 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/getAlertRuleIncident.json -func ExampleAlertRuleIncidentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertRuleIncidentsClient().Get(ctx, "Rac46PostSwapRG", "myRuleName", "Website_started", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Incident = armmonitor.Incident{ - // Name: to.Ptr("Website_started"), - // ActivatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-13T15:45:26.979Z"); return t}()), - // IsActive: to.Ptr(true), - // ResolvedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-13T22:14:28.979Z"); return t}()), - // RuleName: to.Ptr("myRuleName"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/listAlertRuleIncidents.json -func ExampleAlertRuleIncidentsClient_NewListByAlertRulePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAlertRuleIncidentsClient().NewListByAlertRulePager("Rac46PostSwapRG", "myRuleName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.IncidentListResult = armmonitor.IncidentListResult{ - // Value: []*armmonitor.Incident{ - // { - // Name: to.Ptr("Website_started"), - // ActivatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-13T15:45:26.979Z"); return t}()), - // IsActive: to.Ptr(true), - // ResolvedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-13T22:14:28.979Z"); return t}()), - // RuleName: to.Ptr("myRuleName"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/alertrules_client.go b/sdk/resourcemanager/monitor/armmonitor/alertrules_client.go index e22582113f98..607e7b3b77f4 100644 --- a/sdk/resourcemanager/monitor/armmonitor/alertrules_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/alertrules_client.go @@ -28,7 +28,7 @@ type AlertRulesClient struct { } // NewAlertRulesClient creates a new instance of AlertRulesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAlertRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertRulesClient, error) { diff --git a/sdk/resourcemanager/monitor/armmonitor/alertrules_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/alertrules_client_example_test.go deleted file mode 100644 index 653ea80a2dec..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/alertrules_client_example_test.go +++ /dev/null @@ -1,416 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/createOrUpdateAlertRule.json -func ExampleAlertRulesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertRulesClient().CreateOrUpdate(ctx, "Rac46PostSwapRG", "chiricutin", armmonitor.AlertRuleResource{ - Location: to.Ptr("West US"), - Tags: map[string]*string{}, - Properties: &armmonitor.AlertRule{ - Name: to.Ptr("chiricutin"), - Description: to.Ptr("Pura Vida"), - Actions: []armmonitor.RuleActionClassification{}, - Condition: &armmonitor.ThresholdRuleCondition{ - DataSource: &armmonitor.RuleMetricDataSource{ - ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), - ResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest"), - MetricName: to.Ptr("Requests"), - }, - ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"), - Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - Threshold: to.Ptr[float64](3), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationOperatorTotal), - WindowSize: to.Ptr("PT5M"), - }, - IsEnabled: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AlertRuleResource = armmonitor.AlertRuleResource{ - // Name: to.Ptr("chiricutin"), - // Type: to.Ptr("Microsoft.Insights/alertRules"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/chiricutin"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage"), - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.AlertRule{ - // Name: to.Ptr("chiricutin"), - // Description: to.Ptr("Pura Vida"), - // Actions: []armmonitor.RuleActionClassification{ - // }, - // Condition: &armmonitor.ThresholdRuleCondition{ - // DataSource: &armmonitor.RuleMetricDataSource{ - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), - // ResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest"), - // MetricName: to.Ptr("Requests"), - // }, - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Threshold: to.Ptr[float64](3), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationOperatorTotal), - // WindowSize: to.Ptr("PT5M"), - // }, - // IsEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-11-23T21:23:52.022Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/deleteAlertRule.json -func ExampleAlertRulesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAlertRulesClient().Delete(ctx, "Rac46PostSwapRG", "chiricutin", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/getAlertRule.json -func ExampleAlertRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertRulesClient().Get(ctx, "Rac46PostSwapRG", "chiricutin", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AlertRuleResource = armmonitor.AlertRuleResource{ - // Name: to.Ptr("chiricutin"), - // Type: to.Ptr("Microsoft.Insights/alertRules"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/chiricutin"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage"), - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.AlertRule{ - // Name: to.Ptr("chiricutin"), - // Description: to.Ptr("Pura Vida"), - // Actions: []armmonitor.RuleActionClassification{ - // }, - // Condition: &armmonitor.ThresholdRuleCondition{ - // DataSource: &armmonitor.RuleMetricDataSource{ - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), - // ResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest"), - // MetricName: to.Ptr("Requests"), - // }, - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Threshold: to.Ptr[float64](3), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationOperatorTotal), - // WindowSize: to.Ptr("PT5M"), - // }, - // IsEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-11-23T21:23:52.022Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/patchAlertRule.json -func ExampleAlertRulesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertRulesClient().Update(ctx, "Rac46PostSwapRG", "chiricutin", armmonitor.AlertRuleResourcePatch{ - Properties: &armmonitor.AlertRule{ - Name: to.Ptr("chiricutin"), - Description: to.Ptr("Pura Vida"), - Actions: []armmonitor.RuleActionClassification{}, - Condition: &armmonitor.ThresholdRuleCondition{ - DataSource: &armmonitor.RuleMetricDataSource{ - ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), - ResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest"), - MetricName: to.Ptr("Requests"), - }, - ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"), - Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - Threshold: to.Ptr[float64](3), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationOperatorTotal), - WindowSize: to.Ptr("PT5M"), - }, - IsEnabled: to.Ptr(true), - }, - Tags: map[string]*string{ - "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AlertRuleResource = armmonitor.AlertRuleResource{ - // Name: to.Ptr("chiricutin"), - // Type: to.Ptr("Microsoft.Insights/alertRules"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/chiricutin"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary"), - // }, - // Properties: &armmonitor.AlertRule{ - // Name: to.Ptr("chiricutin"), - // Description: to.Ptr("Pura Vida"), - // Actions: []armmonitor.RuleActionClassification{ - // }, - // Condition: &armmonitor.ThresholdRuleCondition{ - // DataSource: &armmonitor.RuleMetricDataSource{ - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), - // ResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest"), - // MetricName: to.Ptr("Requests"), - // }, - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Threshold: to.Ptr[float64](3), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationOperatorTotal), - // WindowSize: to.Ptr("PT5M"), - // }, - // IsEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-11-23T21:23:52.022Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/listAlertRule.json -func ExampleAlertRulesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAlertRulesClient().NewListByResourceGroupPager("Rac46PostSwapRG", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AlertRuleResourceCollection = armmonitor.AlertRuleResourceCollection{ - // Value: []*armmonitor.AlertRuleResource{ - // { - // Name: to.Ptr("myRuleName"), - // Type: to.Ptr("Microsoft.Insights/alertRules"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/myRuleName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage"), - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.AlertRule{ - // Name: to.Ptr("myRuleName"), - // Description: to.Ptr("Pura Vida"), - // Actions: []armmonitor.RuleActionClassification{ - // &armmonitor.RuleEmailAction{ - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleEmailAction"), - // CustomEmails: []*string{ - // to.Ptr("gu@ms.com"), - // to.Ptr("su@ms.net")}, - // SendToServiceOwners: to.Ptr(true), - // }}, - // Condition: &armmonitor.ThresholdRuleCondition{ - // DataSource: &armmonitor.RuleMetricDataSource{ - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), - // ResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest"), - // MetricName: to.Ptr("Requests"), - // }, - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Threshold: to.Ptr[float64](2), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationOperatorTotal), - // WindowSize: to.Ptr("PT5M"), - // }, - // IsEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-11-10T21:04:39.000Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("chiricutin0"), - // Type: to.Ptr("Microsoft.Insights/alertRules"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/chiricutin0"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage"), - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.AlertRule{ - // Name: to.Ptr("chiricutin0"), - // Description: to.Ptr("Pura Vida 0"), - // Actions: []armmonitor.RuleActionClassification{ - // }, - // Condition: &armmonitor.ThresholdRuleCondition{ - // DataSource: &armmonitor.RuleMetricDataSource{ - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), - // ResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest"), - // MetricName: to.Ptr("Requests"), - // }, - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Threshold: to.Ptr[float64](2), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationOperatorTotal), - // WindowSize: to.Ptr("PT5M"), - // }, - // IsEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-11-10T21:04:39.108Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/listAlertRuleBySubscription.json -func ExampleAlertRulesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAlertRulesClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AlertRuleResourceCollection = armmonitor.AlertRuleResourceCollection{ - // Value: []*armmonitor.AlertRuleResource{ - // { - // Name: to.Ptr("myRuleName"), - // Type: to.Ptr("Microsoft.Insights/alertRules"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/myRuleName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage"), - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.AlertRule{ - // Name: to.Ptr("myRuleName"), - // Description: to.Ptr("Pura Vida"), - // Actions: []armmonitor.RuleActionClassification{ - // &armmonitor.RuleEmailAction{ - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleEmailAction"), - // CustomEmails: []*string{ - // to.Ptr("gu@ms.com"), - // to.Ptr("su@ms.net")}, - // SendToServiceOwners: to.Ptr(true), - // }}, - // Condition: &armmonitor.ThresholdRuleCondition{ - // DataSource: &armmonitor.RuleMetricDataSource{ - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), - // ResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest"), - // MetricName: to.Ptr("Requests"), - // }, - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Threshold: to.Ptr[float64](2), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationOperatorTotal), - // WindowSize: to.Ptr("PT5M"), - // }, - // IsEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-11-10T21:04:39.000Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("chiricutin0"), - // Type: to.Ptr("Microsoft.Insights/alertRules"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/chiricutin0"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage"), - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.AlertRule{ - // Name: to.Ptr("chiricutin0"), - // Description: to.Ptr("Pura Vida 0"), - // Actions: []armmonitor.RuleActionClassification{ - // }, - // Condition: &armmonitor.ThresholdRuleCondition{ - // DataSource: &armmonitor.RuleMetricDataSource{ - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), - // ResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest"), - // MetricName: to.Ptr("Requests"), - // }, - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Threshold: to.Ptr[float64](2), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationOperatorTotal), - // WindowSize: to.Ptr("PT5M"), - // }, - // IsEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-11-10T21:04:39.108Z"); return t}()), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/autorest.md b/sdk/resourcemanager/monitor/armmonitor/autorest.md index 1a2805b6b7e6..f2ac75dbce9a 100644 --- a/sdk/resourcemanager/monitor/armmonitor/autorest.md +++ b/sdk/resourcemanager/monitor/armmonitor/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/monitor/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/monitor/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.11.0 +module-version: 0.12.0 ``` diff --git a/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client.go b/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client.go index 771527125f21..f2e9fe47371c 100644 --- a/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client.go @@ -28,7 +28,7 @@ type AutoscaleSettingsClient struct { } // NewAutoscaleSettingsClient creates a new instance of AutoscaleSettingsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAutoscaleSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AutoscaleSettingsClient, error) { diff --git a/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client_example_test.go deleted file mode 100644 index af47a871e44d..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client_example_test.go +++ /dev/null @@ -1,1166 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/listAutoscaleSetting.json -func ExampleAutoscaleSettingsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAutoscaleSettingsClient().NewListByResourceGroupPager("TestingMetricsScaleSet", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AutoscaleSettingResourceCollection = armmonitor.AutoscaleSettingResourceCollection{ - // Value: []*armmonitor.AutoscaleSettingResource{ - // { - // Name: to.Ptr("MySetting"), - // Type: to.Ptr("Microsoft.Insights/autoscaleSettings"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/microsoft.insights/autoscalesettings/MySetting"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armmonitor.AutoscaleSetting{ - // Name: to.Ptr("MySetting"), - // Enabled: to.Ptr(true), - // Notifications: []*armmonitor.AutoscaleNotification{ - // { - // Email: &armmonitor.EmailNotification{ - // CustomEmails: []*string{ - // to.Ptr("gu@ms.com"), - // to.Ptr("ge@ns.net")}, - // SendToSubscriptionAdministrator: to.Ptr(true), - // SendToSubscriptionCoAdministrators: to.Ptr(true), - // }, - // Operation: to.Ptr("Scale"), - // Webhooks: []*armmonitor.WebhookNotification{ - // { - // Properties: map[string]*string{ - // }, - // ServiceURI: to.Ptr("http://myservice.com"), - // }}, - // }}, - // PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ - // ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), - // }, - // Profiles: []*armmonitor.AutoscaleProfile{ - // { - // Name: to.Ptr("adios"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // FixedDate: &armmonitor.TimeWindow{ - // End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30:00.000Z"); return t}()), - // Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:00:00.000Z"); return t}()), - // TimeZone: to.Ptr("UTC"), - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }, - // { - // Name: to.Ptr("saludos"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // Recurrence: &armmonitor.Recurrence{ - // Frequency: to.Ptr(armmonitor.RecurrenceFrequencyWeek), - // Schedule: &armmonitor.RecurrentSchedule{ - // Days: []*string{ - // to.Ptr("1")}, - // Hours: []*int32{ - // to.Ptr[int32](5)}, - // Minutes: []*int32{ - // to.Ptr[int32](15)}, - // TimeZone: to.Ptr("UTC"), - // }, - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }}, - // TargetResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/createOrUpdateAutoscaleSetting.json -func ExampleAutoscaleSettingsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutoscaleSettingsClient().CreateOrUpdate(ctx, "TestingMetricsScaleSet", "MySetting", armmonitor.AutoscaleSettingResource{ - Location: to.Ptr("West US"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - Properties: &armmonitor.AutoscaleSetting{ - Enabled: to.Ptr(true), - Notifications: []*armmonitor.AutoscaleNotification{ - { - Email: &armmonitor.EmailNotification{ - CustomEmails: []*string{ - to.Ptr("gu@ms.com"), - to.Ptr("ge@ns.net")}, - SendToSubscriptionAdministrator: to.Ptr(true), - SendToSubscriptionCoAdministrators: to.Ptr(true), - }, - Operation: to.Ptr("Scale"), - Webhooks: []*armmonitor.WebhookNotification{ - { - Properties: map[string]*string{}, - ServiceURI: to.Ptr("http://myservice.com"), - }}, - }}, - PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ - ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), - }, - Profiles: []*armmonitor.AutoscaleProfile{ - { - Name: to.Ptr("adios"), - Capacity: &armmonitor.ScaleCapacity{ - Default: to.Ptr("1"), - Maximum: to.Ptr("10"), - Minimum: to.Ptr("1"), - }, - FixedDate: &armmonitor.TimeWindow{ - End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30:00.000Z"); return t }()), - Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:00:00.000Z"); return t }()), - TimeZone: to.Ptr("UTC"), - }, - Rules: []*armmonitor.ScaleRule{ - { - MetricTrigger: &armmonitor.MetricTrigger{ - DividePerInstance: to.Ptr(false), - MetricName: to.Ptr("Percentage CPU"), - MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - Threshold: to.Ptr[float64](10), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - TimeGrain: to.Ptr("PT1M"), - TimeWindow: to.Ptr("PT5M"), - }, - ScaleAction: &armmonitor.ScaleAction{ - Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - Cooldown: to.Ptr("PT5M"), - Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - Value: to.Ptr("1"), - }, - }, - { - MetricTrigger: &armmonitor.MetricTrigger{ - DividePerInstance: to.Ptr(false), - MetricName: to.Ptr("Percentage CPU"), - MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - Threshold: to.Ptr[float64](15), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - TimeGrain: to.Ptr("PT2M"), - TimeWindow: to.Ptr("PT5M"), - }, - ScaleAction: &armmonitor.ScaleAction{ - Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - Cooldown: to.Ptr("PT6M"), - Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - Value: to.Ptr("2"), - }, - }}, - }, - { - Name: to.Ptr("saludos"), - Capacity: &armmonitor.ScaleCapacity{ - Default: to.Ptr("1"), - Maximum: to.Ptr("10"), - Minimum: to.Ptr("1"), - }, - Recurrence: &armmonitor.Recurrence{ - Frequency: to.Ptr(armmonitor.RecurrenceFrequencyWeek), - Schedule: &armmonitor.RecurrentSchedule{ - Days: []*string{ - to.Ptr("1")}, - Hours: []*int32{ - to.Ptr[int32](5)}, - Minutes: []*int32{ - to.Ptr[int32](15)}, - TimeZone: to.Ptr("UTC"), - }, - }, - Rules: []*armmonitor.ScaleRule{ - { - MetricTrigger: &armmonitor.MetricTrigger{ - DividePerInstance: to.Ptr(false), - MetricName: to.Ptr("Percentage CPU"), - MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - Threshold: to.Ptr[float64](10), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - TimeGrain: to.Ptr("PT1M"), - TimeWindow: to.Ptr("PT5M"), - }, - ScaleAction: &armmonitor.ScaleAction{ - Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - Cooldown: to.Ptr("PT5M"), - Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - Value: to.Ptr("1"), - }, - }, - { - MetricTrigger: &armmonitor.MetricTrigger{ - DividePerInstance: to.Ptr(false), - MetricName: to.Ptr("Percentage CPU"), - MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - Threshold: to.Ptr[float64](15), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - TimeGrain: to.Ptr("PT2M"), - TimeWindow: to.Ptr("PT5M"), - }, - ScaleAction: &armmonitor.ScaleAction{ - Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - Cooldown: to.Ptr("PT6M"), - Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - Value: to.Ptr("2"), - }, - }}, - }}, - TargetResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AutoscaleSettingResource = armmonitor.AutoscaleSettingResource{ - // Name: to.Ptr("MySetting"), - // Type: to.Ptr("Microsoft.Insights/autoscaleSettings"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/microsoft.insights/autoscalesettings/MySetting"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armmonitor.AutoscaleSetting{ - // Name: to.Ptr("MySetting"), - // Enabled: to.Ptr(true), - // Notifications: []*armmonitor.AutoscaleNotification{ - // { - // Email: &armmonitor.EmailNotification{ - // CustomEmails: []*string{ - // to.Ptr("gu@ms.com"), - // to.Ptr("ge@ns.net")}, - // SendToSubscriptionAdministrator: to.Ptr(true), - // SendToSubscriptionCoAdministrators: to.Ptr(true), - // }, - // Operation: to.Ptr("Scale"), - // Webhooks: []*armmonitor.WebhookNotification{ - // { - // Properties: map[string]*string{ - // }, - // ServiceURI: to.Ptr("http://myservice.com"), - // }}, - // }}, - // PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ - // ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), - // }, - // Profiles: []*armmonitor.AutoscaleProfile{ - // { - // Name: to.Ptr("adios"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // FixedDate: &armmonitor.TimeWindow{ - // End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30:00.000Z"); return t}()), - // Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:00:00.000Z"); return t}()), - // TimeZone: to.Ptr("UTC"), - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }, - // { - // Name: to.Ptr("saludos"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // Recurrence: &armmonitor.Recurrence{ - // Frequency: to.Ptr(armmonitor.RecurrenceFrequencyWeek), - // Schedule: &armmonitor.RecurrentSchedule{ - // Days: []*string{ - // to.Ptr("1")}, - // Hours: []*int32{ - // to.Ptr[int32](5)}, - // Minutes: []*int32{ - // to.Ptr[int32](15)}, - // TimeZone: to.Ptr("UTC"), - // }, - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }}, - // TargetResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/deleteAutoscaleSetting.json -func ExampleAutoscaleSettingsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAutoscaleSettingsClient().Delete(ctx, "TestingMetricsScaleSet", "MySetting", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/getAutoscaleSetting.json -func ExampleAutoscaleSettingsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutoscaleSettingsClient().Get(ctx, "TestingMetricsScaleSet", "MySetting", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AutoscaleSettingResource = armmonitor.AutoscaleSettingResource{ - // Name: to.Ptr("MySetting"), - // Type: to.Ptr("Microsoft.Insights/autoscaleSettings"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/microsoft.insights/autoscalesettings/MySetting"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armmonitor.AutoscaleSetting{ - // Name: to.Ptr("MySetting"), - // Enabled: to.Ptr(true), - // Notifications: []*armmonitor.AutoscaleNotification{ - // { - // Email: &armmonitor.EmailNotification{ - // CustomEmails: []*string{ - // to.Ptr("gu@ms.com"), - // to.Ptr("ge@ns.net")}, - // SendToSubscriptionAdministrator: to.Ptr(true), - // SendToSubscriptionCoAdministrators: to.Ptr(true), - // }, - // Operation: to.Ptr("Scale"), - // Webhooks: []*armmonitor.WebhookNotification{ - // { - // Properties: map[string]*string{ - // }, - // ServiceURI: to.Ptr("http://myservice.com"), - // }}, - // }}, - // PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ - // ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), - // }, - // Profiles: []*armmonitor.AutoscaleProfile{ - // { - // Name: to.Ptr("adios"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // FixedDate: &armmonitor.TimeWindow{ - // End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30:00.000Z"); return t}()), - // Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:00:00.000Z"); return t}()), - // TimeZone: to.Ptr("UTC"), - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }, - // { - // Name: to.Ptr("saludos"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // Recurrence: &armmonitor.Recurrence{ - // Frequency: to.Ptr(armmonitor.RecurrenceFrequencyWeek), - // Schedule: &armmonitor.RecurrentSchedule{ - // Days: []*string{ - // to.Ptr("1")}, - // Hours: []*int32{ - // to.Ptr[int32](5)}, - // Minutes: []*int32{ - // to.Ptr[int32](15)}, - // TimeZone: to.Ptr("UTC"), - // }, - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }}, - // TargetResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/patchAutoscaleSetting.json -func ExampleAutoscaleSettingsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutoscaleSettingsClient().Update(ctx, "TestingMetricsScaleSet", "MySetting", armmonitor.AutoscaleSettingResourcePatch{ - Properties: &armmonitor.AutoscaleSetting{ - Enabled: to.Ptr(true), - Notifications: []*armmonitor.AutoscaleNotification{ - { - Email: &armmonitor.EmailNotification{ - CustomEmails: []*string{ - to.Ptr("gu@ms.com"), - to.Ptr("ge@ns.net")}, - SendToSubscriptionAdministrator: to.Ptr(true), - SendToSubscriptionCoAdministrators: to.Ptr(true), - }, - Operation: to.Ptr("Scale"), - Webhooks: []*armmonitor.WebhookNotification{ - { - Properties: map[string]*string{}, - ServiceURI: to.Ptr("http://myservice.com"), - }}, - }}, - PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ - ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), - }, - Profiles: []*armmonitor.AutoscaleProfile{ - { - Name: to.Ptr("adios"), - Capacity: &armmonitor.ScaleCapacity{ - Default: to.Ptr("1"), - Maximum: to.Ptr("10"), - Minimum: to.Ptr("1"), - }, - FixedDate: &armmonitor.TimeWindow{ - End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30:00.000Z"); return t }()), - Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:00:00.000Z"); return t }()), - TimeZone: to.Ptr("UTC"), - }, - Rules: []*armmonitor.ScaleRule{ - { - MetricTrigger: &armmonitor.MetricTrigger{ - DividePerInstance: to.Ptr(false), - MetricName: to.Ptr("Percentage CPU"), - MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - Threshold: to.Ptr[float64](10), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - TimeGrain: to.Ptr("PT1M"), - TimeWindow: to.Ptr("PT5M"), - }, - ScaleAction: &armmonitor.ScaleAction{ - Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - Cooldown: to.Ptr("PT5M"), - Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - Value: to.Ptr("1"), - }, - }, - { - MetricTrigger: &armmonitor.MetricTrigger{ - DividePerInstance: to.Ptr(false), - MetricName: to.Ptr("Percentage CPU"), - MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - Threshold: to.Ptr[float64](15), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - TimeGrain: to.Ptr("PT2M"), - TimeWindow: to.Ptr("PT5M"), - }, - ScaleAction: &armmonitor.ScaleAction{ - Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - Cooldown: to.Ptr("PT6M"), - Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - Value: to.Ptr("2"), - }, - }}, - }, - { - Name: to.Ptr("saludos"), - Capacity: &armmonitor.ScaleCapacity{ - Default: to.Ptr("1"), - Maximum: to.Ptr("10"), - Minimum: to.Ptr("1"), - }, - Recurrence: &armmonitor.Recurrence{ - Frequency: to.Ptr(armmonitor.RecurrenceFrequencyWeek), - Schedule: &armmonitor.RecurrentSchedule{ - Days: []*string{ - to.Ptr("1")}, - Hours: []*int32{ - to.Ptr[int32](5)}, - Minutes: []*int32{ - to.Ptr[int32](15)}, - TimeZone: to.Ptr("UTC"), - }, - }, - Rules: []*armmonitor.ScaleRule{ - { - MetricTrigger: &armmonitor.MetricTrigger{ - DividePerInstance: to.Ptr(false), - MetricName: to.Ptr("Percentage CPU"), - MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - Threshold: to.Ptr[float64](10), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - TimeGrain: to.Ptr("PT1M"), - TimeWindow: to.Ptr("PT5M"), - }, - ScaleAction: &armmonitor.ScaleAction{ - Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - Cooldown: to.Ptr("PT5M"), - Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - Value: to.Ptr("1"), - }, - }, - { - MetricTrigger: &armmonitor.MetricTrigger{ - DividePerInstance: to.Ptr(false), - MetricName: to.Ptr("Percentage CPU"), - MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - Threshold: to.Ptr[float64](15), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - TimeGrain: to.Ptr("PT2M"), - TimeWindow: to.Ptr("PT5M"), - }, - ScaleAction: &armmonitor.ScaleAction{ - Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - Cooldown: to.Ptr("PT6M"), - Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - Value: to.Ptr("2"), - }, - }}, - }}, - TargetResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AutoscaleSettingResource = armmonitor.AutoscaleSettingResource{ - // Name: to.Ptr("MySetting"), - // Type: to.Ptr("Microsoft.Insights/autoscaleSettings"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/microsoft.insights/autoscalesettings/MySetting"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary"), - // }, - // Properties: &armmonitor.AutoscaleSetting{ - // Name: to.Ptr("MySetting"), - // Enabled: to.Ptr(true), - // Notifications: []*armmonitor.AutoscaleNotification{ - // { - // Email: &armmonitor.EmailNotification{ - // CustomEmails: []*string{ - // to.Ptr("gu@ms.com"), - // to.Ptr("ge@ns.net")}, - // SendToSubscriptionAdministrator: to.Ptr(true), - // SendToSubscriptionCoAdministrators: to.Ptr(true), - // }, - // Operation: to.Ptr("Scale"), - // Webhooks: []*armmonitor.WebhookNotification{ - // { - // Properties: map[string]*string{ - // }, - // ServiceURI: to.Ptr("http://myservice.com"), - // }}, - // }}, - // PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ - // ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), - // }, - // Profiles: []*armmonitor.AutoscaleProfile{ - // { - // Name: to.Ptr("adios"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // FixedDate: &armmonitor.TimeWindow{ - // End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30:00.000Z"); return t}()), - // Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:00:00.000Z"); return t}()), - // TimeZone: to.Ptr("UTC"), - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }, - // { - // Name: to.Ptr("saludos"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // Recurrence: &armmonitor.Recurrence{ - // Frequency: to.Ptr(armmonitor.RecurrenceFrequencyWeek), - // Schedule: &armmonitor.RecurrentSchedule{ - // Days: []*string{ - // to.Ptr("1")}, - // Hours: []*int32{ - // to.Ptr[int32](5)}, - // Minutes: []*int32{ - // to.Ptr[int32](15)}, - // TimeZone: to.Ptr("UTC"), - // }, - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }}, - // TargetResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/listAutoscaleSettingBySubscription.json -func ExampleAutoscaleSettingsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAutoscaleSettingsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AutoscaleSettingResourceCollection = armmonitor.AutoscaleSettingResourceCollection{ - // Value: []*armmonitor.AutoscaleSettingResource{ - // { - // Name: to.Ptr("MySetting"), - // Type: to.Ptr("Microsoft.Insights/autoscaleSettings"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/microsoft.insights/autoscalesettings/MySetting"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armmonitor.AutoscaleSetting{ - // Name: to.Ptr("MySetting"), - // Enabled: to.Ptr(true), - // Notifications: []*armmonitor.AutoscaleNotification{ - // { - // Email: &armmonitor.EmailNotification{ - // CustomEmails: []*string{ - // to.Ptr("gu@ms.com"), - // to.Ptr("ge@ns.net")}, - // SendToSubscriptionAdministrator: to.Ptr(true), - // SendToSubscriptionCoAdministrators: to.Ptr(true), - // }, - // Operation: to.Ptr("Scale"), - // Webhooks: []*armmonitor.WebhookNotification{ - // { - // Properties: map[string]*string{ - // }, - // ServiceURI: to.Ptr("http://myservice.com"), - // }}, - // }}, - // PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ - // ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), - // }, - // Profiles: []*armmonitor.AutoscaleProfile{ - // { - // Name: to.Ptr("adios"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // FixedDate: &armmonitor.TimeWindow{ - // End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30:00.000Z"); return t}()), - // Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:00:00.000Z"); return t}()), - // TimeZone: to.Ptr("UTC"), - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }, - // { - // Name: to.Ptr("saludos"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // Recurrence: &armmonitor.Recurrence{ - // Frequency: to.Ptr(armmonitor.RecurrenceFrequencyWeek), - // Schedule: &armmonitor.RecurrentSchedule{ - // Days: []*string{ - // to.Ptr("1")}, - // Hours: []*int32{ - // to.Ptr[int32](5)}, - // Minutes: []*int32{ - // to.Ptr[int32](15)}, - // TimeZone: to.Ptr("UTC"), - // }, - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }}, - // TargetResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client.go b/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client.go index d23375c62f44..ab574077b377 100644 --- a/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client.go @@ -28,7 +28,7 @@ type AzureMonitorWorkspacesClient struct { } // NewAzureMonitorWorkspacesClient creates a new instance of AzureMonitorWorkspacesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAzureMonitorWorkspacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AzureMonitorWorkspacesClient, error) { @@ -43,13 +43,13 @@ func NewAzureMonitorWorkspacesClient(subscriptionID string, credential azcore.To return client, nil } -// Create - Create or update a workspace +// Create - Creates or updates an Azure Monitor Workspace // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-03-preview +// Generated from API version 2023-04-03 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - azureMonitorWorkspaceName - The name of the Azure Monitor workspace. The name is case insensitive -// - azureMonitorWorkspaceProperties - Properties that need to be specified to create a new workspace +// - azureMonitorWorkspaceName - The name of the Azure Monitor Workspace. The name is case insensitive +// - azureMonitorWorkspaceProperties - Properties that need to be specified to create a new Azure Monitor Workspace // - options - AzureMonitorWorkspacesClientCreateOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Create // method. func (client *AzureMonitorWorkspacesClient) Create(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, azureMonitorWorkspaceProperties AzureMonitorWorkspaceResource, options *AzureMonitorWorkspacesClientCreateOptions) (AzureMonitorWorkspacesClientCreateResponse, error) { @@ -94,7 +94,7 @@ func (client *AzureMonitorWorkspacesClient) createCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-03-preview") + reqQP.Set("api-version", "2023-04-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, azureMonitorWorkspaceProperties); err != nil { @@ -112,37 +112,59 @@ func (client *AzureMonitorWorkspacesClient) createHandleResponse(resp *http.Resp return result, nil } -// Delete - Delete a workspace +// BeginDelete - Deletes an Azure Monitor Workspace // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-03-preview +// Generated from API version 2023-04-03 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - azureMonitorWorkspaceName - The name of the Azure Monitor workspace. The name is case insensitive -// - options - AzureMonitorWorkspacesClientDeleteOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Delete +// - azureMonitorWorkspaceName - The name of the Azure Monitor Workspace. The name is case insensitive +// - options - AzureMonitorWorkspacesClientBeginDeleteOptions contains the optional parameters for the AzureMonitorWorkspacesClient.BeginDelete // method. -func (client *AzureMonitorWorkspacesClient) Delete(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientDeleteOptions) (AzureMonitorWorkspacesClientDeleteResponse, error) { +func (client *AzureMonitorWorkspacesClient) BeginDelete(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientBeginDeleteOptions) (*runtime.Poller[AzureMonitorWorkspacesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, azureMonitorWorkspaceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureMonitorWorkspacesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AzureMonitorWorkspacesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes an Azure Monitor Workspace +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-03 +func (client *AzureMonitorWorkspacesClient) deleteOperation(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientBeginDeleteOptions) (*http.Response, error) { var err error - const operationName = "AzureMonitorWorkspacesClient.Delete" + const operationName = "AzureMonitorWorkspacesClient.BeginDelete" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, azureMonitorWorkspaceName, options) if err != nil { - return AzureMonitorWorkspacesClientDeleteResponse{}, err + return nil, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return AzureMonitorWorkspacesClientDeleteResponse{}, err + return nil, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { err = runtime.NewResponseError(httpResp) - return AzureMonitorWorkspacesClientDeleteResponse{}, err + return nil, err } - return AzureMonitorWorkspacesClientDeleteResponse{}, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. -func (client *AzureMonitorWorkspacesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientDeleteOptions) (*policy.Request, error) { +func (client *AzureMonitorWorkspacesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -161,18 +183,18 @@ func (client *AzureMonitorWorkspacesClient) deleteCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-03-preview") + reqQP.Set("api-version", "2023-04-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// Get - Returns the specific Azure Monitor workspace +// Get - Returns the specified Azure Monitor Workspace // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-03-preview +// Generated from API version 2023-04-03 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - azureMonitorWorkspaceName - The name of the Azure Monitor workspace. The name is case insensitive +// - azureMonitorWorkspaceName - The name of the Azure Monitor Workspace. The name is case insensitive // - options - AzureMonitorWorkspacesClientGetOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Get // method. func (client *AzureMonitorWorkspacesClient) Get(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientGetOptions) (AzureMonitorWorkspacesClientGetResponse, error) { @@ -217,7 +239,7 @@ func (client *AzureMonitorWorkspacesClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-03-preview") + reqQP.Set("api-version", "2023-04-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -232,9 +254,9 @@ func (client *AzureMonitorWorkspacesClient) getHandleResponse(resp *http.Respons return result, nil } -// NewListByResourceGroupPager - Lists all workspaces in the specified resource group +// NewListByResourceGroupPager - Lists all Azure Monitor Workspaces in the specified resource group // -// Generated from API version 2021-06-03-preview +// Generated from API version 2023-04-03 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - AzureMonitorWorkspacesClientListByResourceGroupOptions contains the optional parameters for the AzureMonitorWorkspacesClient.NewListByResourceGroupPager // method. @@ -277,7 +299,7 @@ func (client *AzureMonitorWorkspacesClient) listByResourceGroupCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-03-preview") + reqQP.Set("api-version", "2023-04-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -292,9 +314,9 @@ func (client *AzureMonitorWorkspacesClient) listByResourceGroupHandleResponse(re return result, nil } -// NewListBySubscriptionPager - Lists all workspaces in the specified subscription +// NewListBySubscriptionPager - Lists all Azure Monitor Workspaces in the specified subscription // -// Generated from API version 2021-06-03-preview +// Generated from API version 2023-04-03 // - options - AzureMonitorWorkspacesClientListBySubscriptionOptions contains the optional parameters for the AzureMonitorWorkspacesClient.NewListBySubscriptionPager // method. func (client *AzureMonitorWorkspacesClient) NewListBySubscriptionPager(options *AzureMonitorWorkspacesClientListBySubscriptionOptions) *runtime.Pager[AzureMonitorWorkspacesClientListBySubscriptionResponse] { @@ -332,7 +354,7 @@ func (client *AzureMonitorWorkspacesClient) listBySubscriptionCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-03-preview") + reqQP.Set("api-version", "2023-04-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -347,12 +369,12 @@ func (client *AzureMonitorWorkspacesClient) listBySubscriptionHandleResponse(res return result, nil } -// Update - Updates part of a workspace +// Update - Updates part of an Azure Monitor Workspace // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-03-preview +// Generated from API version 2023-04-03 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - azureMonitorWorkspaceName - The name of the Azure Monitor workspace. The name is case insensitive +// - azureMonitorWorkspaceName - The name of the Azure Monitor Workspace. The name is case insensitive // - options - AzureMonitorWorkspacesClientUpdateOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Update // method. func (client *AzureMonitorWorkspacesClient) Update(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientUpdateOptions) (AzureMonitorWorkspacesClientUpdateResponse, error) { @@ -397,7 +419,7 @@ func (client *AzureMonitorWorkspacesClient) updateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-03-preview") + reqQP.Set("api-version", "2023-04-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.AzureMonitorWorkspaceProperties != nil { diff --git a/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client_example_test.go deleted file mode 100644 index 455a436b12cd..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client_example_test.go +++ /dev/null @@ -1,379 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesListByResourceGroup.json -func ExampleAzureMonitorWorkspacesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAzureMonitorWorkspacesClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AzureMonitorWorkspaceResourceListResult = armmonitor.AzureMonitorWorkspaceResourceListResult{ - // Value: []*armmonitor.AzureMonitorWorkspaceResource{ - // { - // Name: to.Ptr("myAzureMonitorWorkspace"), - // Type: to.Ptr("Microsoft.Monitor/accounts"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Monitor/accounts/myAzureMonitorWorkspace"), - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // Properties: &armmonitor.AzureMonitorWorkspaceResourceProperties{ - // AccountID: to.Ptr("2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // DefaultIngestionSettings: &armmonitor.AzureMonitorWorkspaceDefaultIngestionSettings{ - // DataCollectionEndpointResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionEndpoints/myAzureMonitorWorkspace"), - // DataCollectionRuleResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionRules/myAzureMonitorWorkspace"), - // }, - // Metrics: &armmonitor.AzureMonitorWorkspaceMetrics{ - // InternalID: to.Ptr("mac_2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // PrometheusQueryEndpoint: to.Ptr("https://myAzureMonitorWorkspace-abcd.eastus.prometheus.monitor.azure.com"), - // }, - // ProvisioningState: to.Ptr(armmonitor.ProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("herAzureMonitorWorkspace"), - // Type: to.Ptr("Microsoft.Monitor/accounts"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Monitor/accounts/herAzureMonitorWorkspace"), - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // Properties: &armmonitor.AzureMonitorWorkspaceResourceProperties{ - // AccountID: to.Ptr("823220c6-0415-44d8-bfb2-d5c1c9ea1172"), - // DefaultIngestionSettings: &armmonitor.AzureMonitorWorkspaceDefaultIngestionSettings{ - // DataCollectionEndpointResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_herAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionEndpoints/herAzureMonitorWorkspace"), - // DataCollectionRuleResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_herAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionRules/herAzureMonitorWorkspace"), - // }, - // Metrics: &armmonitor.AzureMonitorWorkspaceMetrics{ - // InternalID: to.Ptr("mac_823220c6-0415-44d8-bfb2-d5c1c9ea1172"), - // PrometheusQueryEndpoint: to.Ptr("https://herAzureMonitorWorkspace-xywz.eastus.prometheus.monitor.azure.com"), - // }, - // ProvisioningState: to.Ptr(armmonitor.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesListBySubscription.json -func ExampleAzureMonitorWorkspacesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAzureMonitorWorkspacesClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AzureMonitorWorkspaceResourceListResult = armmonitor.AzureMonitorWorkspaceResourceListResult{ - // Value: []*armmonitor.AzureMonitorWorkspaceResource{ - // { - // Name: to.Ptr("myAzureMonitorWorkspace"), - // Type: to.Ptr("Microsoft.Monitor/accounts"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Monitor/accounts/myAzureMonitorWorkspace"), - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // Properties: &armmonitor.AzureMonitorWorkspaceResourceProperties{ - // AccountID: to.Ptr("2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // DefaultIngestionSettings: &armmonitor.AzureMonitorWorkspaceDefaultIngestionSettings{ - // DataCollectionEndpointResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionEndpoints/myAzureMonitorWorkspace"), - // DataCollectionRuleResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionRules/myAzureMonitorWorkspace"), - // }, - // Metrics: &armmonitor.AzureMonitorWorkspaceMetrics{ - // InternalID: to.Ptr("mac_2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // PrometheusQueryEndpoint: to.Ptr("https://myAzureMonitorWorkspace-v8hx.eastus.prometheus.monitor.azure.com"), - // }, - // ProvisioningState: to.Ptr(armmonitor.ProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("herAzureMonitorWorkspace"), - // Type: to.Ptr("Microsoft.Monitor/accounts"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/herResourceGroup/providers/Microsoft.Monitor/accounts/herAzureMonitorWorkspace"), - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // Properties: &armmonitor.AzureMonitorWorkspaceResourceProperties{ - // AccountID: to.Ptr("823220c6-0415-44d8-bfb2-d5c1c9ea1172"), - // DefaultIngestionSettings: &armmonitor.AzureMonitorWorkspaceDefaultIngestionSettings{ - // DataCollectionEndpointResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_herAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionEndpoints/herAzureMonitorWorkspace"), - // DataCollectionRuleResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_herAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionRules/herAzureMonitorWorkspace"), - // }, - // Metrics: &armmonitor.AzureMonitorWorkspaceMetrics{ - // InternalID: to.Ptr("mac_823220c6-0415-44d8-bfb2-d5c1c9ea1172"), - // PrometheusQueryEndpoint: to.Ptr("https://herazuremonitorworkspace-xywz.eastus.prometheus.monitor.azure.com"), - // }, - // ProvisioningState: to.Ptr(armmonitor.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesGet.json -func ExampleAzureMonitorWorkspacesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureMonitorWorkspacesClient().Get(ctx, "myResourceGroup", "myAzureMonitorWorkspace", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureMonitorWorkspaceResource = armmonitor.AzureMonitorWorkspaceResource{ - // Name: to.Ptr("myAzureMonitorWorkspace"), - // Type: to.Ptr("Microsoft.Monitor/accounts"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Monitor/accounts/myAzureMonitorWorkspace"), - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // Properties: &armmonitor.AzureMonitorWorkspaceResourceProperties{ - // AccountID: to.Ptr("2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // DefaultIngestionSettings: &armmonitor.AzureMonitorWorkspaceDefaultIngestionSettings{ - // DataCollectionEndpointResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionEndpoints/myAzureMonitorWorkspace"), - // DataCollectionRuleResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionRules/myAzureMonitorWorkspace"), - // }, - // Metrics: &armmonitor.AzureMonitorWorkspaceMetrics{ - // InternalID: to.Ptr("mac_2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // PrometheusQueryEndpoint: to.Ptr("https://myAzureMonitorWorkspace-v8hx.eastus.prometheus.monitor.azure.com"), - // }, - // ProvisioningState: to.Ptr(armmonitor.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesCreate.json -func ExampleAzureMonitorWorkspacesClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureMonitorWorkspacesClient().Create(ctx, "myResourceGroup", "myAzureMonitorWorkspace", armmonitor.AzureMonitorWorkspaceResource{ - Location: to.Ptr("eastus"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureMonitorWorkspaceResource = armmonitor.AzureMonitorWorkspaceResource{ - // Name: to.Ptr("myAzureMonitorWorkspace"), - // Type: to.Ptr("Microsoft.Monitor/accounts"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Monitor/accounts/myAzureMonitorWorkspace"), - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // Properties: &armmonitor.AzureMonitorWorkspaceResourceProperties{ - // AccountID: to.Ptr("2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // DefaultIngestionSettings: &armmonitor.AzureMonitorWorkspaceDefaultIngestionSettings{ - // DataCollectionEndpointResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionEndpoints/myAzureMonitorWorkspace"), - // DataCollectionRuleResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionRules/myAzureMonitorWorkspace"), - // }, - // Metrics: &armmonitor.AzureMonitorWorkspaceMetrics{ - // InternalID: to.Ptr("mac_2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // PrometheusQueryEndpoint: to.Ptr("https://myAzureMonitorWorkspace-v8hx.eastus.prometheus.monitor.azure.com"), - // }, - // ProvisioningState: to.Ptr(armmonitor.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesUpdate.json -func ExampleAzureMonitorWorkspacesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureMonitorWorkspacesClient().Update(ctx, "myResourceGroup", "myAzureMonitorWorkspace", &armmonitor.AzureMonitorWorkspacesClientUpdateOptions{AzureMonitorWorkspaceProperties: &armmonitor.AzureMonitorWorkspaceResourceForUpdate{ - Tags: map[string]*string{ - "tag1": to.Ptr("A"), - "tag2": to.Ptr("B"), - "tag3": to.Ptr("C"), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureMonitorWorkspaceResource = armmonitor.AzureMonitorWorkspaceResource{ - // Name: to.Ptr("myAzureMonitorWorkspace"), - // Type: to.Ptr("Microsoft.Monitor/accounts"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Monitor/accounts/myAzureMonitorWorkspace"), - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // "tag3": to.Ptr("C"), - // }, - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // Properties: &armmonitor.AzureMonitorWorkspaceResourceProperties{ - // AccountID: to.Ptr("2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // DefaultIngestionSettings: &armmonitor.AzureMonitorWorkspaceDefaultIngestionSettings{ - // DataCollectionEndpointResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionEndpoints/myAzureMonitorWorkspace"), - // DataCollectionRuleResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionRules/myAzureMonitorWorkspace"), - // }, - // Metrics: &armmonitor.AzureMonitorWorkspaceMetrics{ - // InternalID: to.Ptr("mac_2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // PrometheusQueryEndpoint: to.Ptr("https://myAzureMonitorWorkspace-v8hx.eastus.prometheus.monitor.azure.com"), - // }, - // ProvisioningState: to.Ptr(armmonitor.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesDelete.json -func ExampleAzureMonitorWorkspacesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAzureMonitorWorkspacesClient().Delete(ctx, "myResourceGroup", "myAzureMonitorWorkspace", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/baselines_client.go b/sdk/resourcemanager/monitor/armmonitor/baselines_client.go index 997ba5b2a6a1..f50cad940e79 100644 --- a/sdk/resourcemanager/monitor/armmonitor/baselines_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/baselines_client.go @@ -76,31 +76,31 @@ func (client *BaselinesClient) listCreateRequest(ctx context.Context, resourceUR return nil, err } reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Aggregation != nil { + reqQP.Set("aggregation", *options.Aggregation) + } + reqQP.Set("api-version", "2019-03-01") + if options != nil && options.Interval != nil { + reqQP.Set("interval", *options.Interval) + } if options != nil && options.Metricnames != nil { reqQP.Set("metricnames", *options.Metricnames) } if options != nil && options.Metricnamespace != nil { reqQP.Set("metricnamespace", *options.Metricnamespace) } - if options != nil && options.Timespan != nil { - reqQP.Set("timespan", *options.Timespan) - } - if options != nil && options.Interval != nil { - reqQP.Set("interval", *options.Interval) - } - if options != nil && options.Aggregation != nil { - reqQP.Set("aggregation", *options.Aggregation) + if options != nil && options.ResultType != nil { + reqQP.Set("resultType", string(*options.ResultType)) } if options != nil && options.Sensitivities != nil { reqQP.Set("sensitivities", *options.Sensitivities) } - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.ResultType != nil { - reqQP.Set("resultType", string(*options.ResultType)) + if options != nil && options.Timespan != nil { + reqQP.Set("timespan", *options.Timespan) } - reqQP.Set("api-version", "2019-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/monitor/armmonitor/baselines_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/baselines_client_example_test.go deleted file mode 100644 index 7eb46f3d4253..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/baselines_client_example_test.go +++ /dev/null @@ -1,102 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2019-03-01/examples/metricBaselines.json -func ExampleBaselinesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBaselinesClient().NewListPager("subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1", &armmonitor.BaselinesClientListOptions{Metricnames: nil, - Metricnamespace: nil, - Timespan: to.Ptr("2019-03-12T11:00:00.000Z/2019-03-12T12:00:00.000Z"), - Interval: to.Ptr("PT1H"), - Aggregation: to.Ptr("average"), - Sensitivities: to.Ptr("Low,Medium"), - Filter: nil, - ResultType: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricBaselinesResponse = armmonitor.MetricBaselinesResponse{ - // Value: []*armmonitor.SingleMetricBaseline{ - // { - // Name: to.Ptr("Percentage CPU"), - // Type: to.Ptr("microsoft.insights/metricBaselines"), - // ID: to.Ptr("/subscriptions/11aeb0ed-456b-4ca0-8df5-b9fbdc63d0d3/resourceGroups/SmartAnalytics-DEV-VM/providers/Microsoft.Compute/virtualMachines/DemoVM1/providers/microsoft.insights/metricBaselines/Percentage CPU"), - // Properties: &armmonitor.MetricBaselinesProperties{ - // Baselines: []*armmonitor.TimeSeriesBaseline{ - // { - // Aggregation: to.Ptr("average"), - // Data: []*armmonitor.SingleBaseline{ - // { - // HighThresholds: []*float64{ - // to.Ptr[float64](90.3453), - // to.Ptr[float64](91.3453)}, - // LowThresholds: []*float64{ - // to.Ptr[float64](30), - // to.Ptr[float64](31.1)}, - // Sensitivity: to.Ptr(armmonitor.BaselineSensitivityLow), - // }, - // { - // HighThresholds: []*float64{ - // to.Ptr[float64](70.3453), - // to.Ptr[float64](71.3453)}, - // LowThresholds: []*float64{ - // to.Ptr[float64](50), - // to.Ptr[float64](51.1)}, - // Sensitivity: to.Ptr(armmonitor.BaselineSensitivityMedium), - // }}, - // Dimensions: []*armmonitor.MetricSingleDimension{ - // }, - // MetadataValues: []*armmonitor.BaselineMetadata{ - // { - // Name: to.Ptr("ErrorType"), - // Value: to.Ptr("TooManyAnomalies"), - // }, - // { - // Name: to.Ptr("SeasonalityFrequency"), - // Value: to.Ptr("288"), - // }}, - // Timestamps: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-12T11:00:00.000Z"); return t}()), - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-12T12:00:00.000Z"); return t}())}, - // }}, - // Interval: to.Ptr("PT1H"), - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // Timespan: to.Ptr("2019-03-12T11:00:00.000Z/2019-03-12T12:00:00.000Z"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/client.go b/sdk/resourcemanager/monitor/armmonitor/client.go new file mode 100644 index 000000000000..b1caeb7ec043 --- /dev/null +++ b/sdk/resourcemanager/monitor/armmonitor/client.go @@ -0,0 +1,188 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmonitor + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// Client contains the methods for the MonitorClient group. +// Don't use this type directly, use NewClient() instead. +type Client struct { + internal *arm.Client +} + +// NewClient creates a new instance of Client with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &Client{ + internal: cl, + } + return client, nil +} + +// BeginCreateNotificationsAtTenantActionGroupResourceLevel - Send test notifications to a set of provided receivers +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - managementGroupID - The management group id. +// - tenantActionGroupName - The name of the action group. +// - xmsClientTenantID - The tenant ID of the client making the request. +// - notificationRequest - The notification request body which includes the contact details +// - options - ClientBeginCreateNotificationsAtTenantActionGroupResourceLevelOptions contains the optional parameters for the +// Client.BeginCreateNotificationsAtTenantActionGroupResourceLevel method. +func (client *Client) BeginCreateNotificationsAtTenantActionGroupResourceLevel(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, notificationRequest TenantNotificationRequestBody, options *ClientBeginCreateNotificationsAtTenantActionGroupResourceLevelOptions) (*runtime.Poller[ClientCreateNotificationsAtTenantActionGroupResourceLevelResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createNotificationsAtTenantActionGroupResourceLevel(ctx, managementGroupID, tenantActionGroupName, xmsClientTenantID, notificationRequest, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientCreateNotificationsAtTenantActionGroupResourceLevelResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClientCreateNotificationsAtTenantActionGroupResourceLevelResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateNotificationsAtTenantActionGroupResourceLevel - Send test notifications to a set of provided receivers +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *Client) createNotificationsAtTenantActionGroupResourceLevel(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, notificationRequest TenantNotificationRequestBody, options *ClientBeginCreateNotificationsAtTenantActionGroupResourceLevelOptions) (*http.Response, error) { + var err error + const operationName = "Client.BeginCreateNotificationsAtTenantActionGroupResourceLevel" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createNotificationsAtTenantActionGroupResourceLevelCreateRequest(ctx, managementGroupID, tenantActionGroupName, xmsClientTenantID, notificationRequest, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createNotificationsAtTenantActionGroupResourceLevelCreateRequest creates the CreateNotificationsAtTenantActionGroupResourceLevel request. +func (client *Client) createNotificationsAtTenantActionGroupResourceLevelCreateRequest(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, notificationRequest TenantNotificationRequestBody, options *ClientBeginCreateNotificationsAtTenantActionGroupResourceLevelOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/tenantActionGroups/{tenantActionGroupName}/createNotifications" + if managementGroupID == "" { + return nil, errors.New("parameter managementGroupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) + if tenantActionGroupName == "" { + return nil, errors.New("parameter tenantActionGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tenantActionGroupName}", url.PathEscape(tenantActionGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["x-ms-client-tenant-id"] = []string{xmsClientTenantID} + if err := runtime.MarshalAsJSON(req, notificationRequest); err != nil { + return nil, err + } + return req, nil +} + +// GetTestNotificationsAtTenantActionGroupResourceLevel - Get the test notifications by the notification id +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - managementGroupID - The management group id. +// - tenantActionGroupName - The name of the action group. +// - xmsClientTenantID - The tenant ID of the client making the request. +// - notificationID - The notification id +// - options - ClientGetTestNotificationsAtTenantActionGroupResourceLevelOptions contains the optional parameters for the Client.GetTestNotificationsAtTenantActionGroupResourceLevel +// method. +func (client *Client) GetTestNotificationsAtTenantActionGroupResourceLevel(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, notificationID string, options *ClientGetTestNotificationsAtTenantActionGroupResourceLevelOptions) (ClientGetTestNotificationsAtTenantActionGroupResourceLevelResponse, error) { + var err error + const operationName = "Client.GetTestNotificationsAtTenantActionGroupResourceLevel" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getTestNotificationsAtTenantActionGroupResourceLevelCreateRequest(ctx, managementGroupID, tenantActionGroupName, xmsClientTenantID, notificationID, options) + if err != nil { + return ClientGetTestNotificationsAtTenantActionGroupResourceLevelResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClientGetTestNotificationsAtTenantActionGroupResourceLevelResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientGetTestNotificationsAtTenantActionGroupResourceLevelResponse{}, err + } + resp, err := client.getTestNotificationsAtTenantActionGroupResourceLevelHandleResponse(httpResp) + return resp, err +} + +// getTestNotificationsAtTenantActionGroupResourceLevelCreateRequest creates the GetTestNotificationsAtTenantActionGroupResourceLevel request. +func (client *Client) getTestNotificationsAtTenantActionGroupResourceLevelCreateRequest(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, notificationID string, options *ClientGetTestNotificationsAtTenantActionGroupResourceLevelOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/tenantActionGroups/{tenantActionGroupName}/notificationStatus/{notificationId}" + if managementGroupID == "" { + return nil, errors.New("parameter managementGroupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) + if tenantActionGroupName == "" { + return nil, errors.New("parameter tenantActionGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tenantActionGroupName}", url.PathEscape(tenantActionGroupName)) + if notificationID == "" { + return nil, errors.New("parameter notificationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{notificationId}", url.PathEscape(notificationID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["x-ms-client-tenant-id"] = []string{xmsClientTenantID} + return req, nil +} + +// getTestNotificationsAtTenantActionGroupResourceLevelHandleResponse handles the GetTestNotificationsAtTenantActionGroupResourceLevel response. +func (client *Client) getTestNotificationsAtTenantActionGroupResourceLevelHandleResponse(resp *http.Response) (ClientGetTestNotificationsAtTenantActionGroupResourceLevelResponse, error) { + result := ClientGetTestNotificationsAtTenantActionGroupResourceLevelResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TestNotificationDetailsResponseAutoGenerated); err != nil { + return ClientGetTestNotificationsAtTenantActionGroupResourceLevelResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/monitor/armmonitor/client_factory.go b/sdk/resourcemanager/monitor/armmonitor/client_factory.go index 06b2c0c10362..1781fb287e51 100644 --- a/sdk/resourcemanager/monitor/armmonitor/client_factory.go +++ b/sdk/resourcemanager/monitor/armmonitor/client_factory.go @@ -17,214 +17,282 @@ import ( // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { subscriptionID string - credential azcore.TokenCredential - options *arm.ClientOptions + internal *arm.Client } // NewClientFactory creates a new instance of ClientFactory with the specified values. // The parameter values will be propagated to any client created from this factory. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { - _, err := arm.NewClient(moduleName, moduleVersion, credential, options) + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } return &ClientFactory{ - subscriptionID: subscriptionID, credential: credential, - options: options.Clone(), + subscriptionID: subscriptionID, + internal: internal, }, nil } // NewActionGroupsClient creates a new instance of ActionGroupsClient. func (c *ClientFactory) NewActionGroupsClient() *ActionGroupsClient { - subClient, _ := NewActionGroupsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &ActionGroupsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewActivityLogAlertsClient creates a new instance of ActivityLogAlertsClient. func (c *ClientFactory) NewActivityLogAlertsClient() *ActivityLogAlertsClient { - subClient, _ := NewActivityLogAlertsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &ActivityLogAlertsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewActivityLogsClient creates a new instance of ActivityLogsClient. func (c *ClientFactory) NewActivityLogsClient() *ActivityLogsClient { - subClient, _ := NewActivityLogsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &ActivityLogsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewAlertRuleIncidentsClient creates a new instance of AlertRuleIncidentsClient. func (c *ClientFactory) NewAlertRuleIncidentsClient() *AlertRuleIncidentsClient { - subClient, _ := NewAlertRuleIncidentsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &AlertRuleIncidentsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewAlertRulesClient creates a new instance of AlertRulesClient. func (c *ClientFactory) NewAlertRulesClient() *AlertRulesClient { - subClient, _ := NewAlertRulesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &AlertRulesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewAutoscaleSettingsClient creates a new instance of AutoscaleSettingsClient. func (c *ClientFactory) NewAutoscaleSettingsClient() *AutoscaleSettingsClient { - subClient, _ := NewAutoscaleSettingsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &AutoscaleSettingsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewAzureMonitorWorkspacesClient creates a new instance of AzureMonitorWorkspacesClient. func (c *ClientFactory) NewAzureMonitorWorkspacesClient() *AzureMonitorWorkspacesClient { - subClient, _ := NewAzureMonitorWorkspacesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &AzureMonitorWorkspacesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewBaselinesClient creates a new instance of BaselinesClient. func (c *ClientFactory) NewBaselinesClient() *BaselinesClient { - subClient, _ := NewBaselinesClient(c.credential, c.options) - return subClient + return &BaselinesClient{ + internal: c.internal, + } +} + +// NewClient creates a new instance of Client. +func (c *ClientFactory) NewClient() *Client { + return &Client{ + internal: c.internal, + } } // NewDataCollectionEndpointsClient creates a new instance of DataCollectionEndpointsClient. func (c *ClientFactory) NewDataCollectionEndpointsClient() *DataCollectionEndpointsClient { - subClient, _ := NewDataCollectionEndpointsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &DataCollectionEndpointsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewDataCollectionRuleAssociationsClient creates a new instance of DataCollectionRuleAssociationsClient. func (c *ClientFactory) NewDataCollectionRuleAssociationsClient() *DataCollectionRuleAssociationsClient { - subClient, _ := NewDataCollectionRuleAssociationsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &DataCollectionRuleAssociationsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewDataCollectionRulesClient creates a new instance of DataCollectionRulesClient. func (c *ClientFactory) NewDataCollectionRulesClient() *DataCollectionRulesClient { - subClient, _ := NewDataCollectionRulesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &DataCollectionRulesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewDiagnosticSettingsCategoryClient creates a new instance of DiagnosticSettingsCategoryClient. func (c *ClientFactory) NewDiagnosticSettingsCategoryClient() *DiagnosticSettingsCategoryClient { - subClient, _ := NewDiagnosticSettingsCategoryClient(c.credential, c.options) - return subClient + return &DiagnosticSettingsCategoryClient{ + internal: c.internal, + } } // NewDiagnosticSettingsClient creates a new instance of DiagnosticSettingsClient. func (c *ClientFactory) NewDiagnosticSettingsClient() *DiagnosticSettingsClient { - subClient, _ := NewDiagnosticSettingsClient(c.credential, c.options) - return subClient + return &DiagnosticSettingsClient{ + internal: c.internal, + } } // NewEventCategoriesClient creates a new instance of EventCategoriesClient. func (c *ClientFactory) NewEventCategoriesClient() *EventCategoriesClient { - subClient, _ := NewEventCategoriesClient(c.credential, c.options) - return subClient + return &EventCategoriesClient{ + internal: c.internal, + } } // NewLogProfilesClient creates a new instance of LogProfilesClient. func (c *ClientFactory) NewLogProfilesClient() *LogProfilesClient { - subClient, _ := NewLogProfilesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &LogProfilesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewMetricAlertsClient creates a new instance of MetricAlertsClient. func (c *ClientFactory) NewMetricAlertsClient() *MetricAlertsClient { - subClient, _ := NewMetricAlertsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &MetricAlertsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewMetricAlertsStatusClient creates a new instance of MetricAlertsStatusClient. func (c *ClientFactory) NewMetricAlertsStatusClient() *MetricAlertsStatusClient { - subClient, _ := NewMetricAlertsStatusClient(c.subscriptionID, c.credential, c.options) - return subClient + return &MetricAlertsStatusClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewMetricDefinitionsClient creates a new instance of MetricDefinitionsClient. func (c *ClientFactory) NewMetricDefinitionsClient() *MetricDefinitionsClient { - subClient, _ := NewMetricDefinitionsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &MetricDefinitionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewMetricNamespacesClient creates a new instance of MetricNamespacesClient. func (c *ClientFactory) NewMetricNamespacesClient() *MetricNamespacesClient { - subClient, _ := NewMetricNamespacesClient(c.credential, c.options) - return subClient + return &MetricNamespacesClient{ + internal: c.internal, + } } // NewMetricsClient creates a new instance of MetricsClient. func (c *ClientFactory) NewMetricsClient() *MetricsClient { - subClient, _ := NewMetricsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &MetricsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewOperationsClient creates a new instance of OperationsClient. func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) - return subClient + return &OperationsClient{ + internal: c.internal, + } } // NewOperationsForMonitorClient creates a new instance of OperationsForMonitorClient. func (c *ClientFactory) NewOperationsForMonitorClient() *OperationsForMonitorClient { - subClient, _ := NewOperationsForMonitorClient(c.credential, c.options) - return subClient + return &OperationsForMonitorClient{ + internal: c.internal, + } } // NewPredictiveMetricClient creates a new instance of PredictiveMetricClient. func (c *ClientFactory) NewPredictiveMetricClient() *PredictiveMetricClient { - subClient, _ := NewPredictiveMetricClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PredictiveMetricClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient. func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { - subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PrivateEndpointConnectionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient. func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { - subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PrivateLinkResourcesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewPrivateLinkScopeOperationStatusClient creates a new instance of PrivateLinkScopeOperationStatusClient. func (c *ClientFactory) NewPrivateLinkScopeOperationStatusClient() *PrivateLinkScopeOperationStatusClient { - subClient, _ := NewPrivateLinkScopeOperationStatusClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PrivateLinkScopeOperationStatusClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewPrivateLinkScopedResourcesClient creates a new instance of PrivateLinkScopedResourcesClient. func (c *ClientFactory) NewPrivateLinkScopedResourcesClient() *PrivateLinkScopedResourcesClient { - subClient, _ := NewPrivateLinkScopedResourcesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PrivateLinkScopedResourcesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewPrivateLinkScopesClient creates a new instance of PrivateLinkScopesClient. func (c *ClientFactory) NewPrivateLinkScopesClient() *PrivateLinkScopesClient { - subClient, _ := NewPrivateLinkScopesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PrivateLinkScopesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewScheduledQueryRuleClient creates a new instance of ScheduledQueryRuleClient. +func (c *ClientFactory) NewScheduledQueryRuleClient() *ScheduledQueryRuleClient { + return &ScheduledQueryRuleClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewScheduledQueryRulesClient creates a new instance of ScheduledQueryRulesClient. func (c *ClientFactory) NewScheduledQueryRulesClient() *ScheduledQueryRulesClient { - subClient, _ := NewScheduledQueryRulesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &ScheduledQueryRulesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewTenantActionGroupsClient creates a new instance of TenantActionGroupsClient. func (c *ClientFactory) NewTenantActionGroupsClient() *TenantActionGroupsClient { - subClient, _ := NewTenantActionGroupsClient(c.credential, c.options) - return subClient + return &TenantActionGroupsClient{ + internal: c.internal, + } } // NewTenantActivityLogsClient creates a new instance of TenantActivityLogsClient. func (c *ClientFactory) NewTenantActivityLogsClient() *TenantActivityLogsClient { - subClient, _ := NewTenantActivityLogsClient(c.credential, c.options) - return subClient + return &TenantActivityLogsClient{ + internal: c.internal, + } } // NewVMInsightsClient creates a new instance of VMInsightsClient. func (c *ClientFactory) NewVMInsightsClient() *VMInsightsClient { - subClient, _ := NewVMInsightsClient(c.credential, c.options) - return subClient + return &VMInsightsClient{ + internal: c.internal, + } } diff --git a/sdk/resourcemanager/monitor/armmonitor/constants.go b/sdk/resourcemanager/monitor/armmonitor/constants.go index 352de0354f9d..83ae27aceece 100644 --- a/sdk/resourcemanager/monitor/armmonitor/constants.go +++ b/sdk/resourcemanager/monitor/armmonitor/constants.go @@ -10,7 +10,7 @@ package armmonitor const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - moduleVersion = "v0.11.0" + moduleVersion = "v0.12.0" ) // AccessMode - Access mode types. @@ -29,6 +29,24 @@ func PossibleAccessModeValues() []AccessMode { } } +// AccessRuleDirection - Direction of Access Rule +type AccessRuleDirection string + +const ( + // AccessRuleDirectionInbound - Applies to inbound network traffic to the secured resources. + AccessRuleDirectionInbound AccessRuleDirection = "Inbound" + // AccessRuleDirectionOutbound - Applies to outbound network traffic from the secured resources + AccessRuleDirectionOutbound AccessRuleDirection = "Outbound" +) + +// PossibleAccessRuleDirectionValues returns the possible values for the AccessRuleDirection const type. +func PossibleAccessRuleDirectionValues() []AccessRuleDirection { + return []AccessRuleDirection{ + AccessRuleDirectionInbound, + AccessRuleDirectionOutbound, + } +} + // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. type ActionType string @@ -43,7 +61,7 @@ func PossibleActionTypeValues() []ActionType { } } -// AggregationType - the aggregation type of the metric. +// AggregationType - The aggregation type of the metric. type AggregationType string const ( @@ -338,6 +356,47 @@ func PossibleIdentityTypeValues() []IdentityType { } } +// IncidentManagementService - The incident management service type +type IncidentManagementService string + +const ( + IncidentManagementServiceIcm IncidentManagementService = "Icm" +) + +// PossibleIncidentManagementServiceValues returns the possible values for the IncidentManagementService const type. +func PossibleIncidentManagementServiceValues() []IncidentManagementService { + return []IncidentManagementService{ + IncidentManagementServiceIcm, + } +} + +// IssueType - Type of issue +type IssueType string + +const ( + // IssueTypeConfigurationPropagationFailure - An error occurred while applying the network security perimeter (NSP) configuration. + IssueTypeConfigurationPropagationFailure IssueType = "ConfigurationPropagationFailure" + // IssueTypeMissingIdentityConfiguration - An managed identity hasn't been associated with the resource. The resource will + // still be able to validate inbound traffic from the network security perimeter (NSP) or matching inbound access rules, but + // it won't be able to perform outbound access as a member of the NSP. + IssueTypeMissingIdentityConfiguration IssueType = "MissingIdentityConfiguration" + // IssueTypeMissingPerimeterConfiguration - A network connectivity issue is happening on the resource which could be addressed + // either by adding new resources to the network security perimeter (NSP) or by modifying access rules. + IssueTypeMissingPerimeterConfiguration IssueType = "MissingPerimeterConfiguration" + // IssueTypeUnknown - Unknown issue type + IssueTypeUnknown IssueType = "Unknown" +) + +// PossibleIssueTypeValues returns the possible values for the IssueType const type. +func PossibleIssueTypeValues() []IssueType { + return []IssueType{ + IssueTypeConfigurationPropagationFailure, + IssueTypeMissingIdentityConfiguration, + IssueTypeMissingPerimeterConfiguration, + IssueTypeUnknown, + } +} + // Kind - Indicates the type of scheduled query rule. The default is LogAlert. type Kind string @@ -354,6 +413,22 @@ func PossibleKindValues() []Kind { } } +// KnownAgentSettingName - The name of the setting. Must be part of the list of supported settings +type KnownAgentSettingName string + +const ( + KnownAgentSettingNameMaxDiskQuotaInMB KnownAgentSettingName = "MaxDiskQuotaInMB" + KnownAgentSettingNameUseTimeReceivedForForwardedEvents KnownAgentSettingName = "UseTimeReceivedForForwardedEvents" +) + +// PossibleKnownAgentSettingNameValues returns the possible values for the KnownAgentSettingName const type. +func PossibleKnownAgentSettingNameValues() []KnownAgentSettingName { + return []KnownAgentSettingName{ + KnownAgentSettingNameMaxDiskQuotaInMB, + KnownAgentSettingNameUseTimeReceivedForForwardedEvents, + } +} + // KnownColumnDefinitionType - The type of the column data. type KnownColumnDefinitionType string @@ -584,12 +659,14 @@ func PossibleKnownLogFileTextSettingsRecordStartTimestampFormatValues() []KnownL type KnownLogFilesDataSourceFormat string const ( + KnownLogFilesDataSourceFormatJSON KnownLogFilesDataSourceFormat = "json" KnownLogFilesDataSourceFormatText KnownLogFilesDataSourceFormat = "text" ) // PossibleKnownLogFilesDataSourceFormatValues returns the possible values for the KnownLogFilesDataSourceFormat const type. func PossibleKnownLogFilesDataSourceFormatValues() []KnownLogFilesDataSourceFormat { return []KnownLogFilesDataSourceFormat{ + KnownLogFilesDataSourceFormatJSON, KnownLogFilesDataSourceFormatText, } } @@ -641,14 +718,34 @@ func PossibleKnownPublicNetworkAccessOptionsValues() []KnownPublicNetworkAccessO } } +// KnownStorageBlobLookupType - The type of lookup to perform on the blob +type KnownStorageBlobLookupType string + +const ( + KnownStorageBlobLookupTypeCidr KnownStorageBlobLookupType = "Cidr" + KnownStorageBlobLookupTypeString KnownStorageBlobLookupType = "String" +) + +// PossibleKnownStorageBlobLookupTypeValues returns the possible values for the KnownStorageBlobLookupType const type. +func PossibleKnownStorageBlobLookupTypeValues() []KnownStorageBlobLookupType { + return []KnownStorageBlobLookupType{ + KnownStorageBlobLookupTypeCidr, + KnownStorageBlobLookupTypeString, + } +} + type KnownSyslogDataSourceFacilityNames string const ( + KnownSyslogDataSourceFacilityNamesAlert KnownSyslogDataSourceFacilityNames = "alert" KnownSyslogDataSourceFacilityNamesAsterisk KnownSyslogDataSourceFacilityNames = "*" + KnownSyslogDataSourceFacilityNamesAudit KnownSyslogDataSourceFacilityNames = "audit" KnownSyslogDataSourceFacilityNamesAuth KnownSyslogDataSourceFacilityNames = "auth" KnownSyslogDataSourceFacilityNamesAuthpriv KnownSyslogDataSourceFacilityNames = "authpriv" + KnownSyslogDataSourceFacilityNamesClock KnownSyslogDataSourceFacilityNames = "clock" KnownSyslogDataSourceFacilityNamesCron KnownSyslogDataSourceFacilityNames = "cron" KnownSyslogDataSourceFacilityNamesDaemon KnownSyslogDataSourceFacilityNames = "daemon" + KnownSyslogDataSourceFacilityNamesFtp KnownSyslogDataSourceFacilityNames = "ftp" KnownSyslogDataSourceFacilityNamesKern KnownSyslogDataSourceFacilityNames = "kern" KnownSyslogDataSourceFacilityNamesLocal0 KnownSyslogDataSourceFacilityNames = "local0" KnownSyslogDataSourceFacilityNamesLocal1 KnownSyslogDataSourceFacilityNames = "local1" @@ -662,6 +759,8 @@ const ( KnownSyslogDataSourceFacilityNamesMail KnownSyslogDataSourceFacilityNames = "mail" KnownSyslogDataSourceFacilityNamesMark KnownSyslogDataSourceFacilityNames = "mark" KnownSyslogDataSourceFacilityNamesNews KnownSyslogDataSourceFacilityNames = "news" + KnownSyslogDataSourceFacilityNamesNopri KnownSyslogDataSourceFacilityNames = "nopri" + KnownSyslogDataSourceFacilityNamesNtp KnownSyslogDataSourceFacilityNames = "ntp" KnownSyslogDataSourceFacilityNamesSyslog KnownSyslogDataSourceFacilityNames = "syslog" KnownSyslogDataSourceFacilityNamesUser KnownSyslogDataSourceFacilityNames = "user" KnownSyslogDataSourceFacilityNamesUucp KnownSyslogDataSourceFacilityNames = "uucp" @@ -670,11 +769,15 @@ const ( // PossibleKnownSyslogDataSourceFacilityNamesValues returns the possible values for the KnownSyslogDataSourceFacilityNames const type. func PossibleKnownSyslogDataSourceFacilityNamesValues() []KnownSyslogDataSourceFacilityNames { return []KnownSyslogDataSourceFacilityNames{ + KnownSyslogDataSourceFacilityNamesAlert, KnownSyslogDataSourceFacilityNamesAsterisk, + KnownSyslogDataSourceFacilityNamesAudit, KnownSyslogDataSourceFacilityNamesAuth, KnownSyslogDataSourceFacilityNamesAuthpriv, + KnownSyslogDataSourceFacilityNamesClock, KnownSyslogDataSourceFacilityNamesCron, KnownSyslogDataSourceFacilityNamesDaemon, + KnownSyslogDataSourceFacilityNamesFtp, KnownSyslogDataSourceFacilityNamesKern, KnownSyslogDataSourceFacilityNamesLocal0, KnownSyslogDataSourceFacilityNamesLocal1, @@ -688,6 +791,8 @@ func PossibleKnownSyslogDataSourceFacilityNamesValues() []KnownSyslogDataSourceF KnownSyslogDataSourceFacilityNamesMail, KnownSyslogDataSourceFacilityNamesMark, KnownSyslogDataSourceFacilityNamesNews, + KnownSyslogDataSourceFacilityNamesNopri, + KnownSyslogDataSourceFacilityNamesNtp, KnownSyslogDataSourceFacilityNamesSyslog, KnownSyslogDataSourceFacilityNamesUser, KnownSyslogDataSourceFacilityNamesUucp, @@ -751,6 +856,23 @@ func PossibleKnownWindowsEventLogDataSourceStreamsValues() []KnownWindowsEventLo } } +type KnownWindowsFirewallLogsDataSourceProfileFilter string + +const ( + KnownWindowsFirewallLogsDataSourceProfileFilterDomain KnownWindowsFirewallLogsDataSourceProfileFilter = "Domain" + KnownWindowsFirewallLogsDataSourceProfileFilterPrivate KnownWindowsFirewallLogsDataSourceProfileFilter = "Private" + KnownWindowsFirewallLogsDataSourceProfileFilterPublic KnownWindowsFirewallLogsDataSourceProfileFilter = "Public" +) + +// PossibleKnownWindowsFirewallLogsDataSourceProfileFilterValues returns the possible values for the KnownWindowsFirewallLogsDataSourceProfileFilter const type. +func PossibleKnownWindowsFirewallLogsDataSourceProfileFilterValues() []KnownWindowsFirewallLogsDataSourceProfileFilter { + return []KnownWindowsFirewallLogsDataSourceProfileFilter{ + KnownWindowsFirewallLogsDataSourceProfileFilterDomain, + KnownWindowsFirewallLogsDataSourceProfileFilterPrivate, + KnownWindowsFirewallLogsDataSourceProfileFilterPublic, + } +} + // ManagedServiceIdentityType - Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). type ManagedServiceIdentityType string @@ -771,7 +893,7 @@ func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { } } -// MetricAggregationType - the aggregation type of the metric. +// MetricAggregationType - The aggregation type of the metric. type MetricAggregationType string const ( @@ -860,19 +982,33 @@ func PossibleMetricStatisticTypeValues() []MetricStatisticType { type MetricUnit string const ( - MetricUnitBitsPerSecond MetricUnit = "BitsPerSecond" - MetricUnitByteSeconds MetricUnit = "ByteSeconds" - MetricUnitBytes MetricUnit = "Bytes" + // MetricUnitBitsPerSecond - Rate unit of binary digits per second. + MetricUnitBitsPerSecond MetricUnit = "BitsPerSecond" + // MetricUnitByteSeconds - Unit of data transfer or storage. It is the size of the data in bytes multiplied by the time it + // takes to transfer or store the data in seconds. + MetricUnitByteSeconds MetricUnit = "ByteSeconds" + // MetricUnitBytes - Unit of memory in bytes. + MetricUnitBytes MetricUnit = "Bytes" + // MetricUnitBytesPerSecond - Rate unit of memory in bytes per second. MetricUnitBytesPerSecond MetricUnit = "BytesPerSecond" - MetricUnitCores MetricUnit = "Cores" - MetricUnitCount MetricUnit = "Count" + // MetricUnitCores - Unit of processing power. + MetricUnitCores MetricUnit = "Cores" + // MetricUnitCount - Unit of raw quantity. + MetricUnitCount MetricUnit = "Count" + // MetricUnitCountPerSecond - Rate unit of raw quantity per second. MetricUnitCountPerSecond MetricUnit = "CountPerSecond" - MetricUnitMilliCores MetricUnit = "MilliCores" - MetricUnitMilliSeconds MetricUnit = "MilliSeconds" - MetricUnitNanoCores MetricUnit = "NanoCores" - MetricUnitPercent MetricUnit = "Percent" - MetricUnitSeconds MetricUnit = "Seconds" - MetricUnitUnspecified MetricUnit = "Unspecified" + // MetricUnitMilliCores - Unit of processing power in 1/1000th of a CPU core. + MetricUnitMilliCores MetricUnit = "MilliCores" + // MetricUnitMilliSeconds - Unit of time in 1/1000th of a second. + MetricUnitMilliSeconds MetricUnit = "MilliSeconds" + // MetricUnitNanoCores - Unit of processing power in one billionth of a CPU core. + MetricUnitNanoCores MetricUnit = "NanoCores" + // MetricUnitPercent - Percentage unit. + MetricUnitPercent MetricUnit = "Percent" + // MetricUnitSeconds - Unit of time in seconds. + MetricUnitSeconds MetricUnit = "Seconds" + // MetricUnitUnspecified - No specified unit. + MetricUnitUnspecified MetricUnit = "Unspecified" ) // PossibleMetricUnitValues returns the possible values for the MetricUnit const type. @@ -912,6 +1048,33 @@ func PossibleNamespaceClassificationValues() []NamespaceClassification { } } +// NetworkSecurityPerimeterConfigurationProvisioningState - Provisioning state of a network security perimeter configuration +// that is being created or updated. +type NetworkSecurityPerimeterConfigurationProvisioningState string + +const ( + NetworkSecurityPerimeterConfigurationProvisioningStateAccepted NetworkSecurityPerimeterConfigurationProvisioningState = "Accepted" + NetworkSecurityPerimeterConfigurationProvisioningStateCanceled NetworkSecurityPerimeterConfigurationProvisioningState = "Canceled" + NetworkSecurityPerimeterConfigurationProvisioningStateCreating NetworkSecurityPerimeterConfigurationProvisioningState = "Creating" + NetworkSecurityPerimeterConfigurationProvisioningStateDeleting NetworkSecurityPerimeterConfigurationProvisioningState = "Deleting" + NetworkSecurityPerimeterConfigurationProvisioningStateFailed NetworkSecurityPerimeterConfigurationProvisioningState = "Failed" + NetworkSecurityPerimeterConfigurationProvisioningStateSucceeded NetworkSecurityPerimeterConfigurationProvisioningState = "Succeeded" + NetworkSecurityPerimeterConfigurationProvisioningStateUpdating NetworkSecurityPerimeterConfigurationProvisioningState = "Updating" +) + +// PossibleNetworkSecurityPerimeterConfigurationProvisioningStateValues returns the possible values for the NetworkSecurityPerimeterConfigurationProvisioningState const type. +func PossibleNetworkSecurityPerimeterConfigurationProvisioningStateValues() []NetworkSecurityPerimeterConfigurationProvisioningState { + return []NetworkSecurityPerimeterConfigurationProvisioningState{ + NetworkSecurityPerimeterConfigurationProvisioningStateAccepted, + NetworkSecurityPerimeterConfigurationProvisioningStateCanceled, + NetworkSecurityPerimeterConfigurationProvisioningStateCreating, + NetworkSecurityPerimeterConfigurationProvisioningStateDeleting, + NetworkSecurityPerimeterConfigurationProvisioningStateFailed, + NetworkSecurityPerimeterConfigurationProvisioningStateSucceeded, + NetworkSecurityPerimeterConfigurationProvisioningStateUpdating, + } +} + // Odatatype - specifies the type of the alert criteria. type Odatatype string @@ -1046,7 +1209,7 @@ func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointSer } } -// ProvisioningState - The provisioning state of the Azure Monitor workspace. Set to Succeeded if everything is healthy. +// ProvisioningState - The provisioning state of the Azure Monitor Workspace. Set to Succeeded if everything is healthy. type ProvisioningState string const ( @@ -1068,13 +1231,12 @@ func PossibleProvisioningStateValues() []ProvisioningState { } } -// PublicNetworkAccess - This determines if traffic is allowed over public network. By default it is enabled. +// PublicNetworkAccess - Gets or sets allow or disallow public network access to Azure Monitor Workspace type PublicNetworkAccess string const ( - PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" - PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" - PublicNetworkAccessSecuredByPerimeter PublicNetworkAccess = "SecuredByPerimeter" + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" ) // PossiblePublicNetworkAccessValues returns the possible values for the PublicNetworkAccess const type. @@ -1082,7 +1244,6 @@ func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { return []PublicNetworkAccess{ PublicNetworkAccessDisabled, PublicNetworkAccessEnabled, - PublicNetworkAccessSecuredByPerimeter, } } @@ -1134,6 +1295,29 @@ func PossibleRecurrenceFrequencyValues() []RecurrenceFrequency { } } +// ResourceAssociationAccessMode - Access mode of the resource association +type ResourceAssociationAccessMode string + +const ( + // ResourceAssociationAccessModeAudit - Audit access mode - traffic to the resource that fails access checks is logged but + // not blocked + ResourceAssociationAccessModeAudit ResourceAssociationAccessMode = "Audit" + // ResourceAssociationAccessModeEnforced - Enforced access mode - traffic to the resource that failed access checks is blocked + ResourceAssociationAccessModeEnforced ResourceAssociationAccessMode = "Enforced" + // ResourceAssociationAccessModeLearning - Learning access mode - traffic to the resource is enabled for analysis but not + // blocked + ResourceAssociationAccessModeLearning ResourceAssociationAccessMode = "Learning" +) + +// PossibleResourceAssociationAccessModeValues returns the possible values for the ResourceAssociationAccessMode const type. +func PossibleResourceAssociationAccessModeValues() []ResourceAssociationAccessMode { + return []ResourceAssociationAccessMode{ + ResourceAssociationAccessModeAudit, + ResourceAssociationAccessModeEnforced, + ResourceAssociationAccessModeLearning, + } +} + type ResultType string const ( @@ -1204,6 +1388,22 @@ func PossibleScaleTypeValues() []ScaleType { } } +// Severity - Severity of the issue. +type Severity string + +const ( + SeverityError Severity = "Error" + SeverityWarning Severity = "Warning" +) + +// PossibleSeverityValues returns the possible values for the Severity const type. +func PossibleSeverityValues() []Severity { + return []Severity{ + SeverityError, + SeverityWarning, + } +} + // TimeAggregation - Aggregation type. Relevant and required only for rules of the kind LogAlert. type TimeAggregation string @@ -1272,41 +1472,3 @@ func PossibleTimeAggregationTypeValues() []TimeAggregationType { TimeAggregationTypeTotal, } } - -// Unit - The unit of the metric. -type Unit string - -const ( - UnitBitsPerSecond Unit = "BitsPerSecond" - UnitByteSeconds Unit = "ByteSeconds" - UnitBytes Unit = "Bytes" - UnitBytesPerSecond Unit = "BytesPerSecond" - UnitCores Unit = "Cores" - UnitCount Unit = "Count" - UnitCountPerSecond Unit = "CountPerSecond" - UnitMilliCores Unit = "MilliCores" - UnitMilliSeconds Unit = "MilliSeconds" - UnitNanoCores Unit = "NanoCores" - UnitPercent Unit = "Percent" - UnitSeconds Unit = "Seconds" - UnitUnspecified Unit = "Unspecified" -) - -// PossibleUnitValues returns the possible values for the Unit const type. -func PossibleUnitValues() []Unit { - return []Unit{ - UnitBitsPerSecond, - UnitByteSeconds, - UnitBytes, - UnitBytesPerSecond, - UnitCores, - UnitCount, - UnitCountPerSecond, - UnitMilliCores, - UnitMilliSeconds, - UnitNanoCores, - UnitPercent, - UnitSeconds, - UnitUnspecified, - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client.go index 7ec4fe0471b7..234729549099 100644 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client.go @@ -28,7 +28,7 @@ type DataCollectionEndpointsClient struct { } // NewDataCollectionEndpointsClient creates a new instance of DataCollectionEndpointsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewDataCollectionEndpointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DataCollectionEndpointsClient, error) { @@ -46,7 +46,7 @@ func NewDataCollectionEndpointsClient(subscriptionID string, credential azcore.T // Create - Creates or updates a data collection endpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-06-01 +// Generated from API version 2023-03-11 // - 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. // - options - DataCollectionEndpointsClientCreateOptions contains the optional parameters for the DataCollectionEndpointsClient.Create @@ -93,7 +93,7 @@ func (client *DataCollectionEndpointsClient) createCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") + reqQP.Set("api-version", "2023-03-11") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { @@ -117,7 +117,7 @@ func (client *DataCollectionEndpointsClient) createHandleResponse(resp *http.Res // Delete - Deletes a data collection endpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-06-01 +// Generated from API version 2023-03-11 // - 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. // - options - DataCollectionEndpointsClientDeleteOptions contains the optional parameters for the DataCollectionEndpointsClient.Delete @@ -163,7 +163,7 @@ func (client *DataCollectionEndpointsClient) deleteCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") + reqQP.Set("api-version", "2023-03-11") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -172,7 +172,7 @@ func (client *DataCollectionEndpointsClient) deleteCreateRequest(ctx context.Con // Get - Returns the specified data collection endpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-06-01 +// Generated from API version 2023-03-11 // - 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. // - options - DataCollectionEndpointsClientGetOptions contains the optional parameters for the DataCollectionEndpointsClient.Get @@ -219,7 +219,7 @@ func (client *DataCollectionEndpointsClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") + reqQP.Set("api-version", "2023-03-11") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -234,9 +234,79 @@ func (client *DataCollectionEndpointsClient) getHandleResponse(resp *http.Respon return result, nil } +// GetNSP - Gets the specified NSP configuration for the specified data collection endpoint. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-10-01 +// - 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. +// - networkSecurityPerimeterConfigurationName - The name for a network security perimeter configuration +// - options - DataCollectionEndpointsClientGetNSPOptions contains the optional parameters for the DataCollectionEndpointsClient.GetNSP +// method. +func (client *DataCollectionEndpointsClient) GetNSP(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, networkSecurityPerimeterConfigurationName string, options *DataCollectionEndpointsClientGetNSPOptions) (DataCollectionEndpointsClientGetNSPResponse, error) { + var err error + const operationName = "DataCollectionEndpointsClient.GetNSP" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getNSPCreateRequest(ctx, resourceGroupName, dataCollectionEndpointName, networkSecurityPerimeterConfigurationName, options) + if err != nil { + return DataCollectionEndpointsClientGetNSPResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DataCollectionEndpointsClientGetNSPResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DataCollectionEndpointsClientGetNSPResponse{}, err + } + resp, err := client.getNSPHandleResponse(httpResp) + return resp, err +} + +// getNSPCreateRequest creates the GetNSP request. +func (client *DataCollectionEndpointsClient) getNSPCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, networkSecurityPerimeterConfigurationName string, options *DataCollectionEndpointsClientGetNSPOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}/networkSecurityPerimeterConfigurations/{networkSecurityPerimeterConfigurationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if dataCollectionEndpointName == "" { + return nil, errors.New("parameter dataCollectionEndpointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dataCollectionEndpointName}", url.PathEscape(dataCollectionEndpointName)) + if networkSecurityPerimeterConfigurationName == "" { + return nil, errors.New("parameter networkSecurityPerimeterConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkSecurityPerimeterConfigurationName}", url.PathEscape(networkSecurityPerimeterConfigurationName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getNSPHandleResponse handles the GetNSP response. +func (client *DataCollectionEndpointsClient) getNSPHandleResponse(resp *http.Response) (DataCollectionEndpointsClientGetNSPResponse, error) { + result := DataCollectionEndpointsClientGetNSPResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkSecurityPerimeterConfiguration); err != nil { + return DataCollectionEndpointsClientGetNSPResponse{}, err + } + return result, nil +} + // NewListByResourceGroupPager - Lists all data collection endpoints in the specified resource group. // -// Generated from API version 2022-06-01 +// Generated from API version 2023-03-11 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - DataCollectionEndpointsClientListByResourceGroupOptions contains the optional parameters for the DataCollectionEndpointsClient.NewListByResourceGroupPager // method. @@ -279,7 +349,7 @@ func (client *DataCollectionEndpointsClient) listByResourceGroupCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") + reqQP.Set("api-version", "2023-03-11") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -296,7 +366,7 @@ func (client *DataCollectionEndpointsClient) listByResourceGroupHandleResponse(r // NewListBySubscriptionPager - Lists all data collection endpoints in the specified subscription // -// Generated from API version 2022-06-01 +// Generated from API version 2023-03-11 // - options - DataCollectionEndpointsClientListBySubscriptionOptions contains the optional parameters for the DataCollectionEndpointsClient.NewListBySubscriptionPager // method. func (client *DataCollectionEndpointsClient) NewListBySubscriptionPager(options *DataCollectionEndpointsClientListBySubscriptionOptions) *runtime.Pager[DataCollectionEndpointsClientListBySubscriptionResponse] { @@ -334,7 +404,7 @@ func (client *DataCollectionEndpointsClient) listBySubscriptionCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") + reqQP.Set("api-version", "2023-03-11") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -349,10 +419,157 @@ func (client *DataCollectionEndpointsClient) listBySubscriptionHandleResponse(re return result, nil } +// NewListNSPPager - Gets a list of NSP configurations for the specified data collection endpoint. +// +// Generated from API version 2021-10-01 +// - 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. +// - options - DataCollectionEndpointsClientListNSPOptions contains the optional parameters for the DataCollectionEndpointsClient.NewListNSPPager +// method. +func (client *DataCollectionEndpointsClient) NewListNSPPager(resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientListNSPOptions) *runtime.Pager[DataCollectionEndpointsClientListNSPResponse] { + return runtime.NewPager(runtime.PagingHandler[DataCollectionEndpointsClientListNSPResponse]{ + More: func(page DataCollectionEndpointsClientListNSPResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DataCollectionEndpointsClientListNSPResponse) (DataCollectionEndpointsClientListNSPResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DataCollectionEndpointsClient.NewListNSPPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listNSPCreateRequest(ctx, resourceGroupName, dataCollectionEndpointName, options) + }, nil) + if err != nil { + return DataCollectionEndpointsClientListNSPResponse{}, err + } + return client.listNSPHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listNSPCreateRequest creates the ListNSP request. +func (client *DataCollectionEndpointsClient) listNSPCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientListNSPOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}/networkSecurityPerimeterConfigurations" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if dataCollectionEndpointName == "" { + return nil, errors.New("parameter dataCollectionEndpointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dataCollectionEndpointName}", url.PathEscape(dataCollectionEndpointName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listNSPHandleResponse handles the ListNSP response. +func (client *DataCollectionEndpointsClient) listNSPHandleResponse(resp *http.Response) (DataCollectionEndpointsClientListNSPResponse, error) { + result := DataCollectionEndpointsClientListNSPResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkSecurityPerimeterConfigurationListResult); err != nil { + return DataCollectionEndpointsClientListNSPResponse{}, err + } + return result, nil +} + +// BeginReconcileNSP - Reconciles the specified NSP configuration for the specified data collection endpoint. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-10-01 +// - 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. +// - networkSecurityPerimeterConfigurationName - The name for a network security perimeter configuration +// - options - DataCollectionEndpointsClientBeginReconcileNSPOptions contains the optional parameters for the DataCollectionEndpointsClient.BeginReconcileNSP +// method. +func (client *DataCollectionEndpointsClient) BeginReconcileNSP(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, networkSecurityPerimeterConfigurationName string, options *DataCollectionEndpointsClientBeginReconcileNSPOptions) (*runtime.Poller[DataCollectionEndpointsClientReconcileNSPResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.reconcileNSP(ctx, resourceGroupName, dataCollectionEndpointName, networkSecurityPerimeterConfigurationName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DataCollectionEndpointsClientReconcileNSPResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DataCollectionEndpointsClientReconcileNSPResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ReconcileNSP - Reconciles the specified NSP configuration for the specified data collection endpoint. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-10-01 +func (client *DataCollectionEndpointsClient) reconcileNSP(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, networkSecurityPerimeterConfigurationName string, options *DataCollectionEndpointsClientBeginReconcileNSPOptions) (*http.Response, error) { + var err error + const operationName = "DataCollectionEndpointsClient.BeginReconcileNSP" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.reconcileNSPCreateRequest(ctx, resourceGroupName, dataCollectionEndpointName, networkSecurityPerimeterConfigurationName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// reconcileNSPCreateRequest creates the ReconcileNSP request. +func (client *DataCollectionEndpointsClient) reconcileNSPCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, networkSecurityPerimeterConfigurationName string, options *DataCollectionEndpointsClientBeginReconcileNSPOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}/networkSecurityPerimeterConfigurations/{networkSecurityPerimeterConfigurationName}/reconcile" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if dataCollectionEndpointName == "" { + return nil, errors.New("parameter dataCollectionEndpointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dataCollectionEndpointName}", url.PathEscape(dataCollectionEndpointName)) + if networkSecurityPerimeterConfigurationName == "" { + return nil, errors.New("parameter networkSecurityPerimeterConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkSecurityPerimeterConfigurationName}", url.PathEscape(networkSecurityPerimeterConfigurationName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + // Update - Updates part of a data collection endpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-06-01 +// Generated from API version 2023-03-11 // - 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. // - options - DataCollectionEndpointsClientUpdateOptions contains the optional parameters for the DataCollectionEndpointsClient.Update @@ -399,7 +616,7 @@ func (client *DataCollectionEndpointsClient) updateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") + reqQP.Set("api-version", "2023-03-11") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client_example_test.go deleted file mode 100644 index 18d81e003a18..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client_example_test.go +++ /dev/null @@ -1,378 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionEndpointsListByResourceGroup.json -func ExampleDataCollectionEndpointsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataCollectionEndpointsClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DataCollectionEndpointResourceListResult = armmonitor.DataCollectionEndpointResourceListResult{ - // Value: []*armmonitor.DataCollectionEndpointResource{ - // { - // Name: to.Ptr("myCollectionEndpoint"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.control.monitor.azure.com"), - // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.ingest.monitor.azure.com"), - // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), - // }, - // }, - // SystemData: &armmonitor.DataCollectionEndpointResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // }, - // { - // Name: to.Ptr("herCollectionEndpoint"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/herCollectionEndpoint"), - // Location: to.Ptr("westus"), - // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ - // Endpoint: to.Ptr("https://hercollectionendpoint-xywz.eastus-1.control.monitor.azure.com"), - // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://hercollectionendpoint-xywz.eastus-1.ingest.monitor.azure.com"), - // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsDisabled), - // }, - // }, - // SystemData: &armmonitor.DataCollectionEndpointResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionEndpointsListBySubscription.json -func ExampleDataCollectionEndpointsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataCollectionEndpointsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DataCollectionEndpointResourceListResult = armmonitor.DataCollectionEndpointResourceListResult{ - // Value: []*armmonitor.DataCollectionEndpointResource{ - // { - // Name: to.Ptr("myCollectionEndpoint"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.control.monitor.azure.com"), - // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.ingest.monitor.azure.com"), - // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), - // }, - // }, - // SystemData: &armmonitor.DataCollectionEndpointResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // }, - // { - // Name: to.Ptr("herCollectionEndpoint"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/herResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/herCollectionEndpoint"), - // Location: to.Ptr("westus"), - // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ - // Endpoint: to.Ptr("https://hercollectionendpoint-xywz.eastus-1.control.monitor.azure.com"), - // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://hercollectionendpoint-xywz.eastus-1.ingest.monitor.azure.com"), - // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsDisabled), - // }, - // }, - // SystemData: &armmonitor.DataCollectionEndpointResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionEndpointsGet.json -func ExampleDataCollectionEndpointsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionEndpointsClient().Get(ctx, "myResourceGroup", "myCollectionEndpoint", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataCollectionEndpointResource = armmonitor.DataCollectionEndpointResource{ - // Name: to.Ptr("myCollectionEndpoint"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.control.monitor.azure.com"), - // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.ingest.monitor.azure.com"), - // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), - // }, - // }, - // SystemData: &armmonitor.DataCollectionEndpointResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionEndpointsCreate.json -func ExampleDataCollectionEndpointsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionEndpointsClient().Create(ctx, "myResourceGroup", "myCollectionEndpoint", &armmonitor.DataCollectionEndpointsClientCreateOptions{Body: &armmonitor.DataCollectionEndpointResource{ - Location: to.Ptr("eastus"), - Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), - }, - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataCollectionEndpointResource = armmonitor.DataCollectionEndpointResource{ - // Name: to.Ptr("myCollectionEndpoint"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.control.monitor.azure.com"), - // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.ingest.monitor.azure.com"), - // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), - // }, - // }, - // SystemData: &armmonitor.DataCollectionEndpointResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionEndpointsUpdate.json -func ExampleDataCollectionEndpointsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionEndpointsClient().Update(ctx, "myResourceGroup", "myCollectionEndpoint", &armmonitor.DataCollectionEndpointsClientUpdateOptions{Body: &armmonitor.ResourceForUpdate{ - Tags: map[string]*string{ - "tag1": to.Ptr("A"), - "tag2": to.Ptr("B"), - "tag3": to.Ptr("C"), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataCollectionEndpointResource = armmonitor.DataCollectionEndpointResource{ - // Name: to.Ptr("myCollectionEndpoint"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.control.monitor.azure.com"), - // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.ingest.monitor.azure.com"), - // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), - // }, - // }, - // SystemData: &armmonitor.DataCollectionEndpointResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // "tag3": to.Ptr("C"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionEndpointsDelete.json -func ExampleDataCollectionEndpointsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDataCollectionEndpointsClient().Delete(ctx, "myResourceGroup", "myCollectionEndpoint", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client.go index 820b5876aabb..716a2f975c51 100644 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client.go @@ -28,7 +28,7 @@ type DataCollectionRuleAssociationsClient struct { } // NewDataCollectionRuleAssociationsClient creates a new instance of DataCollectionRuleAssociationsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewDataCollectionRuleAssociationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DataCollectionRuleAssociationsClient, error) { @@ -46,7 +46,7 @@ func NewDataCollectionRuleAssociationsClient(subscriptionID string, credential a // Create - Creates or updates an association. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-06-01 +// Generated from API version 2023-03-11 // - resourceURI - The identifier of the resource. // - associationName - The name of the association. The name is case insensitive. // - options - DataCollectionRuleAssociationsClientCreateOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.Create @@ -86,7 +86,7 @@ func (client *DataCollectionRuleAssociationsClient) createCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") + reqQP.Set("api-version", "2023-03-11") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { @@ -110,7 +110,7 @@ func (client *DataCollectionRuleAssociationsClient) createHandleResponse(resp *h // Delete - Deletes an association. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-06-01 +// Generated from API version 2023-03-11 // - resourceURI - The identifier of the resource. // - associationName - The name of the association. The name is case insensitive. // - options - DataCollectionRuleAssociationsClientDeleteOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.Delete @@ -149,7 +149,7 @@ func (client *DataCollectionRuleAssociationsClient) deleteCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") + reqQP.Set("api-version", "2023-03-11") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -158,7 +158,7 @@ func (client *DataCollectionRuleAssociationsClient) deleteCreateRequest(ctx cont // Get - Returns the specified association. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-06-01 +// Generated from API version 2023-03-11 // - resourceURI - The identifier of the resource. // - associationName - The name of the association. The name is case insensitive. // - options - DataCollectionRuleAssociationsClientGetOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.Get @@ -198,7 +198,7 @@ func (client *DataCollectionRuleAssociationsClient) getCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") + reqQP.Set("api-version", "2023-03-11") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -215,7 +215,7 @@ func (client *DataCollectionRuleAssociationsClient) getHandleResponse(resp *http // NewListByDataCollectionEndpointPager - Lists associations for the specified data collection endpoint. // -// Generated from API version 2022-06-01 +// Generated from API version 2023-03-11 // - 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. // - options - DataCollectionRuleAssociationsClientListByDataCollectionEndpointOptions contains the optional parameters for @@ -263,7 +263,7 @@ func (client *DataCollectionRuleAssociationsClient) listByDataCollectionEndpoint return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") + reqQP.Set("api-version", "2023-03-11") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -280,7 +280,7 @@ func (client *DataCollectionRuleAssociationsClient) listByDataCollectionEndpoint // NewListByResourcePager - Lists associations for the specified resource. // -// Generated from API version 2022-06-01 +// Generated from API version 2023-03-11 // - resourceURI - The identifier of the resource. // - options - DataCollectionRuleAssociationsClientListByResourceOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.NewListByResourcePager // method. @@ -316,7 +316,7 @@ func (client *DataCollectionRuleAssociationsClient) listByResourceCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") + reqQP.Set("api-version", "2023-03-11") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -333,7 +333,7 @@ func (client *DataCollectionRuleAssociationsClient) listByResourceHandleResponse // NewListByRulePager - Lists associations for the specified data collection rule. // -// Generated from API version 2022-06-01 +// Generated from API version 2023-03-11 // - 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. // - options - DataCollectionRuleAssociationsClientListByRuleOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.NewListByRulePager @@ -381,7 +381,7 @@ func (client *DataCollectionRuleAssociationsClient) listByRuleCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") + reqQP.Set("api-version", "2023-03-11") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client_example_test.go deleted file mode 100644 index 75d9d8aacedc..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client_example_test.go +++ /dev/null @@ -1,291 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRuleAssociationsListByResource.json -func ExampleDataCollectionRuleAssociationsClient_NewListByResourcePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataCollectionRuleAssociationsClient().NewListByResourcePager("subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DataCollectionRuleAssociationProxyOnlyResourceListResult = armmonitor.DataCollectionRuleAssociationProxyOnlyResourceListResult{ - // Value: []*armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ - // { - // Name: to.Ptr("myRuleAssociation"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/myRuleAssociation"), - // Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - // DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleAssociationProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("herRuleAssociation"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), - // Etag: to.Ptr("3afa167b-3255-432b-b66d-e74a348468af"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/herRuleAssociation"), - // Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - // DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/herCollectionRule"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleAssociationProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("myEndpointAssociation"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), - // Etag: to.Ptr("562d96b1-29e9-4250-b2fd-8bebfdf77a9d"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/myEndpointAssociation"), - // Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - // DataCollectionEndpointID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleAssociationProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRuleAssociationsListByRule.json -func ExampleDataCollectionRuleAssociationsClient_NewListByRulePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataCollectionRuleAssociationsClient().NewListByRulePager("myResourceGroup", "myCollectionRule", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DataCollectionRuleAssociationProxyOnlyResourceListResult = armmonitor.DataCollectionRuleAssociationProxyOnlyResourceListResult{ - // Value: []*armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ - // { - // Name: to.Ptr("myAssociation"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/myAssociation"), - // Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - // DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleAssociationProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRuleAssociationsListByDataCollectionEndpoint.json -func ExampleDataCollectionRuleAssociationsClient_NewListByDataCollectionEndpointPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataCollectionRuleAssociationsClient().NewListByDataCollectionEndpointPager("myResourceGroup", "myDataCollectionEndpointName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DataCollectionRuleAssociationProxyOnlyResourceListResult = armmonitor.DataCollectionRuleAssociationProxyOnlyResourceListResult{ - // Value: []*armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ - // { - // Name: to.Ptr("myAssociation"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/myAssociation"), - // Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - // DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleAssociationProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRuleAssociationsGet.json -func ExampleDataCollectionRuleAssociationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionRuleAssociationsClient().Get(ctx, "subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", "myAssociation", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataCollectionRuleAssociationProxyOnlyResource = armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ - // Name: to.Ptr("myAssociation"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/myAssociation"), - // Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - // DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleAssociationProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRuleAssociationsCreate.json -func ExampleDataCollectionRuleAssociationsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionRuleAssociationsClient().Create(ctx, "subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", "myAssociation", &armmonitor.DataCollectionRuleAssociationsClientCreateOptions{Body: &armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ - Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataCollectionRuleAssociationProxyOnlyResource = armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ - // Name: to.Ptr("myAssociation"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/myAssociation"), - // Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - // DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleAssociationProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRuleAssociationsDelete.json -func ExampleDataCollectionRuleAssociationsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDataCollectionRuleAssociationsClient().Delete(ctx, "subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", "myAssociation", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client.go index bac67caf57ba..26ba26591787 100644 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client.go @@ -17,6 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" + "strconv" "strings" ) @@ -28,7 +29,7 @@ type DataCollectionRulesClient struct { } // NewDataCollectionRulesClient creates a new instance of DataCollectionRulesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewDataCollectionRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DataCollectionRulesClient, error) { @@ -46,7 +47,7 @@ func NewDataCollectionRulesClient(subscriptionID string, credential azcore.Token // Create - Creates or updates a data collection rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-06-01 +// Generated from API version 2023-03-11 // - 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. // - options - DataCollectionRulesClientCreateOptions contains the optional parameters for the DataCollectionRulesClient.Create @@ -93,7 +94,7 @@ func (client *DataCollectionRulesClient) createCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") + reqQP.Set("api-version", "2023-03-11") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { @@ -117,7 +118,7 @@ func (client *DataCollectionRulesClient) createHandleResponse(resp *http.Respons // Delete - Deletes a data collection rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-06-01 +// Generated from API version 2023-03-11 // - 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. // - options - DataCollectionRulesClientDeleteOptions contains the optional parameters for the DataCollectionRulesClient.Delete @@ -163,7 +164,10 @@ func (client *DataCollectionRulesClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") + reqQP.Set("api-version", "2023-03-11") + if options != nil && options.DeleteAssociations != nil { + reqQP.Set("deleteAssociations", strconv.FormatBool(*options.DeleteAssociations)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -172,7 +176,7 @@ func (client *DataCollectionRulesClient) deleteCreateRequest(ctx context.Context // Get - Returns the specified data collection rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-06-01 +// Generated from API version 2023-03-11 // - 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. // - options - DataCollectionRulesClientGetOptions contains the optional parameters for the DataCollectionRulesClient.Get method. @@ -218,7 +222,7 @@ func (client *DataCollectionRulesClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") + reqQP.Set("api-version", "2023-03-11") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -235,7 +239,7 @@ func (client *DataCollectionRulesClient) getHandleResponse(resp *http.Response) // NewListByResourceGroupPager - Lists all data collection rules in the specified resource group. // -// Generated from API version 2022-06-01 +// Generated from API version 2023-03-11 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - DataCollectionRulesClientListByResourceGroupOptions contains the optional parameters for the DataCollectionRulesClient.NewListByResourceGroupPager // method. @@ -278,7 +282,7 @@ func (client *DataCollectionRulesClient) listByResourceGroupCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") + reqQP.Set("api-version", "2023-03-11") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -295,7 +299,7 @@ func (client *DataCollectionRulesClient) listByResourceGroupHandleResponse(resp // NewListBySubscriptionPager - Lists all data collection rules in the specified subscription. // -// Generated from API version 2022-06-01 +// Generated from API version 2023-03-11 // - options - DataCollectionRulesClientListBySubscriptionOptions contains the optional parameters for the DataCollectionRulesClient.NewListBySubscriptionPager // method. func (client *DataCollectionRulesClient) NewListBySubscriptionPager(options *DataCollectionRulesClientListBySubscriptionOptions) *runtime.Pager[DataCollectionRulesClientListBySubscriptionResponse] { @@ -333,7 +337,7 @@ func (client *DataCollectionRulesClient) listBySubscriptionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") + reqQP.Set("api-version", "2023-03-11") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -351,7 +355,7 @@ func (client *DataCollectionRulesClient) listBySubscriptionHandleResponse(resp * // Update - Updates part of a data collection rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-06-01 +// Generated from API version 2023-03-11 // - 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. // - options - DataCollectionRulesClientUpdateOptions contains the optional parameters for the DataCollectionRulesClient.Update @@ -398,7 +402,7 @@ func (client *DataCollectionRulesClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") + reqQP.Set("api-version", "2023-03-11") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client_example_test.go deleted file mode 100644 index 34f152aaad68..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client_example_test.go +++ /dev/null @@ -1,864 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRulesListByResourceGroup.json -func ExampleDataCollectionRulesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataCollectionRulesClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DataCollectionRuleResourceListResult = armmonitor.DataCollectionRuleResourceListResult{ - // Value: []*armmonitor.DataCollectionRuleResource{ - // { - // Name: to.Ptr("myCollectionRule"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRules"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionRuleResourceProperties{ - // DataFlows: []*armmonitor.DataFlow{ - // { - // Destinations: []*string{ - // to.Ptr("centralWorkspace")}, - // Streams: []*armmonitor.KnownDataFlowStreams{ - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftSyslog), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - // }}, - // DataSources: &armmonitor.DataCollectionRuleDataSources{ - // PerformanceCounters: []*armmonitor.PerfCounterDataSource{ - // { - // Name: to.Ptr("cloudTeamCoreCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Processor(_Total)\\% Processor Time"), - // to.Ptr("\\Memory\\Committed Bytes"), - // to.Ptr("\\LogicalDisk(_Total)\\Free Megabytes"), - // to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](15), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }, - // { - // Name: to.Ptr("appTeamExtraCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Process(_Total)\\Thread Count")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](30), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }}, - // Syslog: []*armmonitor.SyslogDataSource{ - // { - // Name: to.Ptr("cronSyslog"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesCron)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsDebug), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }, - // { - // Name: to.Ptr("syslogBase"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesSyslog)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsAlert), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }}, - // WindowsEventLogs: []*armmonitor.WindowsEventLogDataSource{ - // { - // Name: to.Ptr("cloudSecurityTeamEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("Security!")}, - // }, - // { - // Name: to.Ptr("appTeam1AppEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("System![System[(Level = 1 or Level = 2 or Level = 3)]]"), - // to.Ptr("Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")}, - // }}, - // }, - // Destinations: &armmonitor.DataCollectionRuleDestinations{ - // LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - // { - // Name: to.Ptr("centralWorkspace"), - // WorkspaceID: to.Ptr("9ba8bc53-bd36-4156-8667-e983e7ae0e4f"), - // WorkspaceResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/centralTeamWorkspace"), - // }}, - // }, - // ImmutableID: to.Ptr("dcr-b74e0d383fc9415abaa584ec41adece3"), - // }, - // SystemData: &armmonitor.DataCollectionRuleResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // }, - // { - // Name: to.Ptr("herCollectionRule"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRules"), - // Etag: to.Ptr("3afa167b-3255-432b-b66d-e74a348468af"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/herCollectionRule"), - // Location: to.Ptr("westus"), - // Properties: &armmonitor.DataCollectionRuleResourceProperties{ - // DataFlows: []*armmonitor.DataFlow{ - // { - // Destinations: []*string{ - // to.Ptr("herWorkspace")}, - // Streams: []*armmonitor.KnownDataFlowStreams{ - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - // }}, - // DataSources: &armmonitor.DataCollectionRuleDataSources{ - // PerformanceCounters: []*armmonitor.PerfCounterDataSource{ - // { - // Name: to.Ptr("herPerfCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Processor(_Total)\\% Processor Time"), - // to.Ptr("\\LogicalDisk(_Total)\\Free Megabytes"), - // to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](30), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }}, - // WindowsEventLogs: []*armmonitor.WindowsEventLogDataSource{ - // { - // Name: to.Ptr("herWindowsEventLogs"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("Security!*"), - // to.Ptr("System!*[System[(Level = 1 or Level = 2 or Level = 3)]]"), - // to.Ptr("Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")}, - // }}, - // }, - // Destinations: &armmonitor.DataCollectionRuleDestinations{ - // LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - // { - // Name: to.Ptr("herWorkspace"), - // WorkspaceID: to.Ptr("c49b982a-c4f7-40c4-bd13-d6588f1b4015"), - // WorkspaceResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/herResourceGroup/providers/Microsoft.OperationalInsights/workspaces/herTeamWorkspace"), - // }}, - // }, - // ImmutableID: to.Ptr("dcr-ca1e6d9dad844b2c94e7961c42af917a"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("C"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRulesListBySubscription.json -func ExampleDataCollectionRulesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataCollectionRulesClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DataCollectionRuleResourceListResult = armmonitor.DataCollectionRuleResourceListResult{ - // Value: []*armmonitor.DataCollectionRuleResource{ - // { - // Name: to.Ptr("myCollectionRule"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRules"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionRuleResourceProperties{ - // DataFlows: []*armmonitor.DataFlow{ - // { - // Destinations: []*string{ - // to.Ptr("centralWorkspace")}, - // Streams: []*armmonitor.KnownDataFlowStreams{ - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftSyslog), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - // }}, - // DataSources: &armmonitor.DataCollectionRuleDataSources{ - // PerformanceCounters: []*armmonitor.PerfCounterDataSource{ - // { - // Name: to.Ptr("cloudTeamCoreCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Processor(_Total)\\% Processor Time"), - // to.Ptr("\\Memory\\Committed Bytes"), - // to.Ptr("\\LogicalDisk(_Total)\\Free Megabytes"), - // to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](15), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }, - // { - // Name: to.Ptr("appTeamExtraCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Process(_Total)\\Thread Count")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](30), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }}, - // Syslog: []*armmonitor.SyslogDataSource{ - // { - // Name: to.Ptr("cronSyslog"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesCron)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsDebug), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }, - // { - // Name: to.Ptr("syslogBase"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesSyslog)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsAlert), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }}, - // WindowsEventLogs: []*armmonitor.WindowsEventLogDataSource{ - // { - // Name: to.Ptr("cloudSecurityTeamEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("Security!")}, - // }, - // { - // Name: to.Ptr("appTeam1AppEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("System![System[(Level = 1 or Level = 2 or Level = 3)]]"), - // to.Ptr("Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")}, - // }}, - // }, - // Destinations: &armmonitor.DataCollectionRuleDestinations{ - // LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - // { - // Name: to.Ptr("centralWorkspace"), - // WorkspaceID: to.Ptr("9ba8bc53-bd36-4156-8667-e983e7ae0e4f"), - // WorkspaceResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/centralTeamWorkspace"), - // }}, - // }, - // ImmutableID: to.Ptr("dcr-b74e0d383fc9415abaa584ec41adece3"), - // }, - // SystemData: &armmonitor.DataCollectionRuleResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // }, - // { - // Name: to.Ptr("herCollectionRule"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRules"), - // Etag: to.Ptr("3afa167b-3255-432b-b66d-e74a348468af"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/herResourceGroup/providers/Microsoft.Insights/dataCollectionRules/herCollectionRule"), - // Location: to.Ptr("westus"), - // Properties: &armmonitor.DataCollectionRuleResourceProperties{ - // DataFlows: []*armmonitor.DataFlow{ - // { - // Destinations: []*string{ - // to.Ptr("herWorkspace")}, - // Streams: []*armmonitor.KnownDataFlowStreams{ - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - // }}, - // DataSources: &armmonitor.DataCollectionRuleDataSources{ - // PerformanceCounters: []*armmonitor.PerfCounterDataSource{ - // { - // Name: to.Ptr("herPerfCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Processor(_Total)\\% Processor Time"), - // to.Ptr("\\LogicalDisk(_Total)\\Free Megabytes"), - // to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](30), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }}, - // WindowsEventLogs: []*armmonitor.WindowsEventLogDataSource{ - // { - // Name: to.Ptr("herWindowsEventLogs"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("Security!*"), - // to.Ptr("System!*[System[(Level = 1 or Level = 2 or Level = 3)]]"), - // to.Ptr("Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")}, - // }}, - // }, - // Destinations: &armmonitor.DataCollectionRuleDestinations{ - // LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - // { - // Name: to.Ptr("herWorkspace"), - // WorkspaceID: to.Ptr("c49b982a-c4f7-40c4-bd13-d6588f1b4015"), - // WorkspaceResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/herResourceGroup/providers/Microsoft.OperationalInsights/workspaces/herTeamWorkspace"), - // }}, - // }, - // ImmutableID: to.Ptr("dcr-ca1e6d9dad844b2c94e7961c42af917a"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("C"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRulesGet.json -func ExampleDataCollectionRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionRulesClient().Get(ctx, "myResourceGroup", "myCollectionRule", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataCollectionRuleResource = armmonitor.DataCollectionRuleResource{ - // Name: to.Ptr("myCollectionRule"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRules"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionRuleResourceProperties{ - // DataFlows: []*armmonitor.DataFlow{ - // { - // Destinations: []*string{ - // to.Ptr("centralWorkspace")}, - // Streams: []*armmonitor.KnownDataFlowStreams{ - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftSyslog), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - // }}, - // DataSources: &armmonitor.DataCollectionRuleDataSources{ - // PerformanceCounters: []*armmonitor.PerfCounterDataSource{ - // { - // Name: to.Ptr("cloudTeamCoreCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Processor(_Total)\\% Processor Time"), - // to.Ptr("\\Memory\\Committed Bytes"), - // to.Ptr("\\LogicalDisk(_Total)\\Free Megabytes"), - // to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](15), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }, - // { - // Name: to.Ptr("appTeamExtraCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Process(_Total)\\Thread Count")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](30), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }}, - // Syslog: []*armmonitor.SyslogDataSource{ - // { - // Name: to.Ptr("cronSyslog"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesCron)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsDebug), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }, - // { - // Name: to.Ptr("syslogBase"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesSyslog)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsAlert), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }}, - // WindowsEventLogs: []*armmonitor.WindowsEventLogDataSource{ - // { - // Name: to.Ptr("cloudSecurityTeamEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("Security!")}, - // }, - // { - // Name: to.Ptr("appTeam1AppEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("System![System[(Level = 1 or Level = 2 or Level = 3)]]"), - // to.Ptr("Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")}, - // }}, - // }, - // Destinations: &armmonitor.DataCollectionRuleDestinations{ - // LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - // { - // Name: to.Ptr("centralWorkspace"), - // WorkspaceID: to.Ptr("9ba8bc53-bd36-4156-8667-e983e7ae0e4f"), - // WorkspaceResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/centralTeamWorkspace"), - // }}, - // }, - // ImmutableID: to.Ptr("dcr-b74e0d383fc9415abaa584ec41adece3"), - // }, - // SystemData: &armmonitor.DataCollectionRuleResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRulesCreate.json -func ExampleDataCollectionRulesClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionRulesClient().Create(ctx, "myResourceGroup", "myCollectionRule", &armmonitor.DataCollectionRulesClientCreateOptions{Body: &armmonitor.DataCollectionRuleResource{ - Location: to.Ptr("eastus"), - Properties: &armmonitor.DataCollectionRuleResourceProperties{ - DataFlows: []*armmonitor.DataFlow{ - { - Destinations: []*string{ - to.Ptr("centralWorkspace")}, - Streams: []*armmonitor.KnownDataFlowStreams{ - to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftSyslog), - to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - }}, - DataSources: &armmonitor.DataCollectionRuleDataSources{ - PerformanceCounters: []*armmonitor.PerfCounterDataSource{ - { - Name: to.Ptr("cloudTeamCoreCounters"), - CounterSpecifiers: []*string{ - to.Ptr("\\Processor(_Total)\\% Processor Time"), - to.Ptr("\\Memory\\Committed Bytes"), - to.Ptr("\\LogicalDisk(_Total)\\Free Megabytes"), - to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")}, - SamplingFrequencyInSeconds: to.Ptr[int32](15), - Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - }, - { - Name: to.Ptr("appTeamExtraCounters"), - CounterSpecifiers: []*string{ - to.Ptr("\\Process(_Total)\\Thread Count")}, - SamplingFrequencyInSeconds: to.Ptr[int32](30), - Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - }}, - Syslog: []*armmonitor.SyslogDataSource{ - { - Name: to.Ptr("cronSyslog"), - FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesCron)}, - LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsDebug), - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - }, - { - Name: to.Ptr("syslogBase"), - FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesSyslog)}, - LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsAlert), - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - }}, - WindowsEventLogs: []*armmonitor.WindowsEventLogDataSource{ - { - Name: to.Ptr("cloudSecurityTeamEvents"), - Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - XPathQueries: []*string{ - to.Ptr("Security!")}, - }, - { - Name: to.Ptr("appTeam1AppEvents"), - Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - XPathQueries: []*string{ - to.Ptr("System![System[(Level = 1 or Level = 2 or Level = 3)]]"), - to.Ptr("Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")}, - }}, - }, - Destinations: &armmonitor.DataCollectionRuleDestinations{ - LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - { - Name: to.Ptr("centralWorkspace"), - WorkspaceResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/centralTeamWorkspace"), - }}, - }, - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataCollectionRuleResource = armmonitor.DataCollectionRuleResource{ - // Name: to.Ptr("myCollectionRule"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRules"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionRuleResourceProperties{ - // DataFlows: []*armmonitor.DataFlow{ - // { - // Destinations: []*string{ - // to.Ptr("centralWorkspace")}, - // Streams: []*armmonitor.KnownDataFlowStreams{ - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftSyslog), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - // }}, - // DataSources: &armmonitor.DataCollectionRuleDataSources{ - // PerformanceCounters: []*armmonitor.PerfCounterDataSource{ - // { - // Name: to.Ptr("cloudTeamCoreCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Processor(_Total)\\% Processor Time"), - // to.Ptr("\\Memory\\Committed Bytes"), - // to.Ptr("\\LogicalDisk(_Total)\\Free Megabytes"), - // to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](15), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }, - // { - // Name: to.Ptr("appTeamExtraCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Process(_Total)\\Thread Count")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](30), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }}, - // Syslog: []*armmonitor.SyslogDataSource{ - // { - // Name: to.Ptr("cronSyslog"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesCron)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsDebug), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }, - // { - // Name: to.Ptr("syslogBase"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesSyslog)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsAlert), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }}, - // WindowsEventLogs: []*armmonitor.WindowsEventLogDataSource{ - // { - // Name: to.Ptr("cloudSecurityTeamEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("Security!")}, - // }, - // { - // Name: to.Ptr("appTeam1AppEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("System![System[(Level = 1 or Level = 2 or Level = 3)]]"), - // to.Ptr("Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")}, - // }}, - // }, - // Destinations: &armmonitor.DataCollectionRuleDestinations{ - // LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - // { - // Name: to.Ptr("centralWorkspace"), - // WorkspaceID: to.Ptr("9ba8bc53-bd36-4156-8667-e983e7ae0e4f"), - // WorkspaceResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/centralTeamWorkspace"), - // }}, - // }, - // ImmutableID: to.Ptr("dcr-b74e0d383fc9415abaa584ec41adece3"), - // }, - // SystemData: &armmonitor.DataCollectionRuleResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRulesUpdate.json -func ExampleDataCollectionRulesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionRulesClient().Update(ctx, "myResourceGroup", "myCollectionRule", &armmonitor.DataCollectionRulesClientUpdateOptions{Body: &armmonitor.ResourceForUpdate{ - Tags: map[string]*string{ - "tag1": to.Ptr("A"), - "tag2": to.Ptr("B"), - "tag3": to.Ptr("C"), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataCollectionRuleResource = armmonitor.DataCollectionRuleResource{ - // Name: to.Ptr("myCollectionRule"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRules"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionRuleResourceProperties{ - // DataFlows: []*armmonitor.DataFlow{ - // { - // Destinations: []*string{ - // to.Ptr("centralWorkspace")}, - // Streams: []*armmonitor.KnownDataFlowStreams{ - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftSyslog), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - // }}, - // DataSources: &armmonitor.DataCollectionRuleDataSources{ - // PerformanceCounters: []*armmonitor.PerfCounterDataSource{ - // { - // Name: to.Ptr("cloudTeamCoreCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Processor(_Total)\\% Processor Time"), - // to.Ptr("\\Memory\\Committed Bytes"), - // to.Ptr("\\LogicalDisk(_Total)\\Free Megabytes"), - // to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](15), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }, - // { - // Name: to.Ptr("appTeamExtraCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Process(_Total)\\Thread Count")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](30), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }}, - // Syslog: []*armmonitor.SyslogDataSource{ - // { - // Name: to.Ptr("cronSyslog"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesCron)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsDebug), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }, - // { - // Name: to.Ptr("syslogBase"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesSyslog)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsAlert), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }}, - // WindowsEventLogs: []*armmonitor.WindowsEventLogDataSource{ - // { - // Name: to.Ptr("cloudSecurityTeamEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("Security!")}, - // }, - // { - // Name: to.Ptr("appTeam1AppEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("System![System[(Level = 1 or Level = 2 or Level = 3)]]"), - // to.Ptr("Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")}, - // }}, - // }, - // Destinations: &armmonitor.DataCollectionRuleDestinations{ - // LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - // { - // Name: to.Ptr("centralWorkspace"), - // WorkspaceID: to.Ptr("9ba8bc53-bd36-4156-8667-e983e7ae0e4f"), - // WorkspaceResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/centralTeamWorkspace"), - // }}, - // }, - // ImmutableID: to.Ptr("dcr-b74e0d383fc9415abaa584ec41adece3"), - // }, - // SystemData: &armmonitor.DataCollectionRuleResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // "tag3": to.Ptr("C"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRulesDelete.json -func ExampleDataCollectionRulesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDataCollectionRulesClient().Delete(ctx, "myResourceGroup", "myCollectionRule", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client_example_test.go deleted file mode 100644 index 6bfb57627706..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client_example_test.go +++ /dev/null @@ -1,404 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/getDiagnosticSetting.json -func ExampleDiagnosticSettingsClient_Get_getsTheDiagnosticSetting() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiagnosticSettingsClient().Get(ctx, "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", "mysetting", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiagnosticSettingsResource = armmonitor.DiagnosticSettingsResource{ - // Name: to.Ptr("mysetting"), - // Type: to.Ptr("Microsoft.Insights/diagnosticSettings"), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/microsoft.insights/diagnosticSettings/mysetting"), - // Properties: &armmonitor.DiagnosticSettings{ - // EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule"), - // Logs: []*armmonitor.LogSettings{ - // { - // CategoryGroup: to.Ptr("allLogs"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - // Metrics: []*armmonitor.MetricSettings{ - // { - // Category: to.Ptr("WorkflowMetrics"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - // WorkspaceID: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/getDiagnosticSettingCategory.json -func ExampleDiagnosticSettingsClient_Get_getsTheDiagnosticSettingForCategory() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiagnosticSettingsClient().Get(ctx, "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", "mysetting", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiagnosticSettingsResource = armmonitor.DiagnosticSettingsResource{ - // Name: to.Ptr("mysetting"), - // Type: to.Ptr(""), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/diagnosticSettings/service"), - // Properties: &armmonitor.DiagnosticSettings{ - // EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule"), - // Logs: []*armmonitor.LogSettings{ - // { - // Category: to.Ptr("WorkflowRuntime"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - // Metrics: []*armmonitor.MetricSettings{ - // { - // Category: to.Ptr("WorkflowMetrics"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - // WorkspaceID: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/createOrUpdateDiagnosticSetting.json -func ExampleDiagnosticSettingsClient_CreateOrUpdate_createsOrUpdatesTheDiagnosticSetting() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiagnosticSettingsClient().CreateOrUpdate(ctx, "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", "mysetting", armmonitor.DiagnosticSettingsResource{ - Properties: &armmonitor.DiagnosticSettings{ - EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule"), - EventHubName: to.Ptr("myeventhub"), - LogAnalyticsDestinationType: to.Ptr("Dedicated"), - Logs: []*armmonitor.LogSettings{ - { - CategoryGroup: to.Ptr("allLogs"), - Enabled: to.Ptr(true), - RetentionPolicy: &armmonitor.RetentionPolicy{ - Days: to.Ptr[int32](0), - Enabled: to.Ptr(false), - }, - }}, - MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - Metrics: []*armmonitor.MetricSettings{ - { - Category: to.Ptr("WorkflowMetrics"), - Enabled: to.Ptr(true), - RetentionPolicy: &armmonitor.RetentionPolicy{ - Days: to.Ptr[int32](0), - Enabled: to.Ptr(false), - }, - }}, - StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - WorkspaceID: to.Ptr(""), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiagnosticSettingsResource = armmonitor.DiagnosticSettingsResource{ - // Name: to.Ptr("mysetting"), - // Type: to.Ptr("Microsoft.Insights/diagnosticSettings"), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/microsoft.insights/diagnosticSettings/mysetting"), - // Properties: &armmonitor.DiagnosticSettings{ - // EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule"), - // EventHubName: to.Ptr("myeventhub"), - // LogAnalyticsDestinationType: to.Ptr("Dedicated"), - // Logs: []*armmonitor.LogSettings{ - // { - // CategoryGroup: to.Ptr("allLogs"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - // Metrics: []*armmonitor.MetricSettings{ - // { - // Category: to.Ptr("WorkflowMetrics"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - // WorkspaceID: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/createOrUpdateDiagnosticSettingCategory.json -func ExampleDiagnosticSettingsClient_CreateOrUpdate_createsOrUpdatesTheDiagnosticSettingForCategory() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiagnosticSettingsClient().CreateOrUpdate(ctx, "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", "mysetting", armmonitor.DiagnosticSettingsResource{ - Properties: &armmonitor.DiagnosticSettings{ - EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule"), - EventHubName: to.Ptr("myeventhub"), - LogAnalyticsDestinationType: to.Ptr("Dedicated"), - Logs: []*armmonitor.LogSettings{ - { - Category: to.Ptr("WorkflowRuntime"), - Enabled: to.Ptr(true), - RetentionPolicy: &armmonitor.RetentionPolicy{ - Days: to.Ptr[int32](0), - Enabled: to.Ptr(false), - }, - }}, - MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - Metrics: []*armmonitor.MetricSettings{ - { - Category: to.Ptr("WorkflowMetrics"), - Enabled: to.Ptr(true), - RetentionPolicy: &armmonitor.RetentionPolicy{ - Days: to.Ptr[int32](0), - Enabled: to.Ptr(false), - }, - }}, - StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - WorkspaceID: to.Ptr(""), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiagnosticSettingsResource = armmonitor.DiagnosticSettingsResource{ - // Name: to.Ptr("mysetting"), - // Type: to.Ptr(""), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/diagnosticSettings/mysetting"), - // Properties: &armmonitor.DiagnosticSettings{ - // EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule"), - // EventHubName: to.Ptr("myeventhub"), - // LogAnalyticsDestinationType: to.Ptr("Dedicated"), - // Logs: []*armmonitor.LogSettings{ - // { - // Category: to.Ptr("WorkflowRuntime"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - // Metrics: []*armmonitor.MetricSettings{ - // { - // Category: to.Ptr("WorkflowMetrics"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - // WorkspaceID: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/deleteDiagnosticSetting.json -func ExampleDiagnosticSettingsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDiagnosticSettingsClient().Delete(ctx, "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", "mysetting", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/listDiagnosticSettings.json -func ExampleDiagnosticSettingsClient_NewListPager_getsTheDiagnosticSetting() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiagnosticSettingsClient().NewListPager("subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiagnosticSettingsResourceCollection = armmonitor.DiagnosticSettingsResourceCollection{ - // Value: []*armmonitor.DiagnosticSettingsResource{ - // { - // Name: to.Ptr("mysetting"), - // Type: to.Ptr("Microsoft.Insights/diagnosticSettings"), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/microsoft.insights/diagnosticSettings/mysetting"), - // Properties: &armmonitor.DiagnosticSettings{ - // EventHubAuthorizationRuleID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/andy1101/providers/Microsoft.EventHub/namespaces/andy1101/authorizationrules/RootManageSharedAccessKey"), - // Logs: []*armmonitor.LogSettings{ - // { - // CategoryGroup: to.Ptr("allLogs"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - // Metrics: []*armmonitor.MetricSettings{ - // { - // Category: to.Ptr("WorkflowMetrics"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - // WorkspaceID: to.Ptr(""), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/listDiagnosticSettingsCategory.json -func ExampleDiagnosticSettingsClient_NewListPager_getsTheDiagnosticSettingForCategory() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiagnosticSettingsClient().NewListPager("subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiagnosticSettingsResourceCollection = armmonitor.DiagnosticSettingsResourceCollection{ - // Value: []*armmonitor.DiagnosticSettingsResource{ - // { - // Name: to.Ptr("mysetting"), - // Type: to.Ptr("microsoft.logic/workflows"), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/diagnosticSettings/mysetting"), - // Properties: &armmonitor.DiagnosticSettings{ - // EventHubAuthorizationRuleID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/andy1101/providers/Microsoft.EventHub/namespaces/andy1101/authorizationrules/RootManageSharedAccessKey"), - // Logs: []*armmonitor.LogSettings{ - // { - // Category: to.Ptr("WorkflowRuntime"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - // Metrics: []*armmonitor.MetricSettings{ - // { - // Category: to.Ptr("WorkflowMetrics"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - // WorkspaceID: to.Ptr(""), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client_example_test.go deleted file mode 100644 index 4b667e1fa043..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client_example_test.go +++ /dev/null @@ -1,94 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/getDiagnosticSettingsCategory.json -func ExampleDiagnosticSettingsCategoryClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiagnosticSettingsCategoryClient().Get(ctx, "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", "WorkflowRuntime", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiagnosticSettingsCategoryResource = armmonitor.DiagnosticSettingsCategoryResource{ - // Name: to.Ptr("WorkflowRuntime"), - // Type: to.Ptr("microsoft.insights/diagnosticSettingsCategories"), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/microsoft.insights/diagnosticSettingsCategories/WorkflowRuntime"), - // Properties: &armmonitor.DiagnosticSettingsCategory{ - // CategoryGroups: []*string{ - // to.Ptr("allLogs")}, - // CategoryType: to.Ptr(armmonitor.CategoryTypeLogs), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/listDiagnosticSettingsCategories.json -func ExampleDiagnosticSettingsCategoryClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiagnosticSettingsCategoryClient().NewListPager("subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiagnosticSettingsCategoryResourceCollection = armmonitor.DiagnosticSettingsCategoryResourceCollection{ - // Value: []*armmonitor.DiagnosticSettingsCategoryResource{ - // { - // Name: to.Ptr("WorkflowRuntime"), - // Type: to.Ptr("microsoft.insights/diagnosticSettingsCategories"), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/microsoft.insights/diagnosticSettingsCategories/WorkflowRuntime"), - // Properties: &armmonitor.DiagnosticSettingsCategory{ - // CategoryGroups: []*string{ - // to.Ptr("allLogs")}, - // CategoryType: to.Ptr(armmonitor.CategoryTypeLogs), - // }, - // }, - // { - // Name: to.Ptr("WorkflowMetric"), - // Type: to.Ptr("microsoft.insights/diagnosticSettingsCategories"), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/microsoft.insights/diagnosticSettingsCategories/WorkflowMetric"), - // Properties: &armmonitor.DiagnosticSettingsCategory{ - // CategoryType: to.Ptr(armmonitor.CategoryTypeMetrics), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/eventcategories_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/eventcategories_client_example_test.go deleted file mode 100644 index 765f747c362c..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/eventcategories_client_example_test.go +++ /dev/null @@ -1,54 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetEventCategories.json -func ExampleEventCategoriesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewEventCategoriesClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EventCategoryCollection = armmonitor.EventCategoryCollection{ - // Value: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("category1"), - // Value: to.Ptr("category1"), - // }, - // { - // LocalizedValue: to.Ptr("category2"), - // Value: to.Ptr("category2"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/actiongroups_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/actiongroups_server.go index b9ce2adcbcc5..851a1baa85a1 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/actiongroups_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/actiongroups_server.go @@ -15,6 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" "net/http" "net/url" @@ -43,6 +44,10 @@ type ActionGroupsServer struct { // HTTP status codes to indicate success: http.StatusOK Get func(ctx context.Context, resourceGroupName string, actionGroupName string, options *armmonitor.ActionGroupsClientGetOptions) (resp azfake.Responder[armmonitor.ActionGroupsClientGetResponse], errResp azfake.ErrorResponder) + // GetNSP is the fake for method ActionGroupsClient.GetNSP + // HTTP status codes to indicate success: http.StatusOK + GetNSP func(ctx context.Context, resourceGroupName string, actionGroupName string, networkSecurityPerimeterConfigurationName string, options *armmonitor.ActionGroupsClientGetNSPOptions) (resp azfake.Responder[armmonitor.ActionGroupsClientGetNSPResponse], errResp azfake.ErrorResponder) + // GetTestNotificationsAtActionGroupResourceLevel is the fake for method ActionGroupsClient.GetTestNotificationsAtActionGroupResourceLevel // HTTP status codes to indicate success: http.StatusOK GetTestNotificationsAtActionGroupResourceLevel func(ctx context.Context, resourceGroupName string, actionGroupName string, notificationID string, options *armmonitor.ActionGroupsClientGetTestNotificationsAtActionGroupResourceLevelOptions) (resp azfake.Responder[armmonitor.ActionGroupsClientGetTestNotificationsAtActionGroupResourceLevelResponse], errResp azfake.ErrorResponder) @@ -55,6 +60,14 @@ type ActionGroupsServer struct { // HTTP status codes to indicate success: http.StatusOK NewListBySubscriptionIDPager func(options *armmonitor.ActionGroupsClientListBySubscriptionIDOptions) (resp azfake.PagerResponder[armmonitor.ActionGroupsClientListBySubscriptionIDResponse]) + // NewListNSPPager is the fake for method ActionGroupsClient.NewListNSPPager + // HTTP status codes to indicate success: http.StatusOK + NewListNSPPager func(resourceGroupName string, actionGroupName string, options *armmonitor.ActionGroupsClientListNSPOptions) (resp azfake.PagerResponder[armmonitor.ActionGroupsClientListNSPResponse]) + + // BeginReconcileNSP is the fake for method ActionGroupsClient.BeginReconcileNSP + // HTTP status codes to indicate success: http.StatusAccepted + BeginReconcileNSP func(ctx context.Context, resourceGroupName string, actionGroupName string, networkSecurityPerimeterConfigurationName string, options *armmonitor.ActionGroupsClientBeginReconcileNSPOptions) (resp azfake.PollerResponder[armmonitor.ActionGroupsClientReconcileNSPResponse], errResp azfake.ErrorResponder) + // Update is the fake for method ActionGroupsClient.Update // HTTP status codes to indicate success: http.StatusOK Update func(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch armmonitor.ActionGroupPatchBody, options *armmonitor.ActionGroupsClientUpdateOptions) (resp azfake.Responder[armmonitor.ActionGroupsClientUpdateResponse], errResp azfake.ErrorResponder) @@ -69,6 +82,8 @@ func NewActionGroupsServerTransport(srv *ActionGroupsServer) *ActionGroupsServer beginCreateNotificationsAtActionGroupResourceLevel: newTracker[azfake.PollerResponder[armmonitor.ActionGroupsClientCreateNotificationsAtActionGroupResourceLevelResponse]](), newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmonitor.ActionGroupsClientListByResourceGroupResponse]](), newListBySubscriptionIDPager: newTracker[azfake.PagerResponder[armmonitor.ActionGroupsClientListBySubscriptionIDResponse]](), + newListNSPPager: newTracker[azfake.PagerResponder[armmonitor.ActionGroupsClientListNSPResponse]](), + beginReconcileNSP: newTracker[azfake.PollerResponder[armmonitor.ActionGroupsClientReconcileNSPResponse]](), } } @@ -79,6 +94,8 @@ type ActionGroupsServerTransport struct { beginCreateNotificationsAtActionGroupResourceLevel *tracker[azfake.PollerResponder[armmonitor.ActionGroupsClientCreateNotificationsAtActionGroupResourceLevelResponse]] newListByResourceGroupPager *tracker[azfake.PagerResponder[armmonitor.ActionGroupsClientListByResourceGroupResponse]] newListBySubscriptionIDPager *tracker[azfake.PagerResponder[armmonitor.ActionGroupsClientListBySubscriptionIDResponse]] + newListNSPPager *tracker[azfake.PagerResponder[armmonitor.ActionGroupsClientListNSPResponse]] + beginReconcileNSP *tracker[azfake.PollerResponder[armmonitor.ActionGroupsClientReconcileNSPResponse]] } // Do implements the policy.Transporter interface for ActionGroupsServerTransport. @@ -103,12 +120,18 @@ func (a *ActionGroupsServerTransport) Do(req *http.Request) (*http.Response, err resp, err = a.dispatchEnableReceiver(req) case "ActionGroupsClient.Get": resp, err = a.dispatchGet(req) + case "ActionGroupsClient.GetNSP": + resp, err = a.dispatchGetNSP(req) case "ActionGroupsClient.GetTestNotificationsAtActionGroupResourceLevel": resp, err = a.dispatchGetTestNotificationsAtActionGroupResourceLevel(req) case "ActionGroupsClient.NewListByResourceGroupPager": resp, err = a.dispatchNewListByResourceGroupPager(req) case "ActionGroupsClient.NewListBySubscriptionIDPager": resp, err = a.dispatchNewListBySubscriptionIDPager(req) + case "ActionGroupsClient.NewListNSPPager": + resp, err = a.dispatchNewListNSPPager(req) + case "ActionGroupsClient.BeginReconcileNSP": + resp, err = a.dispatchBeginReconcileNSP(req) case "ActionGroupsClient.Update": resp, err = a.dispatchUpdate(req) default: @@ -310,6 +333,43 @@ func (a *ActionGroupsServerTransport) dispatchGet(req *http.Request) (*http.Resp return resp, nil } +func (a *ActionGroupsServerTransport) dispatchGetNSP(req *http.Request) (*http.Response, error) { + if a.srv.GetNSP == nil { + return nil, &nonRetriableError{errors.New("fake for method GetNSP not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/actionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/networkSecurityPerimeterConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + actionGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("actionGroupName")]) + if err != nil { + return nil, err + } + networkSecurityPerimeterConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkSecurityPerimeterConfigurationName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.GetNSP(req.Context(), resourceGroupNameParam, actionGroupNameParam, networkSecurityPerimeterConfigurationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).NetworkSecurityPerimeterConfiguration, req) + if err != nil { + return nil, err + } + return resp, nil +} + func (a *ActionGroupsServerTransport) dispatchGetTestNotificationsAtActionGroupResourceLevel(req *http.Request) (*http.Response, error) { if a.srv.GetTestNotificationsAtActionGroupResourceLevel == nil { return nil, &nonRetriableError{errors.New("fake for method GetTestNotificationsAtActionGroupResourceLevel not implemented")} @@ -411,6 +471,95 @@ func (a *ActionGroupsServerTransport) dispatchNewListBySubscriptionIDPager(req * return resp, nil } +func (a *ActionGroupsServerTransport) dispatchNewListNSPPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListNSPPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListNSPPager not implemented")} + } + newListNSPPager := a.newListNSPPager.get(req) + if newListNSPPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/actionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/networkSecurityPerimeterConfigurations` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + actionGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("actionGroupName")]) + if err != nil { + return nil, err + } + resp := a.srv.NewListNSPPager(resourceGroupNameParam, actionGroupNameParam, nil) + newListNSPPager = &resp + a.newListNSPPager.add(req, newListNSPPager) + server.PagerResponderInjectNextLinks(newListNSPPager, req, func(page *armmonitor.ActionGroupsClientListNSPResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListNSPPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListNSPPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListNSPPager) { + a.newListNSPPager.remove(req) + } + return resp, nil +} + +func (a *ActionGroupsServerTransport) dispatchBeginReconcileNSP(req *http.Request) (*http.Response, error) { + if a.srv.BeginReconcileNSP == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginReconcileNSP not implemented")} + } + beginReconcileNSP := a.beginReconcileNSP.get(req) + if beginReconcileNSP == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/actionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/networkSecurityPerimeterConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/reconcile` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + actionGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("actionGroupName")]) + if err != nil { + return nil, err + } + networkSecurityPerimeterConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkSecurityPerimeterConfigurationName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginReconcileNSP(req.Context(), resourceGroupNameParam, actionGroupNameParam, networkSecurityPerimeterConfigurationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginReconcileNSP = &respr + a.beginReconcileNSP.add(req, beginReconcileNSP) + } + + resp, err := server.PollerResponderNext(beginReconcileNSP, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + a.beginReconcileNSP.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginReconcileNSP) { + a.beginReconcileNSP.remove(req) + } + + return resp, nil +} + func (a *ActionGroupsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { if a.srv.Update == nil { return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/azuremonitorworkspaces_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/azuremonitorworkspaces_server.go index 5cd33be01e72..9a6d47fe4a3a 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/azuremonitorworkspaces_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/azuremonitorworkspaces_server.go @@ -29,9 +29,9 @@ type AzureMonitorWorkspacesServer struct { // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated Create func(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, azureMonitorWorkspaceProperties armmonitor.AzureMonitorWorkspaceResource, options *armmonitor.AzureMonitorWorkspacesClientCreateOptions) (resp azfake.Responder[armmonitor.AzureMonitorWorkspacesClientCreateResponse], errResp azfake.ErrorResponder) - // Delete is the fake for method AzureMonitorWorkspacesClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *armmonitor.AzureMonitorWorkspacesClientDeleteOptions) (resp azfake.Responder[armmonitor.AzureMonitorWorkspacesClientDeleteResponse], errResp azfake.ErrorResponder) + // BeginDelete is the fake for method AzureMonitorWorkspacesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *armmonitor.AzureMonitorWorkspacesClientBeginDeleteOptions) (resp azfake.PollerResponder[armmonitor.AzureMonitorWorkspacesClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method AzureMonitorWorkspacesClient.Get // HTTP status codes to indicate success: http.StatusOK @@ -56,6 +56,7 @@ type AzureMonitorWorkspacesServer struct { func NewAzureMonitorWorkspacesServerTransport(srv *AzureMonitorWorkspacesServer) *AzureMonitorWorkspacesServerTransport { return &AzureMonitorWorkspacesServerTransport{ srv: srv, + beginDelete: newTracker[azfake.PollerResponder[armmonitor.AzureMonitorWorkspacesClientDeleteResponse]](), newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmonitor.AzureMonitorWorkspacesClientListByResourceGroupResponse]](), newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmonitor.AzureMonitorWorkspacesClientListBySubscriptionResponse]](), } @@ -65,6 +66,7 @@ func NewAzureMonitorWorkspacesServerTransport(srv *AzureMonitorWorkspacesServer) // Don't use this type directly, use NewAzureMonitorWorkspacesServerTransport instead. type AzureMonitorWorkspacesServerTransport struct { srv *AzureMonitorWorkspacesServer + beginDelete *tracker[azfake.PollerResponder[armmonitor.AzureMonitorWorkspacesClientDeleteResponse]] newListByResourceGroupPager *tracker[azfake.PagerResponder[armmonitor.AzureMonitorWorkspacesClientListByResourceGroupResponse]] newListBySubscriptionPager *tracker[azfake.PagerResponder[armmonitor.AzureMonitorWorkspacesClientListBySubscriptionResponse]] } @@ -83,8 +85,8 @@ func (a *AzureMonitorWorkspacesServerTransport) Do(req *http.Request) (*http.Res switch method { case "AzureMonitorWorkspacesClient.Create": resp, err = a.dispatchCreate(req) - case "AzureMonitorWorkspacesClient.Delete": - resp, err = a.dispatchDelete(req) + case "AzureMonitorWorkspacesClient.BeginDelete": + resp, err = a.dispatchBeginDelete(req) case "AzureMonitorWorkspacesClient.Get": resp, err = a.dispatchGet(req) case "AzureMonitorWorkspacesClient.NewListByResourceGroupPager": @@ -141,36 +143,47 @@ func (a *AzureMonitorWorkspacesServerTransport) dispatchCreate(req *http.Request return resp, nil } -func (a *AzureMonitorWorkspacesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if a.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} +func (a *AzureMonitorWorkspacesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if a.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Monitor/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err + beginDelete := a.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Monitor/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + azureMonitorWorkspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("azureMonitorWorkspaceName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginDelete(req.Context(), resourceGroupNameParam, azureMonitorWorkspaceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + a.beginDelete.add(req, beginDelete) } - azureMonitorWorkspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("azureMonitorWorkspaceName")]) + + resp, err := server.PollerResponderNext(beginDelete, req) if err != nil { return nil, err } - respr, errRespr := a.srv.Delete(req.Context(), resourceGroupNameParam, azureMonitorWorkspaceNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + a.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err + if !server.PollerResponderMore(beginDelete) { + a.beginDelete.remove(req) } + return resp, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionendpoints_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionendpoints_server.go index c9c1040975d0..1af65ca0fea7 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionendpoints_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionendpoints_server.go @@ -37,6 +37,10 @@ type DataCollectionEndpointsServer struct { // HTTP status codes to indicate success: http.StatusOK Get func(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *armmonitor.DataCollectionEndpointsClientGetOptions) (resp azfake.Responder[armmonitor.DataCollectionEndpointsClientGetResponse], errResp azfake.ErrorResponder) + // GetNSP is the fake for method DataCollectionEndpointsClient.GetNSP + // HTTP status codes to indicate success: http.StatusOK + GetNSP func(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, networkSecurityPerimeterConfigurationName string, options *armmonitor.DataCollectionEndpointsClientGetNSPOptions) (resp azfake.Responder[armmonitor.DataCollectionEndpointsClientGetNSPResponse], errResp azfake.ErrorResponder) + // NewListByResourceGroupPager is the fake for method DataCollectionEndpointsClient.NewListByResourceGroupPager // HTTP status codes to indicate success: http.StatusOK NewListByResourceGroupPager func(resourceGroupName string, options *armmonitor.DataCollectionEndpointsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmonitor.DataCollectionEndpointsClientListByResourceGroupResponse]) @@ -45,6 +49,14 @@ type DataCollectionEndpointsServer struct { // HTTP status codes to indicate success: http.StatusOK NewListBySubscriptionPager func(options *armmonitor.DataCollectionEndpointsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armmonitor.DataCollectionEndpointsClientListBySubscriptionResponse]) + // NewListNSPPager is the fake for method DataCollectionEndpointsClient.NewListNSPPager + // HTTP status codes to indicate success: http.StatusOK + NewListNSPPager func(resourceGroupName string, dataCollectionEndpointName string, options *armmonitor.DataCollectionEndpointsClientListNSPOptions) (resp azfake.PagerResponder[armmonitor.DataCollectionEndpointsClientListNSPResponse]) + + // BeginReconcileNSP is the fake for method DataCollectionEndpointsClient.BeginReconcileNSP + // HTTP status codes to indicate success: http.StatusAccepted + BeginReconcileNSP func(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, networkSecurityPerimeterConfigurationName string, options *armmonitor.DataCollectionEndpointsClientBeginReconcileNSPOptions) (resp azfake.PollerResponder[armmonitor.DataCollectionEndpointsClientReconcileNSPResponse], errResp azfake.ErrorResponder) + // Update is the fake for method DataCollectionEndpointsClient.Update // HTTP status codes to indicate success: http.StatusOK Update func(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *armmonitor.DataCollectionEndpointsClientUpdateOptions) (resp azfake.Responder[armmonitor.DataCollectionEndpointsClientUpdateResponse], errResp azfake.ErrorResponder) @@ -58,6 +70,8 @@ func NewDataCollectionEndpointsServerTransport(srv *DataCollectionEndpointsServe srv: srv, newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmonitor.DataCollectionEndpointsClientListByResourceGroupResponse]](), newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmonitor.DataCollectionEndpointsClientListBySubscriptionResponse]](), + newListNSPPager: newTracker[azfake.PagerResponder[armmonitor.DataCollectionEndpointsClientListNSPResponse]](), + beginReconcileNSP: newTracker[azfake.PollerResponder[armmonitor.DataCollectionEndpointsClientReconcileNSPResponse]](), } } @@ -67,6 +81,8 @@ type DataCollectionEndpointsServerTransport struct { srv *DataCollectionEndpointsServer newListByResourceGroupPager *tracker[azfake.PagerResponder[armmonitor.DataCollectionEndpointsClientListByResourceGroupResponse]] newListBySubscriptionPager *tracker[azfake.PagerResponder[armmonitor.DataCollectionEndpointsClientListBySubscriptionResponse]] + newListNSPPager *tracker[azfake.PagerResponder[armmonitor.DataCollectionEndpointsClientListNSPResponse]] + beginReconcileNSP *tracker[azfake.PollerResponder[armmonitor.DataCollectionEndpointsClientReconcileNSPResponse]] } // Do implements the policy.Transporter interface for DataCollectionEndpointsServerTransport. @@ -87,10 +103,16 @@ func (d *DataCollectionEndpointsServerTransport) Do(req *http.Request) (*http.Re resp, err = d.dispatchDelete(req) case "DataCollectionEndpointsClient.Get": resp, err = d.dispatchGet(req) + case "DataCollectionEndpointsClient.GetNSP": + resp, err = d.dispatchGetNSP(req) case "DataCollectionEndpointsClient.NewListByResourceGroupPager": resp, err = d.dispatchNewListByResourceGroupPager(req) case "DataCollectionEndpointsClient.NewListBySubscriptionPager": resp, err = d.dispatchNewListBySubscriptionPager(req) + case "DataCollectionEndpointsClient.NewListNSPPager": + resp, err = d.dispatchNewListNSPPager(req) + case "DataCollectionEndpointsClient.BeginReconcileNSP": + resp, err = d.dispatchBeginReconcileNSP(req) case "DataCollectionEndpointsClient.Update": resp, err = d.dispatchUpdate(req) default: @@ -213,6 +235,43 @@ func (d *DataCollectionEndpointsServerTransport) dispatchGet(req *http.Request) return resp, nil } +func (d *DataCollectionEndpointsServerTransport) dispatchGetNSP(req *http.Request) (*http.Response, error) { + if d.srv.GetNSP == nil { + return nil, &nonRetriableError{errors.New("fake for method GetNSP not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/networkSecurityPerimeterConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + dataCollectionEndpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataCollectionEndpointName")]) + if err != nil { + return nil, err + } + networkSecurityPerimeterConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkSecurityPerimeterConfigurationName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.GetNSP(req.Context(), resourceGroupNameParam, dataCollectionEndpointNameParam, networkSecurityPerimeterConfigurationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).NetworkSecurityPerimeterConfiguration, req) + if err != nil { + return nil, err + } + return resp, nil +} + func (d *DataCollectionEndpointsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { if d.srv.NewListByResourceGroupPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} @@ -283,6 +342,95 @@ func (d *DataCollectionEndpointsServerTransport) dispatchNewListBySubscriptionPa return resp, nil } +func (d *DataCollectionEndpointsServerTransport) dispatchNewListNSPPager(req *http.Request) (*http.Response, error) { + if d.srv.NewListNSPPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListNSPPager not implemented")} + } + newListNSPPager := d.newListNSPPager.get(req) + if newListNSPPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/networkSecurityPerimeterConfigurations` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + dataCollectionEndpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataCollectionEndpointName")]) + if err != nil { + return nil, err + } + resp := d.srv.NewListNSPPager(resourceGroupNameParam, dataCollectionEndpointNameParam, nil) + newListNSPPager = &resp + d.newListNSPPager.add(req, newListNSPPager) + server.PagerResponderInjectNextLinks(newListNSPPager, req, func(page *armmonitor.DataCollectionEndpointsClientListNSPResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListNSPPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + d.newListNSPPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListNSPPager) { + d.newListNSPPager.remove(req) + } + return resp, nil +} + +func (d *DataCollectionEndpointsServerTransport) dispatchBeginReconcileNSP(req *http.Request) (*http.Response, error) { + if d.srv.BeginReconcileNSP == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginReconcileNSP not implemented")} + } + beginReconcileNSP := d.beginReconcileNSP.get(req) + if beginReconcileNSP == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/networkSecurityPerimeterConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/reconcile` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + dataCollectionEndpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataCollectionEndpointName")]) + if err != nil { + return nil, err + } + networkSecurityPerimeterConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkSecurityPerimeterConfigurationName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.BeginReconcileNSP(req.Context(), resourceGroupNameParam, dataCollectionEndpointNameParam, networkSecurityPerimeterConfigurationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginReconcileNSP = &respr + d.beginReconcileNSP.add(req, beginReconcileNSP) + } + + resp, err := server.PollerResponderNext(beginReconcileNSP, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + d.beginReconcileNSP.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginReconcileNSP) { + d.beginReconcileNSP.remove(req) + } + + return resp, nil +} + func (d *DataCollectionEndpointsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { if d.srv.Update == nil { return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionrules_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionrules_server.go index 5def3e9fc4e3..f44d7ad5f04b 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionrules_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionrules_server.go @@ -21,6 +21,7 @@ import ( "net/url" "reflect" "regexp" + "strconv" ) // DataCollectionRulesServer is a fake server for instances of the armmonitor.DataCollectionRulesClient type. @@ -157,6 +158,7 @@ func (d *DataCollectionRulesServerTransport) dispatchDelete(req *http.Request) ( if matches == nil || len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } + qp := req.URL.Query() resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) if err != nil { return nil, err @@ -165,7 +167,21 @@ func (d *DataCollectionRulesServerTransport) dispatchDelete(req *http.Request) ( if err != nil { return nil, err } - respr, errRespr := d.srv.Delete(req.Context(), resourceGroupNameParam, dataCollectionRuleNameParam, nil) + deleteAssociationsUnescaped, err := url.QueryUnescape(qp.Get("deleteAssociations")) + if err != nil { + return nil, err + } + deleteAssociationsParam, err := parseOptional(deleteAssociationsUnescaped, strconv.ParseBool) + if err != nil { + return nil, err + } + var options *armmonitor.DataCollectionRulesClientDeleteOptions + if deleteAssociationsParam != nil { + options = &armmonitor.DataCollectionRulesClientDeleteOptions{ + DeleteAssociations: deleteAssociationsParam, + } + } + respr, errRespr := d.srv.Delete(req.Context(), resourceGroupNameParam, dataCollectionRuleNameParam, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/metrics_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/metrics_server.go index 32e178fddda3..c344863dc5f3 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/metrics_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/metrics_server.go @@ -165,8 +165,13 @@ func (m *MetricsServerTransport) dispatchList(req *http.Request) (*http.Response if err != nil { return nil, err } + rollupbyUnescaped, err := url.QueryUnescape(qp.Get("rollupby")) + if err != nil { + return nil, err + } + rollupbyParam := getOptional(rollupbyUnescaped) var options *armmonitor.MetricsClientListOptions - if timespanParam != nil || intervalParam != nil || metricnamesParam != nil || aggregationParam != nil || topParam != nil || orderbyParam != nil || filterParam != nil || resultTypeParam != nil || metricnamespaceParam != nil || autoAdjustTimegrainParam != nil || validateDimensionsParam != nil { + if timespanParam != nil || intervalParam != nil || metricnamesParam != nil || aggregationParam != nil || topParam != nil || orderbyParam != nil || filterParam != nil || resultTypeParam != nil || metricnamespaceParam != nil || autoAdjustTimegrainParam != nil || validateDimensionsParam != nil || rollupbyParam != nil { options = &armmonitor.MetricsClientListOptions{ Timespan: timespanParam, Interval: intervalParam, @@ -179,6 +184,7 @@ func (m *MetricsServerTransport) dispatchList(req *http.Request) (*http.Response Metricnamespace: metricnamespaceParam, AutoAdjustTimegrain: autoAdjustTimegrainParam, ValidateDimensions: validateDimensionsParam, + Rollupby: rollupbyParam, } } respr, errRespr := m.srv.List(req.Context(), resourceURIParam, options) @@ -281,8 +287,13 @@ func (m *MetricsServerTransport) dispatchListAtSubscriptionScope(req *http.Reque if err != nil { return nil, err } + rollupbyUnescaped, err := url.QueryUnescape(qp.Get("rollupby")) + if err != nil { + return nil, err + } + rollupbyParam := getOptional(rollupbyUnescaped) var options *armmonitor.MetricsClientListAtSubscriptionScopeOptions - if timespanParam != nil || intervalParam != nil || metricnamesParam != nil || aggregationParam != nil || topParam != nil || orderbyParam != nil || filterParam != nil || resultTypeParam != nil || metricnamespaceParam != nil || autoAdjustTimegrainParam != nil || validateDimensionsParam != nil { + if timespanParam != nil || intervalParam != nil || metricnamesParam != nil || aggregationParam != nil || topParam != nil || orderbyParam != nil || filterParam != nil || resultTypeParam != nil || metricnamespaceParam != nil || autoAdjustTimegrainParam != nil || validateDimensionsParam != nil || rollupbyParam != nil { options = &armmonitor.MetricsClientListAtSubscriptionScopeOptions{ Timespan: timespanParam, Interval: intervalParam, @@ -295,6 +306,7 @@ func (m *MetricsServerTransport) dispatchListAtSubscriptionScope(req *http.Reque Metricnamespace: metricnamespaceParam, AutoAdjustTimegrain: autoAdjustTimegrainParam, ValidateDimensions: validateDimensionsParam, + Rollupby: rollupbyParam, } } respr, errRespr := m.srv.ListAtSubscriptionScope(req.Context(), regionParam, options) @@ -305,7 +317,7 @@ func (m *MetricsServerTransport) dispatchListAtSubscriptionScope(req *http.Reque if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SubscriptionScopeMetricResponse, req) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Response, req) if err != nil { return nil, err } @@ -401,8 +413,13 @@ func (m *MetricsServerTransport) dispatchListAtSubscriptionScopePost(req *http.R if err != nil { return nil, err } + rollupbyUnescaped, err := url.QueryUnescape(qp.Get("rollupby")) + if err != nil { + return nil, err + } + rollupbyParam := getOptional(rollupbyUnescaped) var options *armmonitor.MetricsClientListAtSubscriptionScopePostOptions - if timespanParam != nil || intervalParam != nil || metricnamesParam != nil || aggregationParam != nil || topParam != nil || orderbyParam != nil || filterParam != nil || resultTypeParam != nil || metricnamespaceParam != nil || autoAdjustTimegrainParam != nil || validateDimensionsParam != nil || !reflect.ValueOf(body).IsZero() { + if timespanParam != nil || intervalParam != nil || metricnamesParam != nil || aggregationParam != nil || topParam != nil || orderbyParam != nil || filterParam != nil || resultTypeParam != nil || metricnamespaceParam != nil || autoAdjustTimegrainParam != nil || validateDimensionsParam != nil || rollupbyParam != nil || !reflect.ValueOf(body).IsZero() { options = &armmonitor.MetricsClientListAtSubscriptionScopePostOptions{ Timespan: timespanParam, Interval: intervalParam, @@ -415,6 +432,7 @@ func (m *MetricsServerTransport) dispatchListAtSubscriptionScopePost(req *http.R Metricnamespace: metricnamespaceParam, AutoAdjustTimegrain: autoAdjustTimegrainParam, ValidateDimensions: validateDimensionsParam, + Rollupby: rollupbyParam, Body: &body, } } @@ -426,7 +444,7 @@ func (m *MetricsServerTransport) dispatchListAtSubscriptionScopePost(req *http.R if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SubscriptionScopeMetricResponse, req) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Response, req) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/operations_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/operations_server.go index 3f4ae743691f..8e23e3243124 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/operations_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/operations_server.go @@ -76,7 +76,7 @@ func (o *OperationsServerTransport) dispatchList(req *http.Request) (*http.Respo if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationListResult, req) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationListResultAutoGenerated, req) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/privateendpointconnections_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/privateendpointconnections_server.go index 7c92dd7db08d..b400246c4226 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/privateendpointconnections_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/privateendpointconnections_server.go @@ -25,7 +25,7 @@ import ( type PrivateEndpointConnectionsServer struct { // BeginCreateOrUpdate is the fake for method PrivateEndpointConnectionsClient.BeginCreateOrUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters armmonitor.PrivateEndpointConnection, options *armmonitor.PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armmonitor.PrivateEndpointConnectionsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters armmonitor.PrivateEndpointConnectionAutoGenerated, options *armmonitor.PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armmonitor.PrivateEndpointConnectionsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method PrivateEndpointConnectionsClient.BeginDelete // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent @@ -102,7 +102,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginCreateOrUpdate( if matches == nil || len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - body, err := server.UnmarshalRequestAsJSON[armmonitor.PrivateEndpointConnection](req) + body, err := server.UnmarshalRequestAsJSON[armmonitor.PrivateEndpointConnectionAutoGenerated](req) if err != nil { return nil, err } @@ -220,7 +220,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchGet(req *http.Reques if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnection, req) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnectionAutoGenerated, req) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/scheduledqueryrule_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/scheduledqueryrule_server.go new file mode 100644 index 000000000000..5312fdccf0c4 --- /dev/null +++ b/sdk/resourcemanager/monitor/armmonitor/fake/scheduledqueryrule_server.go @@ -0,0 +1,212 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" + "net/http" + "net/url" + "regexp" +) + +// ScheduledQueryRuleServer is a fake server for instances of the armmonitor.ScheduledQueryRuleClient type. +type ScheduledQueryRuleServer struct { + // GetNSP is the fake for method ScheduledQueryRuleClient.GetNSP + // HTTP status codes to indicate success: http.StatusOK + GetNSP func(ctx context.Context, resourceGroupName string, ruleName string, networkSecurityPerimeterConfigurationName string, options *armmonitor.ScheduledQueryRuleClientGetNSPOptions) (resp azfake.Responder[armmonitor.ScheduledQueryRuleClientGetNSPResponse], errResp azfake.ErrorResponder) + + // NewListNSPPager is the fake for method ScheduledQueryRuleClient.NewListNSPPager + // HTTP status codes to indicate success: http.StatusOK + NewListNSPPager func(resourceGroupName string, ruleName string, options *armmonitor.ScheduledQueryRuleClientListNSPOptions) (resp azfake.PagerResponder[armmonitor.ScheduledQueryRuleClientListNSPResponse]) + + // BeginReconcileNSP is the fake for method ScheduledQueryRuleClient.BeginReconcileNSP + // HTTP status codes to indicate success: http.StatusAccepted + BeginReconcileNSP func(ctx context.Context, resourceGroupName string, ruleName string, networkSecurityPerimeterConfigurationName string, options *armmonitor.ScheduledQueryRuleClientBeginReconcileNSPOptions) (resp azfake.PollerResponder[armmonitor.ScheduledQueryRuleClientReconcileNSPResponse], errResp azfake.ErrorResponder) +} + +// NewScheduledQueryRuleServerTransport creates a new instance of ScheduledQueryRuleServerTransport with the provided implementation. +// The returned ScheduledQueryRuleServerTransport instance is connected to an instance of armmonitor.ScheduledQueryRuleClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewScheduledQueryRuleServerTransport(srv *ScheduledQueryRuleServer) *ScheduledQueryRuleServerTransport { + return &ScheduledQueryRuleServerTransport{ + srv: srv, + newListNSPPager: newTracker[azfake.PagerResponder[armmonitor.ScheduledQueryRuleClientListNSPResponse]](), + beginReconcileNSP: newTracker[azfake.PollerResponder[armmonitor.ScheduledQueryRuleClientReconcileNSPResponse]](), + } +} + +// ScheduledQueryRuleServerTransport connects instances of armmonitor.ScheduledQueryRuleClient to instances of ScheduledQueryRuleServer. +// Don't use this type directly, use NewScheduledQueryRuleServerTransport instead. +type ScheduledQueryRuleServerTransport struct { + srv *ScheduledQueryRuleServer + newListNSPPager *tracker[azfake.PagerResponder[armmonitor.ScheduledQueryRuleClientListNSPResponse]] + beginReconcileNSP *tracker[azfake.PollerResponder[armmonitor.ScheduledQueryRuleClientReconcileNSPResponse]] +} + +// Do implements the policy.Transporter interface for ScheduledQueryRuleServerTransport. +func (s *ScheduledQueryRuleServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ScheduledQueryRuleClient.GetNSP": + resp, err = s.dispatchGetNSP(req) + case "ScheduledQueryRuleClient.NewListNSPPager": + resp, err = s.dispatchNewListNSPPager(req) + case "ScheduledQueryRuleClient.BeginReconcileNSP": + resp, err = s.dispatchBeginReconcileNSP(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *ScheduledQueryRuleServerTransport) dispatchGetNSP(req *http.Request) (*http.Response, error) { + if s.srv.GetNSP == nil { + return nil, &nonRetriableError{errors.New("fake for method GetNSP not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/scheduledQueryRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/networkSecurityPerimeterConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + ruleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleName")]) + if err != nil { + return nil, err + } + networkSecurityPerimeterConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkSecurityPerimeterConfigurationName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.GetNSP(req.Context(), resourceGroupNameParam, ruleNameParam, networkSecurityPerimeterConfigurationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).NetworkSecurityPerimeterConfiguration, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *ScheduledQueryRuleServerTransport) dispatchNewListNSPPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListNSPPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListNSPPager not implemented")} + } + newListNSPPager := s.newListNSPPager.get(req) + if newListNSPPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/scheduledQueryRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/networkSecurityPerimeterConfigurations` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + ruleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListNSPPager(resourceGroupNameParam, ruleNameParam, nil) + newListNSPPager = &resp + s.newListNSPPager.add(req, newListNSPPager) + server.PagerResponderInjectNextLinks(newListNSPPager, req, func(page *armmonitor.ScheduledQueryRuleClientListNSPResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListNSPPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListNSPPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListNSPPager) { + s.newListNSPPager.remove(req) + } + return resp, nil +} + +func (s *ScheduledQueryRuleServerTransport) dispatchBeginReconcileNSP(req *http.Request) (*http.Response, error) { + if s.srv.BeginReconcileNSP == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginReconcileNSP not implemented")} + } + beginReconcileNSP := s.beginReconcileNSP.get(req) + if beginReconcileNSP == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/scheduledQueryRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/networkSecurityPerimeterConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/reconcile` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + ruleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleName")]) + if err != nil { + return nil, err + } + networkSecurityPerimeterConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkSecurityPerimeterConfigurationName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginReconcileNSP(req.Context(), resourceGroupNameParam, ruleNameParam, networkSecurityPerimeterConfigurationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginReconcileNSP = &respr + s.beginReconcileNSP.add(req, beginReconcileNSP) + } + + resp, err := server.PollerResponderNext(beginReconcileNSP, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + s.beginReconcileNSP.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginReconcileNSP) { + s.beginReconcileNSP.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/server.go b/sdk/resourcemanager/monitor/armmonitor/fake/server.go new file mode 100644 index 000000000000..e8f246e7e421 --- /dev/null +++ b/sdk/resourcemanager/monitor/armmonitor/fake/server.go @@ -0,0 +1,162 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" + "net/http" + "net/url" + "regexp" +) + +// Server is a fake server for instances of the armmonitor.Client type. +type Server struct { + // BeginCreateNotificationsAtTenantActionGroupResourceLevel is the fake for method Client.BeginCreateNotificationsAtTenantActionGroupResourceLevel + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginCreateNotificationsAtTenantActionGroupResourceLevel func(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, notificationRequest armmonitor.TenantNotificationRequestBody, options *armmonitor.ClientBeginCreateNotificationsAtTenantActionGroupResourceLevelOptions) (resp azfake.PollerResponder[armmonitor.ClientCreateNotificationsAtTenantActionGroupResourceLevelResponse], errResp azfake.ErrorResponder) + + // GetTestNotificationsAtTenantActionGroupResourceLevel is the fake for method Client.GetTestNotificationsAtTenantActionGroupResourceLevel + // HTTP status codes to indicate success: http.StatusOK + GetTestNotificationsAtTenantActionGroupResourceLevel func(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, notificationID string, options *armmonitor.ClientGetTestNotificationsAtTenantActionGroupResourceLevelOptions) (resp azfake.Responder[armmonitor.ClientGetTestNotificationsAtTenantActionGroupResourceLevelResponse], errResp azfake.ErrorResponder) +} + +// NewServerTransport creates a new instance of ServerTransport with the provided implementation. +// The returned ServerTransport instance is connected to an instance of armmonitor.Client via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerTransport(srv *Server) *ServerTransport { + return &ServerTransport{ + srv: srv, + beginCreateNotificationsAtTenantActionGroupResourceLevel: newTracker[azfake.PollerResponder[armmonitor.ClientCreateNotificationsAtTenantActionGroupResourceLevelResponse]](), + } +} + +// ServerTransport connects instances of armmonitor.Client to instances of Server. +// Don't use this type directly, use NewServerTransport instead. +type ServerTransport struct { + srv *Server + beginCreateNotificationsAtTenantActionGroupResourceLevel *tracker[azfake.PollerResponder[armmonitor.ClientCreateNotificationsAtTenantActionGroupResourceLevelResponse]] +} + +// Do implements the policy.Transporter interface for ServerTransport. +func (s *ServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "Client.BeginCreateNotificationsAtTenantActionGroupResourceLevel": + resp, err = s.dispatchBeginCreateNotificationsAtTenantActionGroupResourceLevel(req) + case "Client.GetTestNotificationsAtTenantActionGroupResourceLevel": + resp, err = s.dispatchGetTestNotificationsAtTenantActionGroupResourceLevel(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *ServerTransport) dispatchBeginCreateNotificationsAtTenantActionGroupResourceLevel(req *http.Request) (*http.Response, error) { + if s.srv.BeginCreateNotificationsAtTenantActionGroupResourceLevel == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateNotificationsAtTenantActionGroupResourceLevel not implemented")} + } + beginCreateNotificationsAtTenantActionGroupResourceLevel := s.beginCreateNotificationsAtTenantActionGroupResourceLevel.get(req) + if beginCreateNotificationsAtTenantActionGroupResourceLevel == nil { + const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/tenantActionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/createNotifications` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmonitor.TenantNotificationRequestBody](req) + if err != nil { + return nil, err + } + managementGroupIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("managementGroupId")]) + if err != nil { + return nil, err + } + tenantActionGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("tenantActionGroupName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginCreateNotificationsAtTenantActionGroupResourceLevel(req.Context(), managementGroupIDParam, tenantActionGroupNameParam, getHeaderValue(req.Header, "x-ms-client-tenant-id"), body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateNotificationsAtTenantActionGroupResourceLevel = &respr + s.beginCreateNotificationsAtTenantActionGroupResourceLevel.add(req, beginCreateNotificationsAtTenantActionGroupResourceLevel) + } + + resp, err := server.PollerResponderNext(beginCreateNotificationsAtTenantActionGroupResourceLevel, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginCreateNotificationsAtTenantActionGroupResourceLevel.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateNotificationsAtTenantActionGroupResourceLevel) { + s.beginCreateNotificationsAtTenantActionGroupResourceLevel.remove(req) + } + + return resp, nil +} + +func (s *ServerTransport) dispatchGetTestNotificationsAtTenantActionGroupResourceLevel(req *http.Request) (*http.Response, error) { + if s.srv.GetTestNotificationsAtTenantActionGroupResourceLevel == nil { + return nil, &nonRetriableError{errors.New("fake for method GetTestNotificationsAtTenantActionGroupResourceLevel not implemented")} + } + const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/tenantActionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/notificationStatus/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + managementGroupIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("managementGroupId")]) + if err != nil { + return nil, err + } + tenantActionGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("tenantActionGroupName")]) + if err != nil { + return nil, err + } + notificationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("notificationId")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.GetTestNotificationsAtTenantActionGroupResourceLevel(req.Context(), managementGroupIDParam, tenantActionGroupNameParam, getHeaderValue(req.Header, "x-ms-client-tenant-id"), notificationIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).TestNotificationDetailsResponseAutoGenerated, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/server_factory.go b/sdk/resourcemanager/monitor/armmonitor/fake/server_factory.go index 17116edbbb23..c3a4e3bff2b6 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/server_factory.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/server_factory.go @@ -27,6 +27,7 @@ type ServerFactory struct { AutoscaleSettingsServer AutoscaleSettingsServer AzureMonitorWorkspacesServer AzureMonitorWorkspacesServer BaselinesServer BaselinesServer + Server Server DataCollectionEndpointsServer DataCollectionEndpointsServer DataCollectionRuleAssociationsServer DataCollectionRuleAssociationsServer DataCollectionRulesServer DataCollectionRulesServer @@ -47,6 +48,7 @@ type ServerFactory struct { PrivateLinkScopeOperationStatusServer PrivateLinkScopeOperationStatusServer PrivateLinkScopedResourcesServer PrivateLinkScopedResourcesServer PrivateLinkScopesServer PrivateLinkScopesServer + ScheduledQueryRuleServer ScheduledQueryRuleServer ScheduledQueryRulesServer ScheduledQueryRulesServer TenantActionGroupsServer TenantActionGroupsServer TenantActivityLogsServer TenantActivityLogsServer @@ -75,6 +77,7 @@ type ServerFactoryTransport struct { trAutoscaleSettingsServer *AutoscaleSettingsServerTransport trAzureMonitorWorkspacesServer *AzureMonitorWorkspacesServerTransport trBaselinesServer *BaselinesServerTransport + trServer *ServerTransport trDataCollectionEndpointsServer *DataCollectionEndpointsServerTransport trDataCollectionRuleAssociationsServer *DataCollectionRuleAssociationsServerTransport trDataCollectionRulesServer *DataCollectionRulesServerTransport @@ -95,6 +98,7 @@ type ServerFactoryTransport struct { trPrivateLinkScopeOperationStatusServer *PrivateLinkScopeOperationStatusServerTransport trPrivateLinkScopedResourcesServer *PrivateLinkScopedResourcesServerTransport trPrivateLinkScopesServer *PrivateLinkScopesServerTransport + trScheduledQueryRuleServer *ScheduledQueryRuleServerTransport trScheduledQueryRulesServer *ScheduledQueryRulesServerTransport trTenantActionGroupsServer *TenantActionGroupsServerTransport trTenantActivityLogsServer *TenantActivityLogsServerTransport @@ -146,6 +150,9 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { case "BaselinesClient": initServer(s, &s.trBaselinesServer, func() *BaselinesServerTransport { return NewBaselinesServerTransport(&s.srv.BaselinesServer) }) resp, err = s.trBaselinesServer.Do(req) + case "Client": + initServer(s, &s.trServer, func() *ServerTransport { return NewServerTransport(&s.srv.Server) }) + resp, err = s.trServer.Do(req) case "DataCollectionEndpointsClient": initServer(s, &s.trDataCollectionEndpointsServer, func() *DataCollectionEndpointsServerTransport { return NewDataCollectionEndpointsServerTransport(&s.srv.DataCollectionEndpointsServer) @@ -238,6 +245,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewPrivateLinkScopesServerTransport(&s.srv.PrivateLinkScopesServer) }) resp, err = s.trPrivateLinkScopesServer.Do(req) + case "ScheduledQueryRuleClient": + initServer(s, &s.trScheduledQueryRuleServer, func() *ScheduledQueryRuleServerTransport { + return NewScheduledQueryRuleServerTransport(&s.srv.ScheduledQueryRuleServer) + }) + resp, err = s.trScheduledQueryRuleServer.Do(req) case "ScheduledQueryRulesClient": initServer(s, &s.trScheduledQueryRulesServer, func() *ScheduledQueryRulesServerTransport { return NewScheduledQueryRulesServerTransport(&s.srv.ScheduledQueryRulesServer) diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/time_rfc3339.go b/sdk/resourcemanager/monitor/armmonitor/fake/time_rfc3339.go index 3080daf9560a..81f308b0d343 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/time_rfc3339.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/time_rfc3339.go @@ -19,12 +19,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +44,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 @@ -84,72 +108,3 @@ func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) e *t = (*time.Time)(&aux) return nil } - -const ( - utcTimeJSON = `"15:04:05.999999999"` - utcTime = "15:04:05.999999999" - timeFormat = "15:04:05.999999999Z07:00" -) - -type timeRFC3339 time.Time - -func (t timeRFC3339) MarshalJSON() ([]byte, error) { - s, _ := t.MarshalText() - return []byte(fmt.Sprintf("\"%s\"", s)), nil -} - -func (t timeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return []byte(tt.Format(timeFormat)), nil -} - -func (t *timeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcTimeJSON - if tzOffsetRegex.Match(data) { - layout = timeFormat - } - return t.Parse(layout, string(data)) -} - -func (t *timeRFC3339) UnmarshalText(data []byte) error { - layout := utcTime - if tzOffsetRegex.Match(data) { - layout = timeFormat - } - return t.Parse(layout, string(data)) -} - -func (t *timeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = timeRFC3339(p) - return err -} - -func (t timeRFC3339) String() string { - tt := time.Time(t) - return tt.Format(timeFormat) -} - -func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*timeRFC3339)(t) -} - -func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { - return nil - } - var aux timeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/go.mod b/sdk/resourcemanager/monitor/armmonitor/go.mod index ef7734cb9a28..7c15c9c9ae30 100644 --- a/sdk/resourcemanager/monitor/armmonitor/go.mod +++ b/sdk/resourcemanager/monitor/armmonitor/go.mod @@ -4,7 +4,6 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.2 github.com/Azure/azure-sdk-for-go/sdk/internal v1.8.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.0.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 @@ -12,6 +11,7 @@ require ( ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.2 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/golang-jwt/jwt/v5 v5.2.1 // indirect diff --git a/sdk/resourcemanager/monitor/armmonitor/logprofiles_client.go b/sdk/resourcemanager/monitor/armmonitor/logprofiles_client.go index f8042d17921a..48d955200db9 100644 --- a/sdk/resourcemanager/monitor/armmonitor/logprofiles_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/logprofiles_client.go @@ -28,7 +28,7 @@ type LogProfilesClient struct { } // NewLogProfilesClient creates a new instance of LogProfilesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewLogProfilesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LogProfilesClient, error) { diff --git a/sdk/resourcemanager/monitor/armmonitor/logprofiles_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/logprofiles_client_example_test.go deleted file mode 100644 index 66b0efcdbaae..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/logprofiles_client_example_test.go +++ /dev/null @@ -1,262 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/deleteLogProfile.json -func ExampleLogProfilesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewLogProfilesClient().Delete(ctx, "Rac46PostSwapRG", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/getLogProfile.json -func ExampleLogProfilesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLogProfilesClient().Get(ctx, "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LogProfileResource = armmonitor.LogProfileResource{ - // Name: to.Ptr("default"), - // Type: to.Ptr(""), - // ID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/providers/microsoft.insights/logprofiles/default"), - // Location: to.Ptr(""), - // Properties: &armmonitor.LogProfileProperties{ - // Categories: []*string{ - // to.Ptr("Delete"), - // to.Ptr("Write"), - // to.Ptr("Action")}, - // Locations: []*string{ - // to.Ptr("global")}, - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](3), - // Enabled: to.Ptr(true), - // }, - // ServiceBusRuleID: to.Ptr(""), - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/createOrUpdateLogProfile.json -func ExampleLogProfilesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLogProfilesClient().CreateOrUpdate(ctx, "Rac46PostSwapRG", armmonitor.LogProfileResource{ - Location: to.Ptr(""), - Tags: map[string]*string{}, - Properties: &armmonitor.LogProfileProperties{ - Categories: []*string{ - to.Ptr("Write"), - to.Ptr("Delete"), - to.Ptr("Action")}, - Locations: []*string{ - to.Ptr("global")}, - RetentionPolicy: &armmonitor.RetentionPolicy{ - Days: to.Ptr[int32](3), - Enabled: to.Ptr(true), - }, - ServiceBusRuleID: to.Ptr(""), - StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LogProfileResource = armmonitor.LogProfileResource{ - // Name: to.Ptr("default"), - // Type: to.Ptr(""), - // ID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/providers/microsoft.insights/logprofiles/default"), - // Location: to.Ptr(""), - // Properties: &armmonitor.LogProfileProperties{ - // Categories: []*string{ - // to.Ptr("Delete"), - // to.Ptr("Write"), - // to.Ptr("Action")}, - // Locations: []*string{ - // to.Ptr("global")}, - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](3), - // Enabled: to.Ptr(true), - // }, - // ServiceBusRuleID: to.Ptr(""), - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/patchLogProfile.json -func ExampleLogProfilesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLogProfilesClient().Update(ctx, "Rac46PostSwapRG", armmonitor.LogProfileResourcePatch{ - Properties: &armmonitor.LogProfileProperties{ - Categories: []*string{ - to.Ptr("Write"), - to.Ptr("Delete"), - to.Ptr("Action")}, - Locations: []*string{ - to.Ptr("global")}, - RetentionPolicy: &armmonitor.RetentionPolicy{ - Days: to.Ptr[int32](3), - Enabled: to.Ptr(true), - }, - ServiceBusRuleID: to.Ptr(""), - StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162"), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LogProfileResource = armmonitor.LogProfileResource{ - // Name: to.Ptr("default"), - // Type: to.Ptr(""), - // ID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/providers/microsoft.insights/logprofiles/default"), - // Location: to.Ptr(""), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armmonitor.LogProfileProperties{ - // Categories: []*string{ - // to.Ptr("Delete"), - // to.Ptr("Write"), - // to.Ptr("Action")}, - // Locations: []*string{ - // to.Ptr("global")}, - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](3), - // Enabled: to.Ptr(true), - // }, - // ServiceBusRuleID: to.Ptr(""), - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/listLogProfile.json -func ExampleLogProfilesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLogProfilesClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LogProfileCollection = armmonitor.LogProfileCollection{ - // Value: []*armmonitor.LogProfileResource{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr(""), - // ID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/providers/microsoft.insights/logprofiles/default"), - // Location: to.Ptr(""), - // Properties: &armmonitor.LogProfileProperties{ - // Categories: []*string{ - // to.Ptr("Delete"), - // to.Ptr("Write"), - // to.Ptr("Action")}, - // Locations: []*string{ - // to.Ptr("global")}, - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](3), - // Enabled: to.Ptr(true), - // }, - // ServiceBusRuleID: to.Ptr(""), - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162"), - // }, - // }, - // { - // Name: to.Ptr("default2"), - // Type: to.Ptr(""), - // ID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/providers/microsoft.insights/logprofiles/default2"), - // Location: to.Ptr(""), - // Properties: &armmonitor.LogProfileProperties{ - // Categories: []*string{ - // to.Ptr("Delete"), - // to.Ptr("Write"), - // to.Ptr("Action")}, - // Locations: []*string{ - // to.Ptr("global")}, - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](15), - // Enabled: to.Ptr(true), - // }, - // ServiceBusRuleID: to.Ptr(""), - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8165"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metricalerts_client.go b/sdk/resourcemanager/monitor/armmonitor/metricalerts_client.go index fbc981a3dcf3..0370f77ffda7 100644 --- a/sdk/resourcemanager/monitor/armmonitor/metricalerts_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/metricalerts_client.go @@ -28,7 +28,7 @@ type MetricAlertsClient struct { } // NewMetricAlertsClient creates a new instance of MetricAlertsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewMetricAlertsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MetricAlertsClient, error) { diff --git a/sdk/resourcemanager/monitor/armmonitor/metricalerts_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/metricalerts_client_example_test.go deleted file mode 100644 index 6d1dd5eb5028..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metricalerts_client_example_test.go +++ /dev/null @@ -1,1477 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/listMetricAlert.json -func ExampleMetricAlertsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMetricAlertsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricAlertResourceCollection = armmonitor.MetricAlertResourceCollection{ - // Value: []*armmonitor.MetricAlertResource{ - // { - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/highcpu"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), - // AllOf: []*armmonitor.MetricCriteria{ - // { - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("CustomMetric_\\Processor(_Total)\\% Processor Time"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("Pt1m"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - // Severity: to.Ptr[int32](3), - // WindowSize: to.Ptr("Pt15m"), - // }, - // }, - // { - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/mediumcpu"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("Med cpu alert"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), - // AllOf: []*armmonitor.MetricCriteria{ - // { - // Name: to.Ptr("Medium_CPU_50"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("CustomMetric_\\Processor(_Total)\\% Processor Time"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](50.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("Pt1m"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - // Severity: to.Ptr[int32](4), - // WindowSize: to.Ptr("Pt15m"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getDynamicMetricAlertMultipleResource.json -func ExampleMetricAlertsClient_Get_getADynamicAlertRuleForMultipleResources() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "gigtest", "MetricAlertOnMultipleResources", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertOnMultipleResources"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(false), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.DynamicMetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), - // FailingPeriods: &armmonitor.DynamicThresholdFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[float32](4), - // NumberOfEvaluationPeriods: to.Ptr[float32](4), - // }, - // Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getDynamicMetricAlertSingleResource.json -func ExampleMetricAlertsClient_Get_getADynamicAlertRuleForSingleResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "gigtest", "chiricutin", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(false), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.DynamicMetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), - // FailingPeriods: &armmonitor.DynamicThresholdFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[float32](4), - // NumberOfEvaluationPeriods: to.Ptr[float32](4), - // }, - // Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("Pt1m"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - // Severity: to.Ptr[int32](3), - // WindowSize: to.Ptr("Pt15m"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getWebTestMetricAlert.json -func ExampleMetricAlertsClient_Get_getAWebTestAlertRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "rg-example", "webtest-name-example", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Name: to.Ptr("webtest-name-example"), - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/metricalerts/webtest-name-example"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example": to.Ptr("Resource"), - // "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("Automatically created alert rule for availability test \"webtest-name-example\""), - // Actions: []*armmonitor.MetricAlertAction{ - // }, - // Criteria: &armmonitor.WebtestLocationAvailabilityCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria), - // ComponentID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example"), - // FailedLocationCount: to.Ptr[float32](2), - // WebTestID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example"), - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example"), - // to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example")}, - // Severity: to.Ptr[int32](4), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertMultipleResource.json -func ExampleMetricAlertsClient_Get_getAnAlertRuleForMultipleResources() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "gigtest", "MetricAlertOnMultipleResources", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertOnMultipleResources"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(false), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.MetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1"), - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertSingleResource.json -func ExampleMetricAlertsClient_Get_getAnAlertRuleForSingleResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "gigtest", "chiricutin", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(false), - // Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), - // AllOf: []*armmonitor.MetricCriteria{ - // { - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("\\Processor(_Total)\\% Processor Time"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("Pt1m"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - // Severity: to.Ptr[int32](3), - // WindowSize: to.Ptr("Pt15m"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertResourceGroup.json -func ExampleMetricAlertsClient_Get_getAnAlertRuleOnResourceGroupS() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "gigtest1", "MetricAlertAtResourceGroupLevel", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1/providers/providers/microsoft.insights/metricalerts/MetricAlertAtResourceGroupLevel"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(false), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.MetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1"), - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest2")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertSubscription.json -func ExampleMetricAlertsClient_Get_getAnAlertRuleOnSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "gigtest", "MetricAlertAtSubscriptionLevel", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertAtSubscriptionLevel"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(false), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.MetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateDynamicMetricAlertMultipleResource.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateADynamicAlertRuleForMultipleResources() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "MetricAlertOnMultipleResources", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{}, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - AllOf: []armmonitor.MultiMetricCriteriaClassification{ - &armmonitor.DynamicMetricCriteria{ - Name: to.Ptr("High_CPU_80"), - CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{}, - MetricName: to.Ptr("Percentage CPU"), - MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), - FailingPeriods: &armmonitor.DynamicThresholdFailingPeriods{ - MinFailingPeriodsToAlert: to.Ptr[float32](4), - NumberOfEvaluationPeriods: to.Ptr[float32](4), - }, - Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT1M"), - Scopes: []*string{ - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1"), - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2")}, - Severity: to.Ptr[int32](3), - TargetResourceRegion: to.Ptr("southcentralus"), - TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - WindowSize: to.Ptr("PT15M"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertOnMultipleResources"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.DynamicMetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), - // FailingPeriods: &armmonitor.DynamicThresholdFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[float32](4), - // NumberOfEvaluationPeriods: to.Ptr[float32](4), - // }, - // Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateDynamicMetricAlertSingleResource.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateADynamicAlertRuleForSingleResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "chiricutin", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{}, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - AllOf: []armmonitor.MultiMetricCriteriaClassification{ - &armmonitor.DynamicMetricCriteria{ - Name: to.Ptr("High_CPU_80"), - CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{}, - MetricName: to.Ptr("Percentage CPU"), - MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), - FailingPeriods: &armmonitor.DynamicThresholdFailingPeriods{ - MinFailingPeriodsToAlert: to.Ptr[float32](4), - NumberOfEvaluationPeriods: to.Ptr[float32](4), - }, - IgnoreDataBefore: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-04T21:00:00.000Z"); return t }()), - Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT1M"), - Scopes: []*string{ - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - Severity: to.Ptr[int32](3), - WindowSize: to.Ptr("PT15M"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.DynamicMetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), - // FailingPeriods: &armmonitor.DynamicThresholdFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[float32](4), - // NumberOfEvaluationPeriods: to.Ptr[float32](4), - // }, - // IgnoreDataBefore: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-04T21:00:00.000Z"); return t}()), - // Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateWebTestMetricAlert.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAWebTestAlertRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "rg-example", "webtest-name-example", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{ - "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example": to.Ptr("Resource"), - "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example": to.Ptr("Resource"), - }, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("Automatically created alert rule for availability test \"component-example\" a"), - Actions: []*armmonitor.MetricAlertAction{}, - Criteria: &armmonitor.WebtestLocationAvailabilityCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria), - ComponentID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example"), - FailedLocationCount: to.Ptr[float32](2), - WebTestID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example"), - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT1M"), - Scopes: []*string{ - to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example"), - to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example")}, - Severity: to.Ptr[int32](4), - WindowSize: to.Ptr("PT15M"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Name: to.Ptr("webtest-name-example"), - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/metricalerts/webtest-name-example"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example": to.Ptr("Resource"), - // "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("Automatically created alert rule for availability test \"webtest-name-example\" a"), - // Actions: []*armmonitor.MetricAlertAction{ - // }, - // Criteria: &armmonitor.WebtestLocationAvailabilityCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria), - // ComponentID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example"), - // FailedLocationCount: to.Ptr[float32](2), - // WebTestID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example"), - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example"), - // to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example")}, - // Severity: to.Ptr[int32](4), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertMultipleResource.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRuleForMultipleResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "MetricAlertOnMultipleResources", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{}, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - AllOf: []armmonitor.MultiMetricCriteriaClassification{ - &armmonitor.MetricCriteria{ - Name: to.Ptr("High_CPU_80"), - CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{}, - MetricName: to.Ptr("Percentage CPU"), - MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - Operator: to.Ptr(armmonitor.OperatorGreaterThan), - Threshold: to.Ptr[float64](80.5), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT1M"), - Scopes: []*string{ - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1"), - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2")}, - Severity: to.Ptr[int32](3), - TargetResourceRegion: to.Ptr("southcentralus"), - TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - WindowSize: to.Ptr("PT15M"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertOnMultipleResources"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.MetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1"), - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertSingleResource.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRuleForSingleResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "chiricutin", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{}, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), - AllOf: []*armmonitor.MetricCriteria{ - { - Name: to.Ptr("High_CPU_80"), - CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{}, - MetricName: to.Ptr("\\Processor(_Total)\\% Processor Time"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - Operator: to.Ptr(armmonitor.OperatorGreaterThan), - Threshold: to.Ptr[float64](80.5), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("Pt1m"), - Scopes: []*string{ - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - Severity: to.Ptr[int32](3), - WindowSize: to.Ptr("Pt15m"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), - // AllOf: []*armmonitor.MetricCriteria{ - // { - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("\\Processor(_Total)\\% Processor Time"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("Pt1m"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - // Severity: to.Ptr[int32](3), - // WindowSize: to.Ptr("Pt15m"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertResourceGroup.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRuleOnResourceGroupS() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest1", "MetricAlertAtResourceGroupLevel", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{}, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - AllOf: []armmonitor.MultiMetricCriteriaClassification{ - &armmonitor.MetricCriteria{ - Name: to.Ptr("High_CPU_80"), - CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{}, - MetricName: to.Ptr("Percentage CPU"), - MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - Operator: to.Ptr(armmonitor.OperatorGreaterThan), - Threshold: to.Ptr[float64](80.5), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT1M"), - Scopes: []*string{ - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1"), - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest2")}, - Severity: to.Ptr[int32](3), - TargetResourceRegion: to.Ptr("southcentralus"), - TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - WindowSize: to.Ptr("PT15M"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1/providers/providers/microsoft.insights/metricalerts/MetricAlertAtResourceGroupLevel"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.MetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1"), - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest2")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertSubscription.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRuleOnSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "MetricAlertAtSubscriptionLevel", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{}, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - AllOf: []armmonitor.MultiMetricCriteriaClassification{ - &armmonitor.MetricCriteria{ - Name: to.Ptr("High_CPU_80"), - CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{}, - MetricName: to.Ptr("Percentage CPU"), - MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - Operator: to.Ptr(armmonitor.OperatorGreaterThan), - Threshold: to.Ptr[float64](80.5), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT1M"), - Scopes: []*string{ - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7")}, - Severity: to.Ptr[int32](3), - TargetResourceRegion: to.Ptr("southcentralus"), - TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - WindowSize: to.Ptr("PT15M"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertAtSubscriptionLevel"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.MetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertWithDimensions.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRulesWithDimensions() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "MetricAlertOnMultipleDimensions", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{}, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - AllOf: []armmonitor.MultiMetricCriteriaClassification{ - &armmonitor.MetricCriteria{ - Name: to.Ptr("Metric1"), - CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{ - { - Name: to.Ptr("ActivityName"), - Operator: to.Ptr("Include"), - Values: []*string{ - to.Ptr("*")}, - }, - { - Name: to.Ptr("StatusCode"), - Operator: to.Ptr("Include"), - Values: []*string{ - to.Ptr("200")}, - }}, - MetricName: to.Ptr("Availability"), - MetricNamespace: to.Ptr("Microsoft.KeyVault/vaults"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - Operator: to.Ptr(armmonitor.OperatorGreaterThan), - Threshold: to.Ptr[float64](55), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT1H"), - Scopes: []*string{ - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.KeyVault/vaults/keyVaultResource")}, - Severity: to.Ptr[int32](3), - WindowSize: to.Ptr("P1D"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertWithDimensions"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.MetricCriteria{ - // Name: to.Ptr("Metric1"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // { - // Name: to.Ptr("ActivityName"), - // Operator: to.Ptr("Include"), - // Values: []*string{ - // to.Ptr("*")}, - // }, - // { - // Name: to.Ptr("StatusCode"), - // Operator: to.Ptr("Include"), - // Values: []*string{ - // to.Ptr("200")}, - // }}, - // MetricName: to.Ptr("Availability"), - // MetricNamespace: to.Ptr("Microsoft.KeyVault/vaults"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](55), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1H"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.KeyVault/vaults/keyVaultResource")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.KeyVault/vaults"), - // WindowSize: to.Ptr("P1D"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/UpdateMetricAlert.json -func ExampleMetricAlertsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Update(ctx, "gigtest", "chiricutin", armmonitor.MetricAlertResourcePatch{ - Properties: &armmonitor.MetricAlertPropertiesPatch{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), - AllOf: []*armmonitor.MetricCriteria{ - { - Name: to.Ptr("High_CPU_80"), - CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{}, - MetricName: to.Ptr("\\Processor(_Total)\\% Processor Time"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - Operator: to.Ptr(armmonitor.OperatorGreaterThan), - Threshold: to.Ptr[float64](80.5), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("Pt1m"), - Scopes: []*string{ - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - Severity: to.Ptr[int32](3), - WindowSize: to.Ptr("Pt15m"), - }, - Tags: map[string]*string{}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), - // AllOf: []*armmonitor.MetricCriteria{ - // { - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("\\Processor(_Total)\\% Processor Time"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("Pt1m"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - // Severity: to.Ptr[int32](3), - // WindowSize: to.Ptr("Pt15m"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/deleteMetricAlert.json -func ExampleMetricAlertsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewMetricAlertsClient().Delete(ctx, "gigtest", "chiricutin", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client.go b/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client.go index 08919a9901e7..9399d0c2b851 100644 --- a/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client.go @@ -28,7 +28,7 @@ type MetricAlertsStatusClient struct { } // NewMetricAlertsStatusClient creates a new instance of MetricAlertsStatusClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewMetricAlertsStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MetricAlertsStatusClient, error) { diff --git a/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client_example_test.go deleted file mode 100644 index 1e773c902b9a..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client_example_test.go +++ /dev/null @@ -1,88 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertStatus.json -func ExampleMetricAlertsStatusClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsStatusClient().List(ctx, "gigtest", "chiricutin", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertStatusCollection = armmonitor.MetricAlertStatusCollection{ - // Value: []*armmonitor.MetricAlertStatus{ - // { - // Name: to.Ptr("cmVzb3VyY2VJZD0vc3Vic2NyaXB0aW9ucy8xNGRkZjBjNS03N2M1LTRiNTMtODRmNi1lMWZhNDNhZDY4ZjcvcmVzb3VyY2VHcm91cHMvZ2lndGVzdC9wcm92aWRlcnMvTWljcm9zb2Z0LkNvbXB1dGUvdmlydHVhbE1hY2hpbmVzL2dpZ3dhZG1l"), - // Type: to.Ptr("Microsoft.Insights/metricAlerts/status"), - // ID: to.Ptr("/subscriptions/009f6022-67ec-423e-9aa7-691182870588/resourceGroups/EastUs/providers/microsoft.insights/metricAlerts/LeoAlert_custom1"), - // Properties: &armmonitor.MetricAlertStatusProperties{ - // Dimensions: map[string]*string{ - // "resourceId": to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme"), - // }, - // Status: to.Ptr("Healthy"), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-17T20:17:25.629Z"); return t}()), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertStatusByName.json -func ExampleMetricAlertsStatusClient_ListByName() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsStatusClient().ListByName(ctx, "EastUs", "custom1", "cmVzb3VyY2VJZD0vc3Vic2NyaXB0aW9ucy8xNGRkZjBjNS03N2M1LTRiNTMtODRmNi1lMWZhNDNhZDY4ZjcvcmVzb3VyY2VHcm91cHMvZ2lndGVzdC9wcm92aWRlcnMvTWljcm9zb2Z0LkNvbXB1dGUvdmlydHVhbE1hY2hpbmVzL2dpZ3dhZG1l", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertStatusCollection = armmonitor.MetricAlertStatusCollection{ - // Value: []*armmonitor.MetricAlertStatus{ - // { - // Name: to.Ptr("cmVzb3VyY2VJZD0vc3Vic2NyaXB0aW9ucy8xNGRkZjBjNS03N2M1LTRiNTMtODRmNi1lMWZhNDNhZDY4ZjcvcmVzb3VyY2VHcm91cHMvZ2lndGVzdC9wcm92aWRlcnMvTWljcm9zb2Z0LkNvbXB1dGUvdmlydHVhbE1hY2hpbmVzL2dpZ3dhZG1l"), - // Type: to.Ptr("Microsoft.Insights/metricAlerts/status"), - // ID: to.Ptr("/subscriptions/009f6022-67ec-423e-9aa7-691182870588/resourceGroups/EastUs/providers/microsoft.insights/metricAlerts/custom1"), - // Properties: &armmonitor.MetricAlertStatusProperties{ - // Dimensions: map[string]*string{ - // "resourceId": to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme"), - // }, - // Status: to.Ptr("Healthy"), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-17T20:17:25.629Z"); return t}()), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client.go b/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client.go index 0f7f6dc1ab0c..d928f8a21056 100644 --- a/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client.go @@ -28,7 +28,7 @@ type MetricDefinitionsClient struct { } // NewMetricDefinitionsClient creates a new instance of MetricDefinitionsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewMetricDefinitionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MetricDefinitionsClient, error) { @@ -45,7 +45,7 @@ func NewMetricDefinitionsClient(subscriptionID string, credential azcore.TokenCr // NewListPager - Lists the metric definitions for the resource. // -// Generated from API version 2021-05-01 +// Generated from API version 2024-02-01 // - resourceURI - The identifier of the resource. // - options - MetricDefinitionsClientListOptions contains the optional parameters for the MetricDefinitionsClient.NewListPager // method. @@ -82,7 +82,7 @@ func (client *MetricDefinitionsClient) listCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2024-02-01") if options != nil && options.Metricnamespace != nil { reqQP.Set("metricnamespace", *options.Metricnamespace) } @@ -102,7 +102,7 @@ func (client *MetricDefinitionsClient) listHandleResponse(resp *http.Response) ( // NewListAtSubscriptionScopePager - Lists the metric definitions for the subscription. // -// Generated from API version 2021-05-01 +// Generated from API version 2024-02-01 // - region - The region where the metrics you want reside. // - options - MetricDefinitionsClientListAtSubscriptionScopeOptions contains the optional parameters for the MetricDefinitionsClient.NewListAtSubscriptionScopePager // method. @@ -142,11 +142,11 @@ func (client *MetricDefinitionsClient) listAtSubscriptionScopeCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") - reqQP.Set("region", region) + reqQP.Set("api-version", "2024-02-01") if options != nil && options.Metricnamespace != nil { reqQP.Set("metricnamespace", *options.Metricnamespace) } + reqQP.Set("region", region) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client_example_test.go deleted file mode 100644 index 94630917f42d..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client_example_test.go +++ /dev/null @@ -1,7245 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMultiResourceMetricDefinitions.json -func ExampleMetricDefinitionsClient_NewListAtSubscriptionScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMetricDefinitionsClient().NewListAtSubscriptionScopePager("westus2", &armmonitor.MetricDefinitionsClientListAtSubscriptionScopeOptions{Metricnamespace: to.Ptr("microsoft.compute/virtualmachines")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SubscriptionScopeMetricDefinitionCollection = armmonitor.SubscriptionScopeMetricDefinitionCollection{ - // Value: []*armmonitor.SubscriptionScopeMetricDefinition{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Percentage CPU"), - // Value: to.Ptr("Percentage CPU"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("The percentage of allocated compute units that are currently in use by the Virtual Machine(s)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Percentage CPU"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Network In Billable (Deprecated)"), - // Value: to.Ptr("Network In"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("The number of billable bytes received on all network interfaces by the Virtual Machine(s) (Incoming Traffic) (Deprecated)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Network In"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeTotal), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Network Out Billable (Deprecated)"), - // Value: to.Ptr("Network Out"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("The number of billable bytes out on all network interfaces by the Virtual Machine(s) (Outgoing Traffic) (Deprecated)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Network Out"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeTotal), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Disk Read Bytes"), - // Value: to.Ptr("Disk Read Bytes"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Bytes read from disk during monitoring period"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Disk Read Bytes"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeTotal), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Disk Write Bytes"), - // Value: to.Ptr("Disk Write Bytes"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Bytes written to disk during monitoring period"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Disk Write Bytes"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeTotal), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Disk Read Operations/Sec"), - // Value: to.Ptr("Disk Read Operations/Sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Disk Read IOPS"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Disk Read Operations/Sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Disk Write Operations/Sec"), - // Value: to.Ptr("Disk Write Operations/Sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Disk Write IOPS"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Disk Write Operations/Sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("CPU Credits Remaining"), - // Value: to.Ptr("CPU Credits Remaining"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Total number of credits available to burst. Only available on B-series burstable VMs"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/CPU Credits Remaining"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("CPU Credits Consumed"), - // Value: to.Ptr("CPU Credits Consumed"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Total number of credits consumed by the Virtual Machine. Only available on B-series burstable VMs"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/CPU Credits Consumed"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Read Bytes/Sec"), - // Value: to.Ptr("Data Disk Read Bytes/sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Bytes/Sec read from a single disk during monitoring period"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Read Bytes/sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Write Bytes/Sec"), - // Value: to.Ptr("Data Disk Write Bytes/sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Bytes/Sec written to a single disk during monitoring period"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Write Bytes/sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Read Operations/Sec"), - // Value: to.Ptr("Data Disk Read Operations/Sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Read IOPS from a single disk during monitoring period"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Read Operations/Sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Write Operations/Sec"), - // Value: to.Ptr("Data Disk Write Operations/Sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Write IOPS from a single disk during monitoring period"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Write Operations/Sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Queue Depth"), - // Value: to.Ptr("Data Disk Queue Depth"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Data Disk Queue Depth(or Queue Length)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Queue Depth"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Bandwidth Consumed Percentage"), - // Value: to.Ptr("Data Disk Bandwidth Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of data disk bandwidth consumed per minute"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Bandwidth Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk IOPS Consumed Percentage"), - // Value: to.Ptr("Data Disk IOPS Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of data disk I/Os consumed per minute"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk IOPS Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Target Bandwidth"), - // Value: to.Ptr("Data Disk Target Bandwidth"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Baseline bytes per second throughput Data Disk can achieve without bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Target Bandwidth"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Target IOPS"), - // Value: to.Ptr("Data Disk Target IOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Baseline IOPS Data Disk can achieve without bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Target IOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Max Burst Bandwidth"), - // Value: to.Ptr("Data Disk Max Burst Bandwidth"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Maximum bytes per second throughput Data Disk can achieve with bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Max Burst Bandwidth"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Max Burst IOPS"), - // Value: to.Ptr("Data Disk Max Burst IOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Maximum IOPS Data Disk can achieve with bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Max Burst IOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Used Burst BPS Credits Percentage"), - // Value: to.Ptr("Data Disk Used Burst BPS Credits Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of Data Disk burst bandwidth credits used so far"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Used Burst BPS Credits Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Used Burst IO Credits Percentage"), - // Value: to.Ptr("Data Disk Used Burst IO Credits Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of Data Disk burst I/O credits used so far"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Used Burst IO Credits Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Read Bytes/Sec"), - // Value: to.Ptr("OS Disk Read Bytes/sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Bytes/Sec read from a single disk during monitoring period for OS disk"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Read Bytes/sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Write Bytes/Sec"), - // Value: to.Ptr("OS Disk Write Bytes/sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Bytes/Sec written to a single disk during monitoring period for OS disk"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Write Bytes/sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Read Operations/Sec"), - // Value: to.Ptr("OS Disk Read Operations/Sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Read IOPS from a single disk during monitoring period for OS disk"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Read Operations/Sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Write Operations/Sec"), - // Value: to.Ptr("OS Disk Write Operations/Sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Write IOPS from a single disk during monitoring period for OS disk"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Write Operations/Sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Queue Depth"), - // Value: to.Ptr("OS Disk Queue Depth"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("OS Disk Queue Depth(or Queue Length)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Queue Depth"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Bandwidth Consumed Percentage"), - // Value: to.Ptr("OS Disk Bandwidth Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of operating system disk bandwidth consumed per minute"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Bandwidth Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk IOPS Consumed Percentage"), - // Value: to.Ptr("OS Disk IOPS Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of operating system disk I/Os consumed per minute"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk IOPS Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Target Bandwidth"), - // Value: to.Ptr("OS Disk Target Bandwidth"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Baseline bytes per second throughput OS Disk can achieve without bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Target Bandwidth"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Target IOPS"), - // Value: to.Ptr("OS Disk Target IOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Baseline IOPS OS Disk can achieve without bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Target IOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Max Burst Bandwidth"), - // Value: to.Ptr("OS Disk Max Burst Bandwidth"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Maximum bytes per second throughput OS Disk can achieve with bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Max Burst Bandwidth"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Max Burst IOPS"), - // Value: to.Ptr("OS Disk Max Burst IOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Maximum IOPS OS Disk can achieve with bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Max Burst IOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Used Burst BPS Credits Percentage"), - // Value: to.Ptr("OS Disk Used Burst BPS Credits Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of OS Disk burst bandwidth credits used so far"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Used Burst BPS Credits Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Used Burst IO Credits Percentage"), - // Value: to.Ptr("OS Disk Used Burst IO Credits Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of OS Disk burst I/O credits used so far"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Used Burst IO Credits Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Inbound Flows"), - // Value: to.Ptr("Inbound Flows"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Inbound Flows are number of current flows in the inbound direction (traffic going into the VM)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Inbound Flows"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Outbound Flows"), - // Value: to.Ptr("Outbound Flows"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Outbound Flows are number of current flows in the outbound direction (traffic going out of the VM)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Outbound Flows"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Inbound Flows Maximum Creation Rate"), - // Value: to.Ptr("Inbound Flows Maximum Creation Rate"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("The maximum creation rate of inbound flows (traffic going into the VM)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Inbound Flows Maximum Creation Rate"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Outbound Flows Maximum Creation Rate"), - // Value: to.Ptr("Outbound Flows Maximum Creation Rate"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("The maximum creation rate of outbound flows (traffic going out of the VM)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Outbound Flows Maximum Creation Rate"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Premium Data Disk Cache Read Hit"), - // Value: to.Ptr("Premium Data Disk Cache Read Hit"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Premium Data Disk Cache Read Hit"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Premium Data Disk Cache Read Hit"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Premium Data Disk Cache Read Miss"), - // Value: to.Ptr("Premium Data Disk Cache Read Miss"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Premium Data Disk Cache Read Miss"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Premium Data Disk Cache Read Miss"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Premium OS Disk Cache Read Hit"), - // Value: to.Ptr("Premium OS Disk Cache Read Hit"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Premium OS Disk Cache Read Hit"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Premium OS Disk Cache Read Hit"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Premium OS Disk Cache Read Miss"), - // Value: to.Ptr("Premium OS Disk Cache Read Miss"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Premium OS Disk Cache Read Miss"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Premium OS Disk Cache Read Miss"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("VM Cached Bandwidth Consumed Percentage"), - // Value: to.Ptr("VM Cached Bandwidth Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of cached disk bandwidth consumed by the VM"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/VM Cached Bandwidth Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("VM Cached IOPS Consumed Percentage"), - // Value: to.Ptr("VM Cached IOPS Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of cached disk IOPS consumed by the VM"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/VM Cached IOPS Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("VM Uncached Bandwidth Consumed Percentage"), - // Value: to.Ptr("VM Uncached Bandwidth Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of uncached disk bandwidth consumed by the VM"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/VM Uncached Bandwidth Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("VM Uncached IOPS Consumed Percentage"), - // Value: to.Ptr("VM Uncached IOPS Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of uncached disk IOPS consumed by the VM"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/VM Uncached IOPS Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Network In Total"), - // Value: to.Ptr("Network In Total"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("The number of bytes received on all network interfaces by the Virtual Machine(s) (Incoming Traffic)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Network In Total"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeTotal), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Network Out Total"), - // Value: to.Ptr("Network Out Total"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("The number of bytes out on all network interfaces by the Virtual Machine(s) (Outgoing Traffic)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Network Out Total"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeTotal), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMetricDefinitionsApplicationInsights.json -func ExampleMetricDefinitionsClient_NewListPager_getApplicationInsightsMetricDefinitionsWithoutFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMetricDefinitionsClient().NewListPager("subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions", &armmonitor.MetricDefinitionsClientListOptions{Metricnamespace: to.Ptr("microsoft.insights/components")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricDefinitionCollection = armmonitor.MetricDefinitionCollection{ - // Value: []*armmonitor.MetricDefinition{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Availability"), - // Value: to.Ptr("availabilityResults/availabilityPercentage"), - // }, - // Category: to.Ptr("Availability"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Test name"), - // Value: to.Ptr("availabilityResult/name"), - // }, - // { - // LocalizedValue: to.Ptr("Run location"), - // Value: to.Ptr("availabilityResult/location"), - // }}, - // DisplayDescription: to.Ptr("Percentage of successfully completed availability tests"), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/availabilityResults/availabilityPercentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Availability tests"), - // Value: to.Ptr("availabilityResults/count"), - // }, - // Category: to.Ptr("Availability"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Test name"), - // Value: to.Ptr("availabilityResult/name"), - // }, - // { - // LocalizedValue: to.Ptr("Run location"), - // Value: to.Ptr("availabilityResult/location"), - // }, - // { - // LocalizedValue: to.Ptr("Test result"), - // Value: to.Ptr("availabilityResult/success"), - // }}, - // DisplayDescription: to.Ptr("Count of availability tests"), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/availabilityResults/count"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Availability test duration"), - // Value: to.Ptr("availabilityResults/duration"), - // }, - // Category: to.Ptr("Availability"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Test name"), - // Value: to.Ptr("availabilityResult/name"), - // }, - // { - // LocalizedValue: to.Ptr("Run location"), - // Value: to.Ptr("availabilityResult/location"), - // }, - // { - // LocalizedValue: to.Ptr("Test result"), - // Value: to.Ptr("availabilityResult/success"), - // }}, - // DisplayDescription: to.Ptr("Availability test duration"), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/availabilityResults/duration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Page load network connect time"), - // Value: to.Ptr("browserTimings/networkDuration"), - // }, - // Category: to.Ptr("Browser"), - // DisplayDescription: to.Ptr("Time between user request and network connection. Includes DNS lookup and transport connection."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/browserTimings/networkDuration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Client processing time"), - // Value: to.Ptr("browserTimings/processingDuration"), - // }, - // Category: to.Ptr("Browser"), - // DisplayDescription: to.Ptr("Time between receiving the last byte of a document until the DOM is loaded. Async requests may still be processing."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/browserTimings/processingDuration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Receiving response time"), - // Value: to.Ptr("browserTimings/receiveDuration"), - // }, - // Category: to.Ptr("Browser"), - // DisplayDescription: to.Ptr("Time between the first and last bytes, or until disconnection."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/browserTimings/receiveDuration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Send request time"), - // Value: to.Ptr("browserTimings/sendDuration"), - // }, - // Category: to.Ptr("Browser"), - // DisplayDescription: to.Ptr("Time between network connection and receiving the first byte."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/browserTimings/sendDuration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Browser page load time"), - // Value: to.Ptr("browserTimings/totalDuration"), - // }, - // Category: to.Ptr("Browser"), - // DisplayDescription: to.Ptr("Time from user request until DOM, stylesheets, scripts and images are loaded."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/browserTimings/totalDuration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Dependency calls"), - // Value: to.Ptr("dependencies/count"), - // }, - // Category: to.Ptr("Server"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Dependency type"), - // Value: to.Ptr("dependency/type"), - // }, - // { - // LocalizedValue: to.Ptr("Dependency performance"), - // Value: to.Ptr("dependency/performanceBucket"), - // }, - // { - // LocalizedValue: to.Ptr("Successful call"), - // Value: to.Ptr("dependency/success"), - // }, - // { - // LocalizedValue: to.Ptr("Target of a dependency call"), - // Value: to.Ptr("dependency/target"), - // }, - // { - // LocalizedValue: to.Ptr("Result code"), - // Value: to.Ptr("dependency/resultCode"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Count of calls made by the application to external resources."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/dependencies/count"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Dependency duration"), - // Value: to.Ptr("dependencies/duration"), - // }, - // Category: to.Ptr("Server"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Dependency type"), - // Value: to.Ptr("dependency/type"), - // }, - // { - // LocalizedValue: to.Ptr("Dependency performance"), - // Value: to.Ptr("dependency/performanceBucket"), - // }, - // { - // LocalizedValue: to.Ptr("Successful call"), - // Value: to.Ptr("dependency/success"), - // }, - // { - // LocalizedValue: to.Ptr("Target of a dependency call"), - // Value: to.Ptr("dependency/target"), - // }, - // { - // LocalizedValue: to.Ptr("Result code"), - // Value: to.Ptr("dependency/resultCode"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Duration of calls made by the application to external resources."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/dependencies/duration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Dependency call failures"), - // Value: to.Ptr("dependencies/failed"), - // }, - // Category: to.Ptr("Failures"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Dependency type"), - // Value: to.Ptr("dependency/type"), - // }, - // { - // LocalizedValue: to.Ptr("Dependency performance"), - // Value: to.Ptr("dependency/performanceBucket"), - // }, - // { - // LocalizedValue: to.Ptr("Target of a dependency call"), - // Value: to.Ptr("dependency/target"), - // }, - // { - // LocalizedValue: to.Ptr("Result code"), - // Value: to.Ptr("dependency/resultCode"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Count of failed dependency calls made by the application to external resources."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/dependencies/failed"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Page views"), - // Value: to.Ptr("pageViews/count"), - // }, - // Category: to.Ptr("Usage"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Count of page views."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/pageViews/count"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Page view load time"), - // Value: to.Ptr("pageViews/duration"), - // }, - // Category: to.Ptr("Usage"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Page view load time"), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/pageViews/duration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("HTTP request execution time"), - // Value: to.Ptr("performanceCounters/requestExecutionTime"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Execution time of the most recent request."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/requestExecutionTime"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("HTTP requests in application queue"), - // Value: to.Ptr("performanceCounters/requestsInQueue"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Length of the application request queue."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/requestsInQueue"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("HTTP request rate"), - // Value: to.Ptr("performanceCounters/requestsPerSecond"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Rate of all requests to the application per second from ASP.NET."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/requestsPerSecond"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Exception rate"), - // Value: to.Ptr("performanceCounters/exceptionsPerSecond"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Count of handled and unhandled exceptions reported to windows, including .NET exceptions and unmanaged exceptions that are converted into .NET exceptions."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/exceptionsPerSecond"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Process IO rate"), - // Value: to.Ptr("performanceCounters/processIOBytesPerSecond"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Total bytes per second read and written to files, network and devices."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/processIOBytesPerSecond"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Process CPU"), - // Value: to.Ptr("performanceCounters/processCpuPercentage"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("The percentage of elapsed time that all process threads used the processor to execute instructions. This can vary between 0 to 100. This metric indicates the performance of w3wp process alone."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/processCpuPercentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Processor time"), - // Value: to.Ptr("performanceCounters/processorCpuPercentage"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("The percentage of time that the processor spends in non-idle threads."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/processorCpuPercentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Available memory"), - // Value: to.Ptr("performanceCounters/memoryAvailableBytes"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Physical memory immediately available for allocation to a process or for system use."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/memoryAvailableBytes"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Process private bytes"), - // Value: to.Ptr("performanceCounters/processPrivateBytes"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Memory exclusively assigned to the monitored application's processes."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/processPrivateBytes"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Server response time"), - // Value: to.Ptr("requests/duration"), - // }, - // Category: to.Ptr("Server"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Request performance"), - // Value: to.Ptr("request/performanceBucket"), - // }, - // { - // LocalizedValue: to.Ptr("Result code"), - // Value: to.Ptr("request/resultCode"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Successful request"), - // Value: to.Ptr("request/success"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Time between receiving an HTTP request and finishing sending the response."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/requests/duration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Server requests"), - // Value: to.Ptr("requests/count"), - // }, - // Category: to.Ptr("Server"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Request performance"), - // Value: to.Ptr("request/performanceBucket"), - // }, - // { - // LocalizedValue: to.Ptr("Result code"), - // Value: to.Ptr("request/resultCode"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Successful request"), - // Value: to.Ptr("request/success"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Count of HTTP requests completed."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/requests/count"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Failed requests"), - // Value: to.Ptr("requests/failed"), - // }, - // Category: to.Ptr("Failures"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Request performance"), - // Value: to.Ptr("request/performanceBucket"), - // }, - // { - // LocalizedValue: to.Ptr("Result code"), - // Value: to.Ptr("request/resultCode"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Count of HTTP requests marked as failed. In most cases these are requests with a response code >= 400 and not equal to 401."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/requests/failed"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Server request rate"), - // Value: to.Ptr("requests/rate"), - // }, - // Category: to.Ptr("Server"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Request performance"), - // Value: to.Ptr("request/performanceBucket"), - // }, - // { - // LocalizedValue: to.Ptr("Result code"), - // Value: to.Ptr("request/resultCode"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Successful request"), - // Value: to.Ptr("request/success"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Rate of server requests per second"), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/requests/rate"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Exceptions"), - // Value: to.Ptr("exceptions/count"), - // }, - // Category: to.Ptr("Failures"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Device type"), - // Value: to.Ptr("client/type"), - // }}, - // DisplayDescription: to.Ptr("Combined count of all uncaught exceptions."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/exceptions/count"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Browser exceptions"), - // Value: to.Ptr("exceptions/browser"), - // }, - // Category: to.Ptr("Failures"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Count of uncaught exceptions thrown in the browser."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/exceptions/browser"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Server exceptions"), - // Value: to.Ptr("exceptions/server"), - // }, - // Category: to.Ptr("Failures"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Count of uncaught exceptions thrown in the server application."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/exceptions/server"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Traces"), - // Value: to.Ptr("traces/count"), - // }, - // Category: to.Ptr("Usage"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Severity level"), - // Value: to.Ptr("trace/severityLevel"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Trace document count"), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/traces/count"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMetricDefinitions.json -func ExampleMetricDefinitionsClient_NewListPager_getMetricDefinitionsWithoutFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMetricDefinitionsClient().NewListPager("subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricDefinitions", &armmonitor.MetricDefinitionsClientListOptions{Metricnamespace: to.Ptr("Microsoft.Web/sites")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricDefinitionCollection = armmonitor.MetricDefinitionCollection{ - // Value: []*armmonitor.MetricDefinition{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("CPU Time"), - // Value: to.Ptr("CpuTime"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/CpuTime"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Requests"), - // Value: to.Ptr("Requests"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Requests"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data In"), - // Value: to.Ptr("BytesReceived"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/BytesReceived"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Out"), - // Value: to.Ptr("BytesSent"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/BytesSent"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 101"), - // Value: to.Ptr("Http101"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http101"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 2xx"), - // Value: to.Ptr("Http2xx"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http2xx"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 3xx"), - // Value: to.Ptr("Http3xx"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http3xx"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 401"), - // Value: to.Ptr("Http401"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http401"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 403"), - // Value: to.Ptr("Http403"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http403"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 404"), - // Value: to.Ptr("Http404"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http404"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 406"), - // Value: to.Ptr("Http406"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http406"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 4xx"), - // Value: to.Ptr("Http4xx"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http4xx"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http Server Errors"), - // Value: to.Ptr("Http5xx"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http5xx"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Memory working set"), - // Value: to.Ptr("MemoryWorkingSet"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/MemoryWorkingSet"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Average memory working set"), - // Value: to.Ptr("AverageMemoryWorkingSet"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/AverageMemoryWorkingSet"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Average Response Time"), - // Value: to.Ptr("AverageResponseTime"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/AverageResponseTime"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitSeconds), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMetricDefinitionsMetricClass.json -func ExampleMetricDefinitionsClient_NewListPager_getStorageCacheMetricDefinitionsWithMetricClass() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMetricDefinitionsClient().NewListPager("subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache", &armmonitor.MetricDefinitionsClientListOptions{Metricnamespace: to.Ptr("microsoft.storagecache/caches")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricDefinitionCollection = armmonitor.MetricDefinitionCollection{ - // Value: []*armmonitor.MetricDefinition{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Total Client IOPS"), - // Value: to.Ptr("ClientIOPS"), - // }, - // DisplayDescription: to.Ptr("The rate of client file operations processed by the Cache."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Average Client Latency"), - // Value: to.Ptr("ClientLatency"), - // }, - // DisplayDescription: to.Ptr("Average latency of client file operations to the Cache."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientLatency"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassLatency), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Client Read IOPS"), - // Value: to.Ptr("ClientReadIOPS"), - // }, - // DisplayDescription: to.Ptr("Client read operations per second."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientReadIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Average Cache Read Throughput"), - // Value: to.Ptr("ClientReadThroughput"), - // }, - // DisplayDescription: to.Ptr("Client read data transfer rate."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientReadThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Client Write IOPS"), - // Value: to.Ptr("ClientWriteIOPS"), - // }, - // DisplayDescription: to.Ptr("Client write operations per second."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientWriteIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Average Cache Write Throughput"), - // Value: to.Ptr("ClientWriteThroughput"), - // }, - // DisplayDescription: to.Ptr("Client write data transfer rate."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientWriteThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Client Metadata Read IOPS"), - // Value: to.Ptr("ClientMetadataReadIOPS"), - // }, - // DisplayDescription: to.Ptr("The rate of client file operations sent to the Cache, excluding data reads, that do not modify persistent state."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientMetadataReadIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Client Metadata Write IOPS"), - // Value: to.Ptr("ClientMetadataWriteIOPS"), - // }, - // DisplayDescription: to.Ptr("The rate of client file operations sent to the Cache, excluding data writes, that modify persistent state."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientMetadataWriteIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Client Lock IOPS"), - // Value: to.Ptr("ClientLockIOPS"), - // }, - // DisplayDescription: to.Ptr("Client file locking operations per second."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientLockIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Storage Target Health"), - // Value: to.Ptr("StorageTargetHealth"), - // }, - // DisplayDescription: to.Ptr("Boolean results of connectivity test between the Cache and Storage Targets."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetHealth"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassErrors), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Uptime"), - // Value: to.Ptr("Uptime"), - // }, - // DisplayDescription: to.Ptr("Boolean results of connectivity test between the Cache and monitoring system."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/Uptime"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassAvailability), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Total StorageTarget IOPS"), - // Value: to.Ptr("StorageTargetIOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate of all file operations the Cache sends to a particular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Write IOPS"), - // Value: to.Ptr("StorageTargetWriteIOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate of the file write operations the Cache sends to a particular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetWriteIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Asynchronous Write Throughput"), - // Value: to.Ptr("StorageTargetAsyncWriteThroughput"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate the Cache asynchronously writes data to a particular StorageTarget. These are opportunistic writes that do not cause clients to block."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetAsyncWriteThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Synchronous Write Throughput"), - // Value: to.Ptr("StorageTargetSyncWriteThroughput"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate the Cache synchronously writes data to a particular StorageTarget. These are writes that do cause clients to block."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetSyncWriteThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Total Write Throughput"), - // Value: to.Ptr("StorageTargetTotalWriteThroughput"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The total rate that the Cache writes data to a particular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetTotalWriteThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Latency"), - // Value: to.Ptr("StorageTargetLatency"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The average round trip latency of all the file operations the Cache sends to a partricular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetLatency"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Metadata Read IOPS"), - // Value: to.Ptr("StorageTargetMetadataReadIOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate of file operations that do not modify persistent state, and excluding the read operation, that the Cache sends to a particular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetMetadataReadIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Metadata Write IOPS"), - // Value: to.Ptr("StorageTargetMetadataWriteIOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate of file operations that do modify persistent state and excluding the write operation, that the Cache sends to a particular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetMetadataWriteIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Read IOPS"), - // Value: to.Ptr("StorageTargetReadIOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate of file read operations the Cache sends to a particular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetReadIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Read Ahead Throughput"), - // Value: to.Ptr("StorageTargetReadAheadThroughput"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate the Cache opportunisticly reads data from the StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetReadAheadThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Fill Throughput"), - // Value: to.Ptr("StorageTargetFillThroughput"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate the Cache reads data from the StorageTarget to handle a cache miss."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetFillThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Total Read Throughput"), - // Value: to.Ptr("StorageTargetTotalReadThroughput"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The total rate that the Cache reads data from a particular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetTotalReadThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client.go b/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client.go index 2912562457a6..f23c5bab789e 100644 --- a/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client.go @@ -40,7 +40,7 @@ func NewMetricNamespacesClient(credential azcore.TokenCredential, options *arm.C // NewListPager - Lists the metric namespaces for the resource. // -// Generated from API version 2017-12-01-preview +// Generated from API version 2024-02-01 // - resourceURI - The identifier of the resource. // - options - MetricNamespacesClientListOptions contains the optional parameters for the MetricNamespacesClient.NewListPager // method. @@ -77,7 +77,7 @@ func (client *MetricNamespacesClient) listCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2017-12-01-preview") + reqQP.Set("api-version", "2024-02-01") if options != nil && options.StartTime != nil { reqQP.Set("startTime", *options.StartTime) } diff --git a/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client_example_test.go deleted file mode 100644 index 0ef141700996..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client_example_test.go +++ /dev/null @@ -1,65 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2017-12-01-preview/examples/GetMetricNamespaces.json -func ExampleMetricNamespacesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMetricNamespacesClient().NewListPager("subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill", &armmonitor.MetricNamespacesClientListOptions{StartTime: to.Ptr("2020-08-31T15:53:00Z")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricNamespaceCollection = armmonitor.MetricNamespaceCollection{ - // Value: []*armmonitor.MetricNamespace{ - // { - // Name: to.Ptr("Azure.ApplicationInsights"), - // Type: to.Ptr("Microsoft.Insights/metricNamespaces"), - // Classification: to.Ptr(armmonitor.NamespaceClassificationCustom), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricNamespaces/Azure.ApplicationInsights"), - // Properties: &armmonitor.MetricNamespaceName{ - // MetricNamespaceName: to.Ptr("Azure.ApplicationInsights"), - // }, - // }, - // { - // Name: to.Ptr("microsoft.insights-components"), - // Type: to.Ptr("Microsoft.Insights/metricNamespaces"), - // Classification: to.Ptr(armmonitor.NamespaceClassificationPlatform), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricNamespaces/microsoft.insights-components"), - // Properties: &armmonitor.MetricNamespaceName{ - // MetricNamespaceName: to.Ptr("microsoft.insights/components"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metrics_client.go b/sdk/resourcemanager/monitor/armmonitor/metrics_client.go index 97219fc6364d..676226f2302a 100644 --- a/sdk/resourcemanager/monitor/armmonitor/metrics_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/metrics_client.go @@ -29,7 +29,7 @@ type MetricsClient struct { } // NewMetricsClient creates a new instance of MetricsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewMetricsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MetricsClient, error) { @@ -47,7 +47,7 @@ func NewMetricsClient(subscriptionID string, credential azcore.TokenCredential, // List - Lists the metric values for a resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2024-02-01 // - resourceURI - The identifier of the resource. // - options - MetricsClientListOptions contains the optional parameters for the MetricsClient.List method. func (client *MetricsClient) List(ctx context.Context, resourceURI string, options *MetricsClientListOptions) (MetricsClientListResponse, error) { @@ -81,39 +81,42 @@ func (client *MetricsClient) listCreateRequest(ctx context.Context, resourceURI return nil, err } reqQP := req.Raw().URL.Query() - if options != nil && options.Timespan != nil { - reqQP.Set("timespan", *options.Timespan) + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.AutoAdjustTimegrain != nil { + reqQP.Set("AutoAdjustTimegrain", strconv.FormatBool(*options.AutoAdjustTimegrain)) } + if options != nil && options.ValidateDimensions != nil { + reqQP.Set("ValidateDimensions", strconv.FormatBool(*options.ValidateDimensions)) + } + if options != nil && options.Aggregation != nil { + reqQP.Set("aggregation", *options.Aggregation) + } + reqQP.Set("api-version", "2024-02-01") if options != nil && options.Interval != nil { reqQP.Set("interval", *options.Interval) } if options != nil && options.Metricnames != nil { reqQP.Set("metricnames", *options.Metricnames) } - if options != nil && options.Aggregation != nil { - reqQP.Set("aggregation", *options.Aggregation) - } - if options != nil && options.Top != nil { - reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) + if options != nil && options.Metricnamespace != nil { + reqQP.Set("metricnamespace", *options.Metricnamespace) } if options != nil && options.Orderby != nil { reqQP.Set("orderby", *options.Orderby) } - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } if options != nil && options.ResultType != nil { reqQP.Set("resultType", string(*options.ResultType)) } - reqQP.Set("api-version", "2021-05-01") - if options != nil && options.Metricnamespace != nil { - reqQP.Set("metricnamespace", *options.Metricnamespace) + if options != nil && options.Rollupby != nil { + reqQP.Set("rollupby", *options.Rollupby) } - if options != nil && options.AutoAdjustTimegrain != nil { - reqQP.Set("AutoAdjustTimegrain", strconv.FormatBool(*options.AutoAdjustTimegrain)) + if options != nil && options.Timespan != nil { + reqQP.Set("timespan", *options.Timespan) } - if options != nil && options.ValidateDimensions != nil { - reqQP.Set("ValidateDimensions", strconv.FormatBool(*options.ValidateDimensions)) + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} @@ -132,7 +135,7 @@ func (client *MetricsClient) listHandleResponse(resp *http.Response) (MetricsCli // ListAtSubscriptionScope - Lists the metric data for a subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2024-02-01 // - region - The region where the metrics you want reside. // - options - MetricsClientListAtSubscriptionScopeOptions contains the optional parameters for the MetricsClient.ListAtSubscriptionScope // method. @@ -170,40 +173,43 @@ func (client *MetricsClient) listAtSubscriptionScopeCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") - reqQP.Set("region", region) - if options != nil && options.Timespan != nil { - reqQP.Set("timespan", *options.Timespan) + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.AutoAdjustTimegrain != nil { + reqQP.Set("AutoAdjustTimegrain", strconv.FormatBool(*options.AutoAdjustTimegrain)) + } + if options != nil && options.ValidateDimensions != nil { + reqQP.Set("ValidateDimensions", strconv.FormatBool(*options.ValidateDimensions)) + } + if options != nil && options.Aggregation != nil { + reqQP.Set("aggregation", *options.Aggregation) } + reqQP.Set("api-version", "2024-02-01") if options != nil && options.Interval != nil { reqQP.Set("interval", *options.Interval) } if options != nil && options.Metricnames != nil { reqQP.Set("metricnames", *options.Metricnames) } - if options != nil && options.Aggregation != nil { - reqQP.Set("aggregation", *options.Aggregation) - } - if options != nil && options.Top != nil { - reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) + if options != nil && options.Metricnamespace != nil { + reqQP.Set("metricnamespace", *options.Metricnamespace) } if options != nil && options.Orderby != nil { reqQP.Set("orderby", *options.Orderby) } - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } + reqQP.Set("region", region) if options != nil && options.ResultType != nil { reqQP.Set("resultType", string(*options.ResultType)) } - if options != nil && options.Metricnamespace != nil { - reqQP.Set("metricnamespace", *options.Metricnamespace) + if options != nil && options.Rollupby != nil { + reqQP.Set("rollupby", *options.Rollupby) } - if options != nil && options.AutoAdjustTimegrain != nil { - reqQP.Set("AutoAdjustTimegrain", strconv.FormatBool(*options.AutoAdjustTimegrain)) + if options != nil && options.Timespan != nil { + reqQP.Set("timespan", *options.Timespan) } - if options != nil && options.ValidateDimensions != nil { - reqQP.Set("ValidateDimensions", strconv.FormatBool(*options.ValidateDimensions)) + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} @@ -213,7 +219,7 @@ func (client *MetricsClient) listAtSubscriptionScopeCreateRequest(ctx context.Co // listAtSubscriptionScopeHandleResponse handles the ListAtSubscriptionScope response. func (client *MetricsClient) listAtSubscriptionScopeHandleResponse(resp *http.Response) (MetricsClientListAtSubscriptionScopeResponse, error) { result := MetricsClientListAtSubscriptionScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionScopeMetricResponse); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.Response); err != nil { return MetricsClientListAtSubscriptionScopeResponse{}, err } return result, nil @@ -223,7 +229,7 @@ func (client *MetricsClient) listAtSubscriptionScopeHandleResponse(resp *http.Re // or the body. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2024-02-01 // - region - The region where the metrics you want reside. // - options - MetricsClientListAtSubscriptionScopePostOptions contains the optional parameters for the MetricsClient.ListAtSubscriptionScopePost // method. @@ -261,40 +267,43 @@ func (client *MetricsClient) listAtSubscriptionScopePostCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") - reqQP.Set("region", region) - if options != nil && options.Timespan != nil { - reqQP.Set("timespan", *options.Timespan) + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.AutoAdjustTimegrain != nil { + reqQP.Set("AutoAdjustTimegrain", strconv.FormatBool(*options.AutoAdjustTimegrain)) + } + if options != nil && options.ValidateDimensions != nil { + reqQP.Set("ValidateDimensions", strconv.FormatBool(*options.ValidateDimensions)) + } + if options != nil && options.Aggregation != nil { + reqQP.Set("aggregation", *options.Aggregation) } + reqQP.Set("api-version", "2024-02-01") if options != nil && options.Interval != nil { reqQP.Set("interval", *options.Interval) } if options != nil && options.Metricnames != nil { reqQP.Set("metricnames", *options.Metricnames) } - if options != nil && options.Aggregation != nil { - reqQP.Set("aggregation", *options.Aggregation) - } - if options != nil && options.Top != nil { - reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) + if options != nil && options.Metricnamespace != nil { + reqQP.Set("metricnamespace", *options.Metricnamespace) } if options != nil && options.Orderby != nil { reqQP.Set("orderby", *options.Orderby) } - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } + reqQP.Set("region", region) if options != nil && options.ResultType != nil { reqQP.Set("resultType", string(*options.ResultType)) } - if options != nil && options.Metricnamespace != nil { - reqQP.Set("metricnamespace", *options.Metricnamespace) + if options != nil && options.Rollupby != nil { + reqQP.Set("rollupby", *options.Rollupby) } - if options != nil && options.AutoAdjustTimegrain != nil { - reqQP.Set("AutoAdjustTimegrain", strconv.FormatBool(*options.AutoAdjustTimegrain)) + if options != nil && options.Timespan != nil { + reqQP.Set("timespan", *options.Timespan) } - if options != nil && options.ValidateDimensions != nil { - reqQP.Set("ValidateDimensions", strconv.FormatBool(*options.ValidateDimensions)) + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} @@ -310,7 +319,7 @@ func (client *MetricsClient) listAtSubscriptionScopePostCreateRequest(ctx contex // listAtSubscriptionScopePostHandleResponse handles the ListAtSubscriptionScopePost response. func (client *MetricsClient) listAtSubscriptionScopePostHandleResponse(resp *http.Response) (MetricsClientListAtSubscriptionScopePostResponse, error) { result := MetricsClientListAtSubscriptionScopePostResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionScopeMetricResponse); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.Response); err != nil { return MetricsClientListAtSubscriptionScopePostResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/monitor/armmonitor/metrics_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/metrics_client_example_test.go deleted file mode 100644 index fc968d5cc26c..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metrics_client_example_test.go +++ /dev/null @@ -1,1480 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMultiResourceMetric.json -func ExampleMetricsClient_ListAtSubscriptionScope_getSubscriptionLevelMetricData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricsClient().ListAtSubscriptionScope(ctx, "westus2", &armmonitor.MetricsClientListAtSubscriptionScopeOptions{Timespan: to.Ptr("2021-06-08T19:00:00Z/2021-06-12T01:00:00Z"), - Interval: to.Ptr("PT6H"), - Metricnames: to.Ptr("Data Disk Max Burst IOPS"), - Aggregation: to.Ptr("count"), - Top: to.Ptr[int32](10), - Orderby: to.Ptr("count desc"), - Filter: to.Ptr("LUN eq '0' and Microsoft.ResourceId eq '*'"), - ResultType: nil, - Metricnamespace: to.Ptr("microsoft.compute/virtualmachines"), - AutoAdjustTimegrain: to.Ptr(true), - ValidateDimensions: to.Ptr(false), - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SubscriptionScopeMetricResponse = armmonitor.SubscriptionScopeMetricResponse{ - // Cost: to.Ptr[int32](4679), - // Interval: to.Ptr("PT6H"), - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // Resourceregion: to.Ptr("westus2"), - // Timespan: to.Ptr("2021-06-08T19:00:00Z/2021-06-12T01:00:00Z"), - // Value: []*armmonitor.SubscriptionScopeMetric{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Max Burst IOPS"), - // Value: to.Ptr("Data Disk Max Burst IOPS"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // DisplayDescription: to.Ptr("Maximum IOPS Data Disk can achieve with bursting"), - // ErrorCode: to.Ptr("Success"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/Microsoft.Insights/metrics/Data Disk Max Burst IOPS"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](413), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas1/providers/Microsoft.Compute/virtualMachines/sas1-dev"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](133), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas2/providers/Microsoft.Compute/virtualMachines/sas2-vm"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](78), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas3/providers/Microsoft.Compute/virtualMachines/sas3-vm"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas4/providers/Microsoft.Compute/virtualMachines/sas4-vm"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas5/providers/Microsoft.Compute/virtualMachines/sas5-vm-asc"), - // }}, - // }}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMultiResourceMetricMetadata.json -func ExampleMetricsClient_ListAtSubscriptionScope_getSubscriptionLevelMetricMetadata() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricsClient().ListAtSubscriptionScope(ctx, "westus2", &armmonitor.MetricsClientListAtSubscriptionScopeOptions{Timespan: to.Ptr("2021-06-10T02:23:16.129Z/2021-06-12T02:23:16.129Z"), - Interval: nil, - Metricnames: to.Ptr("Data Disk Max Burst IOPS"), - Aggregation: nil, - Top: nil, - Orderby: nil, - Filter: to.Ptr("LUN eq '0'"), - ResultType: nil, - Metricnamespace: to.Ptr("microsoft.compute/virtualmachines"), - AutoAdjustTimegrain: nil, - ValidateDimensions: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SubscriptionScopeMetricResponse = armmonitor.SubscriptionScopeMetricResponse{ - // Interval: to.Ptr("PT1M"), - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // Resourceregion: to.Ptr("westus2"), - // Timespan: to.Ptr("2021-06-10T02:23:16Z/2021-06-12T02:23:16Z"), - // Value: []*armmonitor.SubscriptionScopeMetric{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Read Bytes/Sec"), - // Value: to.Ptr("Data Disk Read Bytes/sec"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // DisplayDescription: to.Ptr("Bytes/Sec read from a single disk during monitoring period"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/Microsoft.Insights/metrics/Data Disk Read Bytes/sec"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("lun"), - // Value: to.Ptr("lun"), - // }, - // Value: to.Ptr("0"), - // }}, - // }, - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("lun"), - // Value: to.Ptr("lun"), - // }, - // Value: to.Ptr("1"), - // }}, - // }}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/PostMultiResourceMetricBody.json -func ExampleMetricsClient_ListAtSubscriptionScopePost_postRequestForSubscriptionLevelMetricDataUsingBodyParams() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricsClient().ListAtSubscriptionScopePost(ctx, "westus2", &armmonitor.MetricsClientListAtSubscriptionScopePostOptions{Timespan: nil, - Interval: nil, - Metricnames: nil, - Aggregation: nil, - Top: nil, - Orderby: nil, - Filter: nil, - ResultType: nil, - Metricnamespace: nil, - AutoAdjustTimegrain: nil, - ValidateDimensions: nil, - Body: &armmonitor.SubscriptionScopeMetricsRequestBodyParameters{ - Aggregation: to.Ptr("count"), - AutoAdjustTimegrain: to.Ptr(true), - Filter: to.Ptr("LUN eq '0' and Microsoft.ResourceId eq '*'"), - Interval: to.Ptr("PT6H"), - MetricNames: to.Ptr("Data Disk Max Burst IOPS"), - MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - OrderBy: to.Ptr("count desc"), - RollUpBy: to.Ptr("LUN"), - Timespan: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "NaN-NaN-NaNTNaN:NaN:NaN.NaNZ"); return t }()), - Top: to.Ptr[int32](10), - ValidateDimensions: to.Ptr(false), - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SubscriptionScopeMetricResponse = armmonitor.SubscriptionScopeMetricResponse{ - // Cost: to.Ptr[int32](4679), - // Interval: to.Ptr("PT6H"), - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // Resourceregion: to.Ptr("westus2"), - // Timespan: to.Ptr("2021-06-08T19:00:00Z/2021-06-12T01:00:00Z"), - // Value: []*armmonitor.SubscriptionScopeMetric{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Max Burst IOPS"), - // Value: to.Ptr("Data Disk Max Burst IOPS"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // DisplayDescription: to.Ptr("Maximum IOPS Data Disk can achieve with bursting"), - // ErrorCode: to.Ptr("Success"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/Microsoft.Insights/metrics/Data Disk Max Burst IOPS"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](413), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas1/providers/Microsoft.Compute/virtualMachines/sas1-dev"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](133), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas2/providers/Microsoft.Compute/virtualMachines/sas2-vm"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](78), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas3/providers/Microsoft.Compute/virtualMachines/sas3-vm"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas4/providers/Microsoft.Compute/virtualMachines/sas4-vm"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas5/providers/Microsoft.Compute/virtualMachines/sas5-vm-asc"), - // }}, - // }}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMetric.json -func ExampleMetricsClient_List_getMetricForData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricsClient().List(ctx, "subscriptions/1f3fa6d2-851c-4a91-9087-1a050f3a9c38/resourceGroups/todking/providers/Microsoft.Storage/storageAccounts/tkfileserv/blobServices/default", &armmonitor.MetricsClientListOptions{Timespan: to.Ptr("2021-04-20T09:00:00.000Z/2021-04-20T14:00:00.000Z"), - Interval: to.Ptr("PT6H"), - Metricnames: to.Ptr("BlobCount,BlobCapacity"), - Aggregation: to.Ptr("average,minimum,maximum"), - Top: to.Ptr[int32](5), - Orderby: to.Ptr("average asc"), - Filter: to.Ptr("Tier eq '*'"), - ResultType: nil, - Metricnamespace: to.Ptr("Microsoft.Storage/storageAccounts/blobServices"), - AutoAdjustTimegrain: to.Ptr(true), - ValidateDimensions: to.Ptr(false), - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Response = armmonitor.Response{ - // Cost: to.Ptr[int32](598), - // Interval: to.Ptr("PT1H"), - // Namespace: to.Ptr("microsoft.storage/storageaccounts/blobservices"), - // Resourceregion: to.Ptr("westus2"), - // Timespan: to.Ptr("2021-04-20T09:00:00Z/2021-04-20T14:00:00Z"), - // Value: []*armmonitor.Metric{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Blob Count"), - // Value: to.Ptr("BlobCount"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // DisplayDescription: to.Ptr("The number of blob objects stored in the storage account."), - // ErrorCode: to.Ptr("Success"), - // ID: to.Ptr("/subscriptions/1f3fa6d2-851c-4a91-9087-1a050f3a9c38/resourceGroups/todking/providers/Microsoft.Storage/storageAccounts/tkfileserv/blobServices/default/providers/Microsoft.Insights/metrics/BlobCount"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](7), - // Maximum: to.Ptr[float64](7), - // Minimum: to.Ptr[float64](7), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](7), - // Maximum: to.Ptr[float64](7), - // Minimum: to.Ptr[float64](7), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](7), - // Maximum: to.Ptr[float64](7), - // Minimum: to.Ptr[float64](7), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](7), - // Maximum: to.Ptr[float64](7), - // Minimum: to.Ptr[float64](7), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](7), - // Maximum: to.Ptr[float64](7), - // Minimum: to.Ptr[float64](7), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Hot"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](2), - // Maximum: to.Ptr[float64](2), - // Minimum: to.Ptr[float64](2), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](2), - // Maximum: to.Ptr[float64](2), - // Minimum: to.Ptr[float64](2), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](2), - // Maximum: to.Ptr[float64](2), - // Minimum: to.Ptr[float64](2), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](2), - // Maximum: to.Ptr[float64](2), - // Minimum: to.Ptr[float64](2), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](2), - // Maximum: to.Ptr[float64](2), - // Minimum: to.Ptr[float64](2), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Standard"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Cool"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Archive"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Untiered"), - // }}, - // }}, - // Unit: to.Ptr(armmonitor.UnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Blob Capacity"), - // Value: to.Ptr("BlobCapacity"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // DisplayDescription: to.Ptr("The amount of storage used by the storage account’s Blob service in bytes."), - // ErrorCode: to.Ptr("Success"), - // ID: to.Ptr("/subscriptions/1f3fa6d2-851c-4a91-9087-1a050f3a9c38/resourceGroups/todking/providers/Microsoft.Storage/storageAccounts/tkfileserv/blobServices/default/providers/Microsoft.Insights/metrics/BlobCapacity"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](621492), - // Maximum: to.Ptr[float64](621492), - // Minimum: to.Ptr[float64](621492), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](621492), - // Maximum: to.Ptr[float64](621492), - // Minimum: to.Ptr[float64](621492), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](621492), - // Maximum: to.Ptr[float64](621492), - // Minimum: to.Ptr[float64](621492), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](621492), - // Maximum: to.Ptr[float64](621492), - // Minimum: to.Ptr[float64](621492), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](621492), - // Maximum: to.Ptr[float64](621492), - // Minimum: to.Ptr[float64](621492), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Standard"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](4733), - // Maximum: to.Ptr[float64](4733), - // Minimum: to.Ptr[float64](4733), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](4733), - // Maximum: to.Ptr[float64](4733), - // Minimum: to.Ptr[float64](4733), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](4733), - // Maximum: to.Ptr[float64](4733), - // Minimum: to.Ptr[float64](4733), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](4733), - // Maximum: to.Ptr[float64](4733), - // Minimum: to.Ptr[float64](4733), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](4733), - // Maximum: to.Ptr[float64](4733), - // Minimum: to.Ptr[float64](4733), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Hot"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Archive"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Untiered"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Cool"), - // }}, - // }}, - // Unit: to.Ptr(armmonitor.UnitBytes), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMetricMetadata.json -func ExampleMetricsClient_List_getMetricForMetadata() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricsClient().List(ctx, "subscriptions/1f3fa6d2-851c-4a91-9087-1a050f3a9c38/resourceGroups/todking/providers/Microsoft.Storage/storageAccounts/tkfileserv/blobServices/default", &armmonitor.MetricsClientListOptions{Timespan: to.Ptr("2017-04-14T02:20:00Z/2017-04-14T04:20:00Z"), - Interval: nil, - Metricnames: nil, - Aggregation: nil, - Top: nil, - Orderby: nil, - Filter: to.Ptr("Tier eq '*'"), - ResultType: nil, - Metricnamespace: to.Ptr("Microsoft.Storage/storageAccounts/blobServices"), - AutoAdjustTimegrain: nil, - ValidateDimensions: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Response = armmonitor.Response{ - // Interval: to.Ptr("PT1H"), - // Namespace: to.Ptr("microsoft.storage/storageaccounts/blobservices"), - // Resourceregion: to.Ptr("westus2"), - // Timespan: to.Ptr("2021-04-15T02:18:00Z/2021-04-22T02:18:00Z"), - // Value: []*armmonitor.Metric{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Blob Count"), - // Value: to.Ptr("BlobCount"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // DisplayDescription: to.Ptr("The number of blob objects stored in the storage account."), - // ID: to.Ptr("/subscriptions/1f3fa6d2-851c-4a91-9087-1a050f3a9c38/resourceGroups/todking/providers/Microsoft.Storage/storageAccounts/tkfileserv/blobServices/default/providers/Microsoft.Insights/metrics/BlobCount"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Cool"), - // }}, - // }, - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Archive"), - // }}, - // }, - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Standard"), - // }}, - // }, - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Untiered"), - // }}, - // }, - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Hot"), - // }}, - // }}, - // Unit: to.Ptr(armmonitor.UnitCount), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMetricError.json -func ExampleMetricsClient_List_getMetricWithError() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricsClient().List(ctx, "subscriptions/ac41e21f-afd6-4a79-8070-f01eba278f97/resourceGroups/todking/providers/Microsoft.DocumentDb/databaseAccounts/tk-cosmos-mongo", &armmonitor.MetricsClientListOptions{Timespan: to.Ptr("2021-06-07T21:51:00Z/2021-06-08T01:51:00Z"), - Interval: to.Ptr("FULL"), - Metricnames: to.Ptr("MongoRequestsCount,MongoRequests"), - Aggregation: to.Ptr("average"), - Top: nil, - Orderby: nil, - Filter: nil, - ResultType: nil, - Metricnamespace: to.Ptr("microsoft.documentdb/databaseaccounts"), - AutoAdjustTimegrain: to.Ptr(true), - ValidateDimensions: to.Ptr(false), - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Response = armmonitor.Response{ - // Cost: to.Ptr[int32](239), - // Interval: to.Ptr("PT4H"), - // Namespace: to.Ptr("microsoft.documentdb/databaseaccounts"), - // Resourceregion: to.Ptr("westus2"), - // Timespan: to.Ptr("2021-06-07T21:51:00Z/2021-06-08T01:51:00Z"), - // Value: []*armmonitor.Metric{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("(deprecated) Mongo Request Rate"), - // Value: to.Ptr("MongoRequestsCount"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // ErrorCode: to.Ptr("InvalidSamplingType"), - // ErrorMessage: to.Ptr("Sampling type is not found. Metric:CosmosDBCustomer,AzureMonitor,MongoRequests, SamplingType:NullableAverage."), - // ID: to.Ptr("/subscriptions/ac41e21f-afd6-4a79-8070-f01eba278f97/resourceGroups/todking/providers/Microsoft.DocumentDb/databaseAccounts/tk-cosmos-mongo/providers/Microsoft.Insights/metrics/MongoRequestsCount"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // }, - // Unit: to.Ptr(armmonitor.UnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Mongo Requests"), - // Value: to.Ptr("MongoRequests"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // DisplayDescription: to.Ptr("Number of Mongo Requests Made"), - // ErrorCode: to.Ptr("Success"), - // ID: to.Ptr("/subscriptions/ac41e21f-afd6-4a79-8070-f01eba278f97/resourceGroups/todking/providers/Microsoft.DocumentDb/databaseAccounts/tk-cosmos-mongo/providers/Microsoft.Insights/metrics/MongoRequests"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-07T21:51:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // }, - // }}, - // Unit: to.Ptr(armmonitor.UnitCount), - // }}, - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/models.go b/sdk/resourcemanager/monitor/armmonitor/models.go index 5857358098d6..31c371eab842 100644 --- a/sdk/resourcemanager/monitor/armmonitor/models.go +++ b/sdk/resourcemanager/monitor/armmonitor/models.go @@ -41,6 +41,45 @@ type AccessModeSettingsExclusion struct { QueryAccessMode *AccessMode } +// AccessRule - Access rule in a network security perimeter configuration profile +type AccessRule struct { + // Name of the access rule + Name *string + + // Properties of Access Rule + Properties *AccessRuleProperties +} + +// AccessRuleProperties - Properties of Access Rule +type AccessRuleProperties struct { + // Address prefixes in the CIDR format for inbound rules + AddressPrefixes []*string + + // Direction of Access Rule + Direction *AccessRuleDirection + + // Email addresses for outbound rules + EmailAddresses []*string + + // Fully qualified domain names (FQDN) for outbound rules + FullyQualifiedDomainNames []*string + + // Network security perimeters for inbound rules + NetworkSecurityPerimeters []*NetworkSecurityPerimeter + + // Phone numbers for outbound rules + PhoneNumbers []*string + + // Subscriptions for inbound rules + Subscriptions []*AccessRulePropertiesSubscriptionsItem +} + +// AccessRulePropertiesSubscriptionsItem - Subscription identifiers +type AccessRulePropertiesSubscriptionsItem struct { + // The fully qualified Azure resource ID of the subscription e.g. ('/subscriptions/00000000-0000-0000-0000-000000000000') + ID *string +} + // ActionDetail - The action detail type ActionDetail struct { // The detail of the friendly error message @@ -62,6 +101,27 @@ type ActionDetail struct { SubState *string } +// ActionDetailAutoGenerated - The action detail +type ActionDetailAutoGenerated struct { + // The mechanism type + MechanismType *string + + // The detail of the friendly error message + Message *string + + // The name of the action + Name *string + + // The send time + SendTime *string + + // The status of the action + Status *string + + // The substatus of the action + SubState *string +} + // ActionGroup - An Azure action group. type ActionGroup struct { // REQUIRED; Indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers @@ -90,6 +150,9 @@ type ActionGroup struct { // The list of event hub receivers that are part of this action group. EventHubReceivers []*EventHubReceiver + // The list of incident receivers that are part of this action group. + IncidentReceivers []*IncidentReceiver + // The list of ITSM receivers that are part of this action group. ItsmReceivers []*ItsmReceiver @@ -187,14 +250,16 @@ type Actions struct { // Action Group resource Ids to invoke when the alert fires. ActionGroups []*string + // The properties of an action properties. + ActionProperties map[string]*string + // The properties of an alert payload. CustomProperties map[string]*string } // ActivityLogAlertResource - An Activity Log Alert rule resource. type ActivityLogAlertResource struct { - // The location of the resource. Since Azure Activity Log Alerts is a global service, the location of the rules should always - // be 'global'. + // The location of the resource. Azure Activity Log Alert rules are supported on Global, West Europe and North Europe regions. Location *string // The Activity Log Alert rule properties of the resource. @@ -213,6 +278,37 @@ type ActivityLogAlertResource struct { Type *string } +// AdxDestination - Azure Data Explorer (Adx) destination. +type AdxDestination struct { + // The name of the database to which data will be ingested. + DatabaseName *string + + // A friendly name for the destination. This name should be unique across all destinations (regardless of type) within the + // data collection rule. + Name *string + + // The ARM resource id of the Adx resource. + ResourceID *string + + // READ-ONLY; The ingestion uri of the Adx resource. + IngestionURI *string +} + +// AgentSetting - A setting used to control an agent behavior on a host machine +type AgentSetting struct { + // The name of the setting. Must be part of the list of supported settings + Name *KnownAgentSettingName + + // The value of the setting + Value *string +} + +// AgentSettingsSpec - An agent setting +type AgentSettingsSpec struct { + // All the settings that are applicable to the logs agent (AMA) + Logs []*AgentSetting +} + // AlertRule - An alert rule. type AlertRule struct { // REQUIRED; the condition that results in the alert rule being activated. @@ -613,7 +709,7 @@ type AzureMonitorPrivateLinkScopeProperties struct { AccessModeSettings *AccessModeSettings // READ-ONLY; List of private endpoint connections. - PrivateEndpointConnections []*PrivateEndpointConnection + PrivateEndpointConnections []*PrivateEndpointConnectionAutoGenerated // 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 @@ -621,36 +717,42 @@ type AzureMonitorPrivateLinkScopeProperties struct { ProvisioningState *string } -// AzureMonitorWorkspace - Properties of an Azure Monitor workspace +// AzureMonitorWorkspace - Properties of an Azure Monitor Workspace type AzureMonitorWorkspace struct { - // READ-ONLY; The immutable ID of the Azure Monitor workspace. This property is read-only. + // Gets or sets allow or disallow public network access to Azure Monitor Workspace + PublicNetworkAccess *PublicNetworkAccess + + // READ-ONLY; The immutable Id of the Azure Monitor Workspace. This property is read-only. AccountID *string // READ-ONLY; The Data Collection Rule and Endpoint used for ingestion by default. DefaultIngestionSettings *AzureMonitorWorkspaceDefaultIngestionSettings - // READ-ONLY; Information about metrics for the Azure Monitor workspace + // READ-ONLY; Properties related to the metrics container in the Azure Monitor Workspace Metrics *AzureMonitorWorkspaceMetrics - // READ-ONLY; The provisioning state of the Azure Monitor workspace. Set to Succeeded if everything is healthy. + // READ-ONLY; List of private endpoint connections + PrivateEndpointConnections []*PrivateEndpointConnection + + // READ-ONLY; The provisioning state of the Azure Monitor Workspace. Set to Succeeded if everything is healthy. ProvisioningState *ProvisioningState } // AzureMonitorWorkspaceDefaultIngestionSettings - The Data Collection Rule and Endpoint used for ingestion by default. type AzureMonitorWorkspaceDefaultIngestionSettings struct { - // READ-ONLY; The Azure resource Id of the default data collection endpoint for this workspace. + // READ-ONLY; The Azure resource Id of the default data collection endpoint for this Azure Monitor Workspace. DataCollectionEndpointResourceID *string - // READ-ONLY; The Azure resource Id of the default data collection rule for this workspace. + // READ-ONLY; The Azure resource Id of the default data collection rule for this Azure Monitor Workspace. DataCollectionRuleResourceID *string } -// AzureMonitorWorkspaceMetrics - Information about metrics for the Azure Monitor workspace +// AzureMonitorWorkspaceMetrics - Properties related to the metrics container in the Azure Monitor Workspace type AzureMonitorWorkspaceMetrics struct { // READ-ONLY; An internal identifier for the metrics container. Only to be used by the system InternalID *string - // READ-ONLY; The Prometheus query endpoint for the workspace + // READ-ONLY; The Prometheus query endpoint for the Azure Monitor Workspace PrometheusQueryEndpoint *string } @@ -681,7 +783,7 @@ type AzureMonitorWorkspaceResource struct { Type *string } -// AzureMonitorWorkspaceResourceForUpdate - Definition of ARM tracked top level resource properties for update operation +// AzureMonitorWorkspaceResourceForUpdate - Definition of ARM tracked top level resource properties for the Update operation type AzureMonitorWorkspaceResourceForUpdate struct { // Resource tags Tags map[string]*string @@ -698,16 +800,22 @@ type AzureMonitorWorkspaceResourceListResult struct { // AzureMonitorWorkspaceResourceProperties - Resource properties type AzureMonitorWorkspaceResourceProperties struct { - // READ-ONLY; The immutable ID of the Azure Monitor workspace. This property is read-only. + // Gets or sets allow or disallow public network access to Azure Monitor Workspace + PublicNetworkAccess *PublicNetworkAccess + + // READ-ONLY; The immutable Id of the Azure Monitor Workspace. This property is read-only. AccountID *string // READ-ONLY; The Data Collection Rule and Endpoint used for ingestion by default. DefaultIngestionSettings *AzureMonitorWorkspaceDefaultIngestionSettings - // READ-ONLY; Information about metrics for the Azure Monitor workspace + // READ-ONLY; Properties related to the metrics container in the Azure Monitor Workspace Metrics *AzureMonitorWorkspaceMetrics - // READ-ONLY; The provisioning state of the Azure Monitor workspace. Set to Succeeded if everything is healthy. + // READ-ONLY; List of private endpoint connections + PrivateEndpointConnections []*PrivateEndpointConnection + + // READ-ONLY; The provisioning state of the Azure Monitor Workspace. Set to Succeeded if everything is healthy. ProvisioningState *ProvisioningState } @@ -731,8 +839,7 @@ type AzureResource struct { // AzureResourceAutoGenerated - An Azure resource object. type AzureResourceAutoGenerated struct { - // The location of the resource. Since Azure Activity Log Alerts is a global service, the location of the rules should always - // be 'global'. + // The location of the resource. Azure Activity Log Alert rules are supported on Global, West Europe and North Europe regions. Location *string // The tags of the resource. @@ -885,6 +992,9 @@ type DataCollectionEndpointMetadata struct { // READ-ONLY; Azure offering managing this resource on-behalf-of customer. ProvisionedBy *string + // READ-ONLY; Immutable Id of azure offering managing this resource on-behalf-of customer. + ProvisionedByImmutableID *string + // READ-ONLY; Resource Id of azure offering managing this resource on-behalf-of customer. ProvisionedByResourceID *string } @@ -1020,6 +1130,9 @@ type DataCollectionEndpointResourceSystemData struct { // DataCollectionRule - Definition of what monitoring data to collect and where that data should be sent. type DataCollectionRule struct { + // Agent settings used to modify agent behavior on a given host + AgentSettings *DataCollectionRuleAgentSettings + // The resource ID of the data collection endpoint that this rule can be used with. DataCollectionEndpointID *string @@ -1036,9 +1149,15 @@ type DataCollectionRule struct { // The specification of destinations. Destinations *DataCollectionRuleDestinations + // Defines all the references that may be used in other sections of the DCR + References *DataCollectionRuleReferences + // Declaration of custom streams used in this rule. StreamDeclarations map[string]*StreamDeclaration + // READ-ONLY; Defines the ingestion endpoints to send data to via this rule. + Endpoints *DataCollectionRuleEndpoints + // READ-ONLY; The immutable ID of this data collection rule. This property is READ-ONLY. ImmutableID *string @@ -1049,6 +1168,12 @@ type DataCollectionRule struct { ProvisioningState *KnownDataCollectionRuleProvisioningState } +// DataCollectionRuleAgentSettings - Agent settings used to modify agent behavior on a given host +type DataCollectionRuleAgentSettings struct { + // All the settings that are applicable to the logs agent (AMA) + Logs []*AgentSetting +} + // DataCollectionRuleAssociation - Definition of association of a data collection rule with a monitored Azure resource. type DataCollectionRuleAssociation struct { // The resource ID of the data collection endpoint that is to be associated. @@ -1072,6 +1197,9 @@ type DataCollectionRuleAssociationMetadata struct { // READ-ONLY; Azure offering managing this resource on-behalf-of customer. ProvisionedBy *string + // READ-ONLY; Immutable Id of azure offering managing this resource on-behalf-of customer. + ProvisionedByImmutableID *string + // READ-ONLY; Resource Id of azure offering managing this resource on-behalf-of customer. ProvisionedByResourceID *string } @@ -1182,6 +1310,9 @@ type DataCollectionRuleDataSources struct { // DataCollectionRuleDestinations - The specification of destinations. type DataCollectionRuleDestinations struct { + // List of Azure Data Explorer destinations. + AzureDataExplorer []*AdxDestination + // Azure Monitor Metrics destination. AzureMonitorMetrics *DestinationsSpecAzureMonitorMetrics @@ -1194,6 +1325,9 @@ type DataCollectionRuleDestinations struct { // List of Log Analytics destinations. LogAnalytics []*LogAnalyticsDestination + // List of Microsoft Fabric destinations. + MicrosoftFabric []*MicrosoftFabricDestination + // List of monitoring account destinations. MonitoringAccounts []*MonitoringAccountDestination @@ -1207,15 +1341,33 @@ type DataCollectionRuleDestinations struct { StorageTablesDirect []*StorageTableDestination } +// DataCollectionRuleEndpoints - Defines the ingestion endpoints to send data to via this rule. +type DataCollectionRuleEndpoints struct { + // READ-ONLY; The ingestion endpoint for logs + LogsIngestion *string + + // READ-ONLY; The ingestion endpoint for metrics + MetricsIngestion *string +} + // DataCollectionRuleMetadata - Metadata about the resource type DataCollectionRuleMetadata struct { // READ-ONLY; Azure offering managing this resource on-behalf-of customer. ProvisionedBy *string + // READ-ONLY; Immutable Id of azure offering managing this resource on-behalf-of customer. + ProvisionedByImmutableID *string + // READ-ONLY; Resource Id of azure offering managing this resource on-behalf-of customer. ProvisionedByResourceID *string } +// DataCollectionRuleReferences - Defines all the references that may be used in other sections of the DCR +type DataCollectionRuleReferences struct { + // All the enrichment data sources referenced in data flows + EnrichmentData *ReferencesSpecEnrichmentData +} + // DataCollectionRuleResource - Definition of ARM tracked top level resource. type DataCollectionRuleResource struct { // REQUIRED; The geo-location where the resource lives. @@ -1280,6 +1432,9 @@ type DataCollectionRuleResourceListResult struct { // DataCollectionRuleResourceProperties - Resource properties. type DataCollectionRuleResourceProperties struct { + // Agent settings used to modify agent behavior on a given host + AgentSettings *DataCollectionRuleAgentSettings + // The resource ID of the data collection endpoint that this rule can be used with. DataCollectionEndpointID *string @@ -1296,9 +1451,15 @@ type DataCollectionRuleResourceProperties struct { // The specification of destinations. Destinations *DataCollectionRuleDestinations + // Defines all the references that may be used in other sections of the DCR + References *DataCollectionRuleReferences + // Declaration of custom streams used in this rule. StreamDeclarations map[string]*StreamDeclaration + // READ-ONLY; Defines the ingestion endpoints to send data to via this rule. + Endpoints *DataCollectionRuleEndpoints + // READ-ONLY; The immutable ID of this data collection rule. This property is READ-ONLY. ImmutableID *string @@ -1341,6 +1502,9 @@ type DataFlow struct { // The builtIn transform to transform stream data BuiltInTransform *string + // Flag to enable overflow column in LA destinations + CaptureOverflow *bool + // List of destinations for this data flow. Destinations []*string @@ -1415,11 +1579,14 @@ type DataSourcesSpecDataImports struct { // (This also follows the OData error response format.). type DefaultErrorResponse struct { // The error object. - Error *ErrorDetail + Error *ErrorDetailAutoGenerated2 } // DestinationsSpec - Specification of destinations that can be used in data flows. type DestinationsSpec struct { + // List of Azure Data Explorer destinations. + AzureDataExplorer []*AdxDestination + // Azure Monitor Metrics destination. AzureMonitorMetrics *DestinationsSpecAzureMonitorMetrics @@ -1432,6 +1599,9 @@ type DestinationsSpec struct { // List of Log Analytics destinations. LogAnalytics []*LogAnalyticsDestination + // List of Microsoft Fabric destinations. + MicrosoftFabric []*MicrosoftFabricDestination + // List of monitoring account destinations. MonitoringAccounts []*MonitoringAccountDestination @@ -1668,6 +1838,21 @@ type EnableRequest struct { ReceiverName *string } +// EndpointsSpec - This defines all the ingestion endpoints that can be used by this rule +type EndpointsSpec struct { + // READ-ONLY; The ingestion endpoint for logs + LogsIngestion *string + + // READ-ONLY; The ingestion endpoint for metrics + MetricsIngestion *string +} + +// EnrichmentData - All the enrichment data sources referenced in data flows +type EnrichmentData struct { + // All the storage blobs used as enrichment data sources + StorageBlobs []*StorageBlob +} + // Error details. type Error struct { // REQUIRED; Error code identifying the specific error. @@ -1690,13 +1875,7 @@ type ErrorAdditionalInfo struct { // (This also follows the OData error response format.) type ErrorContract struct { // The error object. - Error *ErrorResponse -} - -// ErrorContractAutoGenerated - Describes the format of Error response. -type ErrorContractAutoGenerated struct { - // The error details. - Error *ErrorResponseDetails + Error *ErrorResponseAutoGenerated2 } // ErrorDetail - The error detail. @@ -1735,8 +1914,33 @@ type ErrorDetailAutoGenerated struct { Target *string } -// ErrorResponse - Describes the format of Error response. +// ErrorDetailAutoGenerated2 - The error detail. +type ErrorDetailAutoGenerated2 struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo + + // READ-ONLY; The error code. + Code *string + + // READ-ONLY; The error details. + Details []*ErrorDetailAutoGenerated2 + + // READ-ONLY; The error message. + Message *string + + // READ-ONLY; The error target. + Target *string +} + +// 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 { + // The error object. + Error *ErrorDetail +} + +// ErrorResponseAutoGenerated - Describes the format of Error response. +type ErrorResponseAutoGenerated struct { // Error code Code *string @@ -1744,62 +1948,60 @@ type ErrorResponse struct { Message *string } -// ErrorResponseAdditionalInfo - The resource management error additional info. -type ErrorResponseAdditionalInfo struct { - // READ-ONLY; The additional info. - Info any - - // READ-ONLY; The additional info type. - Type *string -} +// ErrorResponseAutoGenerated2 - 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 ErrorResponseAutoGenerated2 struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo -// ErrorResponseAutoGenerated - The error response. -type ErrorResponseAutoGenerated struct { // READ-ONLY; The error code. Code *string - // READ-ONLY; The error message indicating why the operation failed. + // READ-ONLY; The error details. + Details []*ErrorResponseAutoGenerated2 + + // READ-ONLY; The error message. Message *string + + // READ-ONLY; The error target. + Target *string } -// ErrorResponseAutoGenerated2 - Common error response for all Azure Resource Manager APIs to return error details for failed +// ErrorResponseAutoGenerated3 - 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 ErrorResponseAutoGenerated2 struct { +type ErrorResponseAutoGenerated3 struct { // The error object. Error *ErrorDetailAutoGenerated } -// 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 { +// ErrorResponseAutoGenerated4 - 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 ErrorResponseAutoGenerated4 struct { // The error object. - Error *ErrorDetail + Error *ErrorDetailAutoGenerated2 } -// ErrorResponseDetails - 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 ErrorResponseDetails struct { - // READ-ONLY; The error additional info. - AdditionalInfo []*ErrorResponseAdditionalInfo - +// ErrorResponseAutoGenerated5 - The error response. +type ErrorResponseAutoGenerated5 struct { // READ-ONLY; The error code. Code *string - // READ-ONLY; The error details. - Details []*ErrorResponseDetails - - // READ-ONLY; The error message. + // READ-ONLY; The error message indicating why the operation failed. Message *string +} - // READ-ONLY; The error target. - Target *string +// 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 { + // The error object. + Error *ErrorDetailAutoGenerated2 } // EventCategoryCollection - A collection of event categories. Currently possible values are: Administrative, Security, ServiceHealth, // Alert, Recommendation, Policy. type EventCategoryCollection struct { // REQUIRED; the list that includes the Azure event categories. - Value []*LocalizableString + Value []*LocalizableStringAutoGenerated } // EventData - The Azure event log entries are of type EventData @@ -1811,7 +2013,7 @@ type EventData struct { Caller *string // READ-ONLY; the event category. - Category *LocalizableString + Category *LocalizableStringAutoGenerated // READ-ONLY; key value pairs to identify ARM permissions. Claims map[string]*string @@ -1828,7 +2030,7 @@ type EventData struct { // 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 + EventName *LocalizableStringAutoGenerated // 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. @@ -1849,7 +2051,7 @@ type EventData struct { OperationID *string // READ-ONLY; the operation name. - OperationName *LocalizableString + OperationName *LocalizableStringAutoGenerated // READ-ONLY; the set of pairs (usually a Dictionary) that includes details about the event. Properties map[string]*string @@ -1861,21 +2063,21 @@ type EventData struct { ResourceID *string // READ-ONLY; the resource provider name of the impacted resource. - ResourceProviderName *LocalizableString + ResourceProviderName *LocalizableStringAutoGenerated // READ-ONLY; the resource type - ResourceType *LocalizableString + ResourceType *LocalizableStringAutoGenerated // READ-ONLY; a string describing the status of the operation. Some typical values are: Started, In progress, Succeeded, Failed, // Resolved. - Status *LocalizableString + Status *LocalizableStringAutoGenerated // 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 + SubStatus *LocalizableStringAutoGenerated // 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 @@ -2022,6 +2224,9 @@ type IisLogsDataSource struct { // 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 + + // The KQL query to transform the data source. + TransformKql *string } // Incident - An alert incident indicates the activation status of an alert rule. @@ -2048,12 +2253,36 @@ type IncidentListResult struct { Value []*Incident } +// IncidentReceiver - An Incident receiver. +type IncidentReceiver struct { + // REQUIRED; The incident service connection + Connection *IncidentServiceConnection + + // REQUIRED; The incident management service type + IncidentManagementService *IncidentManagementService + + // REQUIRED; Field mappings for the incident service + Mappings map[string]*string + + // REQUIRED; The name of the Incident receiver. Names must be unique across all receivers within an action group. + Name *string +} + +// IncidentServiceConnection - The connection info for Incident Receiver. +type IncidentServiceConnection struct { + // REQUIRED; GUID value representing the connection ID for the incident management service. + ID *string + + // REQUIRED; The name of the connection. + Name *string +} + // IngestionSettings - Settings for data ingestion type IngestionSettings struct { - // READ-ONLY; The Azure resource Id of the default data collection endpoint for this workspace. + // READ-ONLY; The Azure resource Id of the default data collection endpoint for this Azure Monitor Workspace. DataCollectionEndpointResourceID *string - // READ-ONLY; The Azure resource Id of the default data collection rule for this workspace. + // READ-ONLY; The Azure resource Id of the default data collection rule for this Azure Monitor Workspace. DataCollectionRuleResourceID *string } @@ -2078,6 +2307,15 @@ type ItsmReceiver struct { // LocalizableString - The localizable string class. type LocalizableString struct { + // REQUIRED; The invariant value. + Value *string + + // The display name. + LocalizedValue *string +} + +// LocalizableStringAutoGenerated - The localizable string class. +type LocalizableStringAutoGenerated struct { // REQUIRED; the invariant value. Value *string @@ -2168,6 +2406,9 @@ type LogFilesDataSource struct { // The log files specific settings. Settings *LogFilesDataSourceSettings + + // The KQL query to transform the data source. + TransformKql *string } // LogFilesDataSourceSettings - The log files specific settings. @@ -2335,35 +2576,38 @@ type Metadata struct { // READ-ONLY; Azure offering managing this resource on-behalf-of customer. ProvisionedBy *string + // READ-ONLY; Immutable Id of azure offering managing this resource on-behalf-of customer. + ProvisionedByImmutableID *string + // READ-ONLY; Resource Id of azure offering managing this resource on-behalf-of customer. ProvisionedByResourceID *string } // MetadataValue - Represents a metric metadata value. type MetadataValue struct { - // the name of the metadata. + // The name of the metadata. Name *LocalizableString - // the value of the metadata. + // The value of the metadata. Value *string } // Metric - The result data of a query. type Metric struct { - // REQUIRED; the metric Id. + // REQUIRED; The metric Id. ID *string - // REQUIRED; the name and the display name of the metric, i.e. it is localizable string. + // REQUIRED; The name and the display name of the metric, i.e. it is localizable string. Name *LocalizableString - // REQUIRED; the time series returned when a data query is performed. + // REQUIRED; The time series returned when a data query is performed. Timeseries []*TimeSeriesElement - // REQUIRED; the resource type of the metric resource. + // REQUIRED; The resource type of the metric resource. Type *string // REQUIRED; The unit of the metric. - Unit *Unit + Unit *MetricUnit // Detailed description of this metric. DisplayDescription *string @@ -2596,10 +2840,10 @@ type MetricAlertStatusProperties struct { // MetricAvailability - Metric availability specifies the time grain (aggregation interval or frequency) and the retention // period for that time grain. type MetricAvailability struct { - // the retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. + // The retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. Retention *string - // the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. + // The time grain specifies a supported aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. TimeGrain *string } @@ -2680,46 +2924,46 @@ type MetricDefinition struct { // Custom category name for this metric. Category *string - // the name and the display name of the dimension, i.e. it is a localizable string. + // The name and the display name of the dimension, i.e. it is a localizable string. Dimensions []*LocalizableString // Detailed description of this metric. DisplayDescription *string - // the resource identifier of the metric definition. + // The resource identifier of the metric definition. ID *string // Flag to indicate whether the dimension is required. IsDimensionRequired *bool - // the collection of what aggregation intervals are available to be queried. + // The collection of what aggregation intervals are available to be queried. MetricAvailabilities []*MetricAvailability // The class of the metric. MetricClass *MetricClass - // the name and the display name of the metric, i.e. it is a localizable string. + // The name and the display name of the metric, i.e. it is a localizable string. Name *LocalizableString - // the namespace the metric belongs to. + // The namespace the metric belongs to. Namespace *string - // the primary aggregation type value defining how to use the values for display. + // The primary aggregation type value defining how to use the values for display. PrimaryAggregationType *AggregationType - // the resource identifier of the resource that emitted the metric. + // The resource identifier of the resource that emitted the metric. ResourceID *string - // the collection of what aggregation types are supported. + // The collection of what aggregation types are supported. SupportedAggregationTypes []*AggregationType - // the unit of the metric. + // The unit of the metric. Unit *MetricUnit } // MetricDefinitionCollection - Represents collection of metric definitions. type MetricDefinitionCollection struct { - // REQUIRED; the values for the metric definitions. + // REQUIRED; The values for the metric definitions. Value []*MetricDefinition } @@ -2834,32 +3078,32 @@ type MetricTrigger struct { // MetricValue - Represents a metric value. type MetricValue struct { - // REQUIRED; the timestamp for the metric value in ISO 8601 format. + // REQUIRED; The timestamp for the metric value in ISO 8601 format. TimeStamp *time.Time - // the average value in the time range. + // The average value in the time range. Average *float64 - // the number of samples in the time range. Can be used to determine the number of values that contributed to the average + // 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 - // the greatest value in the time range. + // The greatest value in the time range. Maximum *float64 - // the least value in the time range. + // The least value in the time range. Minimum *float64 - // the sum of all of the values in the time range. + // The sum of all of the values in the time range. Total *float64 } -// Metrics - Information about metrics for the workspace +// Metrics - Properties related to the metrics container in the Azure Monitor Workspace type Metrics struct { // READ-ONLY; An internal identifier for the metrics container. Only to be used by the system InternalID *string - // READ-ONLY; The Prometheus query endpoint for the workspace + // READ-ONLY; The Prometheus query endpoint for the Azure Monitor Workspace PrometheusQueryEndpoint *string } @@ -2869,6 +3113,25 @@ type MetricsIngestionEndpointSpec struct { Endpoint *string } +// MicrosoftFabricDestination - Microsoft Fabric destination (non-Azure). +type MicrosoftFabricDestination struct { + // The artifact id of the Microsoft Fabric resource. + ArtifactID *string + + // The name of the database to which data will be ingested. + DatabaseName *string + + // The ingestion uri of the Microsoft Fabric resource. + IngestionURI *string + + // A friendly name for the destination. This name should be unique across all destinations (regardless of type) within the + // data collection rule. + Name *string + + // The tenant id of the Microsoft Fabric resource. + TenantID *string +} + // MonitoringAccountDestination - Monitoring account destination. type MonitoringAccountDestination struct { // The resource ID of the monitoring account. @@ -2918,6 +3181,81 @@ type NetworkRuleSet struct { PublicNetworkAccess *KnownPublicNetworkAccessOptions } +// NetworkSecurityPerimeter - Information about a network security perimeter (NSP) +type NetworkSecurityPerimeter struct { + // Fully qualified Azure resource ID of the NSP resource + ID *string + + // Location of the network security perimeter + Location *string + + // Universal unique ID (UUID) of the network security perimeter + PerimeterGUID *string +} + +// NetworkSecurityPerimeterConfiguration - Network security perimeter (NSP) configuration resource +type NetworkSecurityPerimeterConfiguration struct { + // Network security configuration properties. + Properties *NetworkSecurityPerimeterConfigurationProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// NetworkSecurityPerimeterConfigurationListResult - Result of a list NSP (network security perimeter) configurations request. +type NetworkSecurityPerimeterConfigurationListResult struct { + // The link used to get the next page of results. + NextLink *string + + // Array of network security perimeter results. + Value []*NetworkSecurityPerimeterConfiguration +} + +// NetworkSecurityPerimeterConfigurationProperties - Network security configuration properties. +type NetworkSecurityPerimeterConfigurationProperties struct { + // Information about a network security perimeter (NSP) + NetworkSecurityPerimeter *NetworkSecurityPerimeter + + // Network security perimeter configuration profile + Profile *NetworkSecurityProfile + + // Information about resource association + ResourceAssociation *ResourceAssociation + + // READ-ONLY; List of provisioning issues, if any + ProvisioningIssues []*ProvisioningIssue + + // READ-ONLY; Provisioning state of a network security perimeter configuration that is being created or updated. + ProvisioningState *NetworkSecurityPerimeterConfigurationProvisioningState +} + +// NetworkSecurityProfile - Network security perimeter configuration profile +type NetworkSecurityProfile struct { + // List of Access Rules + AccessRules []*AccessRule + + // Current access rules version + AccessRulesVersion *int32 + + // Current diagnostic settings version + DiagnosticSettingsVersion *int32 + + // List of log categories that are enabled + EnabledLogCategories []*string + + // Name of the profile + Name *string +} + // NotificationRequestBody - The request body which contain contact detail metadata type NotificationRequestBody struct { // REQUIRED; The value of the supported alert type. Supported alert type values are: servicehealth, metricstaticthreshold, @@ -2944,6 +3282,9 @@ type NotificationRequestBody struct { // The list of event hub receivers that are part of this action group. EventHubReceivers []*EventHubReceiver + // The list of incident receivers that are part of this action group. + IncidentReceivers []*IncidentReceiver + // The list of ITSM receivers that are part of this action group. ItsmReceivers []*ItsmReceiver @@ -2960,19 +3301,10 @@ type NotificationRequestBody struct { WebhookReceivers []*WebhookReceiver } -// Operation - Microsoft Insights API operation definition. +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { - // Display metadata associated with the operation. - Display *OperationDisplay - - // Operation name: {provider}/{resource}/{operation} - Name *string -} - -// OperationAutoGenerated - Details of a REST API operation, returned from the Resource Provider Operations API -type OperationAutoGenerated struct { // Localized display information for this particular operation. - Display *OperationDisplayAutoGenerated + Display *OperationDisplay // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. ActionType *ActionType @@ -2990,20 +3322,17 @@ type OperationAutoGenerated struct { Origin *Origin } -// OperationDisplay - Display metadata associated with the operation. -type OperationDisplay struct { - // Operation type: Read, write, delete, etc. - Operation *string - - // Service provider: Microsoft.Insights - Provider *string +// OperationAutoGenerated - Microsoft Insights API operation definition. +type OperationAutoGenerated struct { + // Display metadata associated with the operation. + Display *OperationDisplayAutoGenerated - // Resource on which the operation is performed: AlertRules, Autoscale, etc. - Resource *string + // Operation name: {provider}/{resource}/{operation} + Name *string } -// OperationDisplayAutoGenerated - Localized display information for this particular operation. -type OperationDisplayAutoGenerated struct { +// OperationDisplay - Localized display information for this particular operation. +type OperationDisplay struct { // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. Description *string @@ -3020,23 +3349,35 @@ type OperationDisplayAutoGenerated struct { Resource *string } -// 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. +// OperationDisplayAutoGenerated - Display metadata associated with the operation. +type OperationDisplayAutoGenerated struct { + // Operation type: Read, write, delete, etc. + Operation *string + + // Service provider: Microsoft.Insights + Provider *string + + // Resource on which the operation is performed: AlertRules, Autoscale, etc. + Resource *string +} + +// OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to +// get the next set of results. type OperationListResult struct { - // URL to get the next set of operation list results if there are any. + // READ-ONLY; URL to get the next set of operation list results (if there are any). NextLink *string - // List of operations supported by the Microsoft.Insights provider. + // READ-ONLY; List of operations supported by the resource provider Value []*Operation } -// OperationListResultAutoGenerated - A list of REST API operations supported by an Azure Resource Provider. It contains an -// URL link to get the next set of results. +// OperationListResultAutoGenerated - 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 OperationListResultAutoGenerated struct { - // READ-ONLY; URL to get the next set of operation list results (if there are any). + // URL to get the next set of operation list results if there are any. NextLink *string - // READ-ONLY; List of operations supported by the resource provider + // List of operations supported by the Microsoft.Insights provider. Value []*OperationAutoGenerated } @@ -3046,7 +3387,7 @@ type OperationStatus struct { EndTime *time.Time // The error detail of the operation if any. - Error *ErrorDetail + Error *ErrorDetailAutoGenerated2 // The operation Id. ID *string @@ -3079,6 +3420,9 @@ type PerfCounterDataSource struct { // 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 + + // The KQL query to transform the data source. + TransformKql *string } // PlatformTelemetryDataSource - Definition of platform telemetry data source configuration @@ -3132,17 +3476,41 @@ type PredictiveValue struct { Value *float64 } -// PrivateEndpoint - The Private Endpoint resource. +// PrivateEndpoint - The private endpoint resource. type PrivateEndpoint struct { + // READ-ONLY; The ARM identifier for private endpoint. + ID *string +} + +// PrivateEndpointAutoGenerated - The Private Endpoint resource. +type PrivateEndpointAutoGenerated struct { // READ-ONLY; The ARM identifier for Private Endpoint ID *string } -// PrivateEndpointConnection - The Private Endpoint Connection resource. +// PrivateEndpointConnection - The private endpoint connection resource. type PrivateEndpointConnection struct { // Resource properties. Properties *PrivateEndpointConnectionProperties + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// PrivateEndpointConnectionAutoGenerated - The Private Endpoint Connection resource. +type PrivateEndpointConnectionAutoGenerated struct { + // Resource properties. + Properties *PrivateEndpointConnectionPropertiesAutoGenerated + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string @@ -3156,18 +3524,33 @@ type PrivateEndpointConnection struct { // PrivateEndpointConnectionListResult - List of private endpoint connection associated with the specified storage account type PrivateEndpointConnectionListResult struct { // Array of private endpoint connections - Value []*PrivateEndpointConnection + Value []*PrivateEndpointConnectionAutoGenerated } -// PrivateEndpointConnectionProperties - Properties of the PrivateEndpointConnectProperties. +// PrivateEndpointConnectionProperties - Properties of the private endpoint connection. type PrivateEndpointConnectionProperties struct { // REQUIRED; A collection of information about the state of the connection between service consumer and provider. PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState - // The resource of private end point. + // The private endpoint resource. PrivateEndpoint *PrivateEndpoint - // READ-ONLY; The provisioning state of the private endpoint connection resource. + // The provisioning state of the private endpoint connection resource. + ProvisioningState *PrivateEndpointConnectionProvisioningState + + // READ-ONLY; The group ids for the private endpoint resource. + GroupIDs []*string +} + +// PrivateEndpointConnectionPropertiesAutoGenerated - Properties of the PrivateEndpointConnectProperties. +type PrivateEndpointConnectionPropertiesAutoGenerated struct { + // REQUIRED; A collection of information about the state of the connection between service consumer and provider. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState + + // The resource of private end point. + PrivateEndpoint *PrivateEndpointAutoGenerated + + // The provisioning state of the private endpoint connection resource. ProvisioningState *PrivateEndpointConnectionProvisioningState } @@ -3240,8 +3623,56 @@ type PrometheusForwarderDataSource struct { Streams []*KnownPrometheusForwarderDataSourceStreams } -// ProxyResource - An azure resource object +// ProvisioningIssue - Describes a provisioning issue for a network security perimeter configuration +type ProvisioningIssue struct { + // READ-ONLY; Name of the issue + Name *string + + // READ-ONLY; Details of a provisioning issue for a network security perimeter (NSP) configuration. Resource providers should + // generate separate provisioning issue elements for each separate issue detected, and + // include a meaningful and distinctive description, as well as any appropriate suggestedResourceIds and suggestedAccessRules + Properties *ProvisioningIssueProperties +} + +// ProvisioningIssueProperties - Details of a provisioning issue for a network security perimeter (NSP) configuration. Resource +// providers should generate separate provisioning issue elements for each separate issue detected, and +// include a meaningful and distinctive description, as well as any appropriate suggestedResourceIds and suggestedAccessRules +type ProvisioningIssueProperties struct { + // READ-ONLY; Description of the issue + Description *string + + // READ-ONLY; Type of issue + IssueType *IssueType + + // READ-ONLY; Severity of the issue. + Severity *Severity + + // READ-ONLY; Access rules that can be added to the network security profile (NSP) to remediate the issue. + SuggestedAccessRules []*AccessRule + + // READ-ONLY; Fully qualified resource IDs of suggested resources that can be associated to the network security perimeter + // (NSP) to remediate the issue. + SuggestedResourceIDs []*string +} + +// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a +// location type ProxyResource struct { + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ProxyResourceAutoGenerated - An azure resource object +type ProxyResourceAutoGenerated struct { // READ-ONLY; Azure resource Id ID *string @@ -3252,9 +3683,9 @@ type ProxyResource struct { Type *string } -// ProxyResourceAutoGenerated - The resource model definition for a Azure Resource Manager proxy resource. It will not have +// ProxyResourceAutoGenerated2 - The resource model definition for a Azure Resource Manager proxy resource. It will not have // tags and a location -type ProxyResourceAutoGenerated struct { +type ProxyResourceAutoGenerated2 struct { // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string @@ -3318,8 +3749,74 @@ type RecurrentSchedule struct { TimeZone *string } -// Resource - The autoscale setting resource. +// ReferencesSpec - This section defines all the references that may be used in other sections of the DCR +type ReferencesSpec struct { + // All the enrichment data sources referenced in data flows + EnrichmentData *ReferencesSpecEnrichmentData +} + +// ReferencesSpecEnrichmentData - All the enrichment data sources referenced in data flows +type ReferencesSpecEnrichmentData struct { + // All the storage blobs used as enrichment data sources + StorageBlobs []*StorageBlob +} + +// Resource - Common fields that are returned in the response for all Azure Resource Manager resources type Resource struct { + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ResourceAssociation - Information about resource association +type ResourceAssociation struct { + // Access mode of the resource association + AccessMode *ResourceAssociationAccessMode + + // Name of the resource association + Name *string +} + +// ResourceAutoGenerated - Common fields that are returned in the response for all Azure Resource Manager resources +type ResourceAutoGenerated struct { + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ResourceAutoGenerated2 - Common fields that are returned in the response for all Azure Resource Manager resources +type ResourceAutoGenerated2 struct { + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ResourceAutoGenerated3 - The autoscale setting resource. +type ResourceAutoGenerated3 struct { // REQUIRED; Resource location Location *string @@ -3341,8 +3838,8 @@ type Resource struct { Type *string } -// ResourceAutoGenerated - An azure resource object -type ResourceAutoGenerated struct { +// ResourceAutoGenerated4 - An azure resource object +type ResourceAutoGenerated4 struct { // REQUIRED; Resource location Location *string @@ -3359,8 +3856,8 @@ type ResourceAutoGenerated struct { Type *string } -// ResourceAutoGenerated2 - An azure resource object -type ResourceAutoGenerated2 struct { +// ResourceAutoGenerated5 - An azure resource object +type ResourceAutoGenerated5 struct { // REQUIRED; Resource location Location *string @@ -3377,8 +3874,8 @@ type ResourceAutoGenerated2 struct { Type *string } -// ResourceAutoGenerated3 - Common fields that are returned in the response for all Azure Resource Manager resources -type ResourceAutoGenerated3 struct { +// ResourceAutoGenerated6 - Common fields that are returned in the response for all Azure Resource Manager resources +type ResourceAutoGenerated6 struct { // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string @@ -3389,8 +3886,8 @@ type ResourceAutoGenerated3 struct { Type *string } -// ResourceAutoGenerated4 - An azure resource object -type ResourceAutoGenerated4 struct { +// ResourceAutoGenerated7 - An azure resource object +type ResourceAutoGenerated7 struct { // REQUIRED; Resource location Location *string @@ -3407,21 +3904,6 @@ type ResourceAutoGenerated4 struct { Type *string } -// ResourceAutoGenerated5 - Common fields that are returned in the response for all Azure Resource Manager resources -type ResourceAutoGenerated5 struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string - - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - // ResourceForUpdate - Definition of ARM tracked top level resource properties for update operation. type ResourceForUpdate struct { // Managed Service Identity. @@ -3458,15 +3940,16 @@ type Response struct { // requested. Timespan *string - // REQUIRED; the value of the collection. + // REQUIRED; The value of the collection. Value []*Metric // The integer value representing the relative cost of the query. Cost *int32 - // 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. + // The interval (window size) for which the metric data was returned in ISO 8601 duration format with a special case for 'FULL' + // value that returns single datapoint for entire time span requested ( + // Examples: PT15M, PT1H, P1D, FULL). This may be adjusted and different from what was originally requested if AutoAdjustTimegrain=true + // is specified. This is not present if a metadata request was made. Interval *string // The namespace of the metrics being queried @@ -3779,9 +4262,6 @@ type ScheduledQueryRuleProperties struct { // of the kind LogAlert. OverrideQueryTimeRange *string - // This determines if traffic is allowed over public network. By default it is enabled. - PublicNetworkAccess *PublicNetworkAccess - // Defines the configuration for resolving fired alerts. Relevant only for rules of the kind LogAlert. RuleResolveConfiguration *RuleResolveConfiguration @@ -3980,6 +4460,20 @@ type SmsReceiverAutoGenerated struct { Status *ReceiverStatus } +type StorageBlob struct { + // Url of the storage blob + BlobURL *string + + // The type of lookup to perform on the blob + LookupType *KnownStorageBlobLookupType + + // The name of the enrichment data source used as an alias when referencing this data source in data flows + Name *string + + // Resource Id of the storage account that hosts the blob + ResourceID *string +} + type StorageBlobDestination struct { // The container name of the Storage Blob. ContainerName *string @@ -4010,72 +4504,45 @@ type StreamDeclaration struct { Columns []*ColumnDefinition } -// SubscriptionScopeMetric - The result data of a query. -type SubscriptionScopeMetric struct { - // REQUIRED; the metric Id. - ID *string - - // REQUIRED; the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString - - // REQUIRED; the time series returned when a data query is performed. - Timeseries []*TimeSeriesElement - - // REQUIRED; the resource type of the metric resource. - Type *string - - // REQUIRED; The unit of the metric. - Unit *MetricUnit - - // Detailed description of this metric. - DisplayDescription *string - - // 'Success' or the error details on query failures for this metric. - ErrorCode *string - - // Error message encountered querying this specific metric. - ErrorMessage *string -} - // SubscriptionScopeMetricDefinition - Metric definition class specifies the metadata for a metric. type SubscriptionScopeMetricDefinition struct { // Custom category name for this metric. Category *string - // the name and the display name of the dimension, i.e. it is a localizable string. + // The name and the display name of the dimension, i.e. it is a localizable string. Dimensions []*LocalizableString // Detailed description of this metric. DisplayDescription *string - // the resource identifier of the metric definition. + // The resource identifier of the metric definition. ID *string // Flag to indicate whether the dimension is required. IsDimensionRequired *bool - // the collection of what aggregation intervals are available to be queried. + // The collection of what aggregation intervals are available to be queried. MetricAvailabilities []*MetricAvailability // The class of the metric. MetricClass *MetricClass - // the name and the display name of the metric, i.e. it is a localizable string. + // The name and the display name of the metric, i.e. it is a localizable string. Name *LocalizableString - // the namespace the metric belongs to. + // The namespace the metric belongs to. Namespace *string - // the primary aggregation type value defining how to use the values for display. + // The primary aggregation type value defining how to use the values for display. PrimaryAggregationType *MetricAggregationType - // the resource identifier of the resource that emitted the metric. + // The resource identifier of the resource that emitted the metric. ResourceID *string - // the collection of what aggregation types are supported. + // The collection of what aggregation types are supported. SupportedAggregationTypes []*MetricAggregationType - // the unit of the metric. + // The unit of the metric. Unit *MetricUnit } @@ -4085,31 +4552,6 @@ type SubscriptionScopeMetricDefinitionCollection struct { Value []*SubscriptionScopeMetricDefinition } -// SubscriptionScopeMetricResponse - The response to a subscription scope metrics query. -type SubscriptionScopeMetricResponse struct { - // REQUIRED; The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by - // '/'. This may be adjusted in the future and returned back from what was originally - // requested. - Timespan *string - - // REQUIRED; the value of the collection. - Value []*SubscriptionScopeMetric - - // The integer value representing the relative cost of the query. - Cost *int32 - - // 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 - - // The namespace of the metrics being queried - Namespace *string - - // The region of the resource being queried for metrics. - Resourceregion *string -} - // 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 { @@ -4135,7 +4577,9 @@ type SubscriptionScopeMetricsRequestBodyParameters struct { // $filter=A eq ‘a1’ and B eq ‘’ and C eq ‘’. Filter *string - // The interval (i.e. timegrain) of the query. + // The interval (i.e. timegrain) of the query in ISO 8601 duration format. Defaults to PT1M. Special case for 'FULL' value + // that returns single datapoint for entire time span requested.Examples: PT15M, + // PT1H, P1D, FULL Interval *string // The names of the metrics (comma separated) to retrieve. @@ -4157,7 +4601,7 @@ type SubscriptionScopeMetricsRequestBodyParameters struct { RollUpBy *string // The timespan of the query. It is a string with the following format 'startDateTimeISO/endDateTimeISO'. - Timespan *time.Time + Timespan *string // The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10. Top *int32 @@ -4183,6 +4627,9 @@ type SyslogDataSource struct { // 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 + + // The KQL query to transform the data source. + TransformKql *string } // SystemData - Metadata pertaining to creation and last modification of the resource. @@ -4268,6 +4715,27 @@ type TenantActionGroupResource struct { Type *string } +// TenantNotificationRequestBody - The request body which contain contact detail metadata +type TenantNotificationRequestBody struct { + // REQUIRED; The value of the supported alert type. Supported alert type value is: servicehealth + AlertType *string + + // The list of AzureAppPush receivers that are part of this action group. + AzureAppPushReceivers []*AzureAppPushReceiverAutoGenerated + + // The list of email receivers that are part of this action group. + EmailReceivers []*EmailReceiverAutoGenerated + + // The list of SMS receivers that are part of this action group. + SmsReceivers []*SmsReceiverAutoGenerated + + // The list of voice receivers that are part of this action group. + VoiceReceivers []*VoiceReceiverAutoGenerated + + // The list of webhook receivers that are part of this action group. + WebhookReceivers []*WebhookReceiverAutoGenerated +} + // TestNotificationDetailsResponse - The details of the test notification results. type TestNotificationDetailsResponse struct { // REQUIRED; The overall state @@ -4286,6 +4754,24 @@ type TestNotificationDetailsResponse struct { CreatedTime *string } +// TestNotificationDetailsResponseAutoGenerated - The details of the test notification results. +type TestNotificationDetailsResponseAutoGenerated struct { + // REQUIRED; The overall state + State *string + + // The list of action detail + ActionDetails []*ActionDetailAutoGenerated + + // The completed time + CompletedTime *string + + // The context info + Context *Context + + // The created time + CreatedTime *string +} + // ThresholdRuleCondition - A rule condition based on a metric crossing a threshold. type ThresholdRuleCondition struct { // REQUIRED; specifies the type of condition. This can be one of three types: ManagementEventRuleCondition (occurrences of @@ -4342,7 +4828,7 @@ type TimeSeriesElement struct { // An array of data points representing the metric values. This is only returned if a result type of data is specified. Data []*MetricValue - // the metadata values returned if $filter was specified in the call. + // The metadata values returned if $filter was specified in the call. Metadatavalues []*MetadataValue } @@ -4400,6 +4886,9 @@ type TrackedResource struct { // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -4419,9 +4908,6 @@ type TrackedResourceAutoGenerated struct { // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -4594,6 +5080,9 @@ type WindowsEventLogDataSource struct { // what table in Log Analytics the data will be sent to. Streams []*KnownWindowsEventLogDataSourceStreams + // The KQL query to transform the data source. + TransformKql *string + // A list of Windows Event Log queries in XPATH format. XPathQueries []*string } @@ -4606,6 +5095,9 @@ type WindowsFirewallLogsDataSource struct { // 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 + + // Firewall logs profile filter + ProfileFilter []*KnownWindowsFirewallLogsDataSourceProfileFilter } // WorkspaceInfo - Information about a Log Analytics Workspace. diff --git a/sdk/resourcemanager/monitor/armmonitor/models_serde.go b/sdk/resourcemanager/monitor/armmonitor/models_serde.go index 2f4c598b5226..780b18cf59fd 100644 --- a/sdk/resourcemanager/monitor/armmonitor/models_serde.go +++ b/sdk/resourcemanager/monitor/armmonitor/models_serde.go @@ -86,6 +86,115 @@ func (a *AccessModeSettingsExclusion) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AccessRule. +func (a AccessRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessRule. +func (a *AccessRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AccessRuleProperties. +func (a AccessRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "addressPrefixes", a.AddressPrefixes) + populate(objectMap, "direction", a.Direction) + populate(objectMap, "emailAddresses", a.EmailAddresses) + populate(objectMap, "fullyQualifiedDomainNames", a.FullyQualifiedDomainNames) + populate(objectMap, "networkSecurityPerimeters", a.NetworkSecurityPerimeters) + populate(objectMap, "phoneNumbers", a.PhoneNumbers) + populate(objectMap, "subscriptions", a.Subscriptions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessRuleProperties. +func (a *AccessRuleProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addressPrefixes": + err = unpopulate(val, "AddressPrefixes", &a.AddressPrefixes) + delete(rawMsg, key) + case "direction": + err = unpopulate(val, "Direction", &a.Direction) + delete(rawMsg, key) + case "emailAddresses": + err = unpopulate(val, "EmailAddresses", &a.EmailAddresses) + delete(rawMsg, key) + case "fullyQualifiedDomainNames": + err = unpopulate(val, "FullyQualifiedDomainNames", &a.FullyQualifiedDomainNames) + delete(rawMsg, key) + case "networkSecurityPerimeters": + err = unpopulate(val, "NetworkSecurityPerimeters", &a.NetworkSecurityPerimeters) + delete(rawMsg, key) + case "phoneNumbers": + err = unpopulate(val, "PhoneNumbers", &a.PhoneNumbers) + delete(rawMsg, key) + case "subscriptions": + err = unpopulate(val, "Subscriptions", &a.Subscriptions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AccessRulePropertiesSubscriptionsItem. +func (a AccessRulePropertiesSubscriptionsItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessRulePropertiesSubscriptionsItem. +func (a *AccessRulePropertiesSubscriptionsItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ActionDetail. func (a ActionDetail) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -133,6 +242,53 @@ func (a *ActionDetail) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ActionDetailAutoGenerated. +func (a ActionDetailAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "mechanismType", a.MechanismType) + populate(objectMap, "message", a.Message) + populate(objectMap, "name", a.Name) + populate(objectMap, "sendTime", a.SendTime) + populate(objectMap, "status", a.Status) + populate(objectMap, "subState", a.SubState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActionDetailAutoGenerated. +func (a *ActionDetailAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "mechanismType": + err = unpopulate(val, "MechanismType", &a.MechanismType) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &a.Message) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "sendTime": + err = unpopulate(val, "SendTime", &a.SendTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &a.Status) + delete(rawMsg, key) + case "subState": + err = unpopulate(val, "SubState", &a.SubState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ActionGroup. func (a ActionGroup) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -144,6 +300,7 @@ func (a ActionGroup) MarshalJSON() ([]byte, error) { populate(objectMap, "enabled", a.Enabled) populate(objectMap, "eventHubReceivers", a.EventHubReceivers) populate(objectMap, "groupShortName", a.GroupShortName) + populate(objectMap, "incidentReceivers", a.IncidentReceivers) populate(objectMap, "itsmReceivers", a.ItsmReceivers) populate(objectMap, "logicAppReceivers", a.LogicAppReceivers) populate(objectMap, "smsReceivers", a.SmsReceivers) @@ -185,6 +342,9 @@ func (a *ActionGroup) UnmarshalJSON(data []byte) error { case "groupShortName": err = unpopulate(val, "GroupShortName", &a.GroupShortName) delete(rawMsg, key) + case "incidentReceivers": + err = unpopulate(val, "IncidentReceivers", &a.IncidentReceivers) + delete(rawMsg, key) case "itsmReceivers": err = unpopulate(val, "ItsmReceivers", &a.ItsmReceivers) delete(rawMsg, key) @@ -464,6 +624,7 @@ func (a *ActionList) UnmarshalJSON(data []byte) error { func (a Actions) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "actionGroups", a.ActionGroups) + populate(objectMap, "actionProperties", a.ActionProperties) populate(objectMap, "customProperties", a.CustomProperties) return json.Marshal(objectMap) } @@ -480,6 +641,9 @@ func (a *Actions) UnmarshalJSON(data []byte) error { case "actionGroups": err = unpopulate(val, "ActionGroups", &a.ActionGroups) delete(rawMsg, key) + case "actionProperties": + err = unpopulate(val, "ActionProperties", &a.ActionProperties) + delete(rawMsg, key) case "customProperties": err = unpopulate(val, "CustomProperties", &a.CustomProperties) delete(rawMsg, key) @@ -538,6 +702,103 @@ func (a *ActivityLogAlertResource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AdxDestination. +func (a AdxDestination) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "databaseName", a.DatabaseName) + populate(objectMap, "ingestionUri", a.IngestionURI) + populate(objectMap, "name", a.Name) + populate(objectMap, "resourceId", a.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdxDestination. +func (a *AdxDestination) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "databaseName": + err = unpopulate(val, "DatabaseName", &a.DatabaseName) + delete(rawMsg, key) + case "ingestionUri": + err = unpopulate(val, "IngestionURI", &a.IngestionURI) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &a.ResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AgentSetting. +func (a AgentSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", a.Name) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentSetting. +func (a *AgentSetting) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AgentSettingsSpec. +func (a AgentSettingsSpec) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "logs", a.Logs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentSettingsSpec. +func (a *AgentSettingsSpec) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "logs": + err = unpopulate(val, "Logs", &a.Logs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type AlertRule. func (a AlertRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1584,7 +1845,9 @@ func (a AzureMonitorWorkspace) MarshalJSON() ([]byte, error) { populate(objectMap, "accountId", a.AccountID) populate(objectMap, "defaultIngestionSettings", a.DefaultIngestionSettings) populate(objectMap, "metrics", a.Metrics) + populate(objectMap, "privateEndpointConnections", a.PrivateEndpointConnections) populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "publicNetworkAccess", a.PublicNetworkAccess) return json.Marshal(objectMap) } @@ -1606,9 +1869,15 @@ func (a *AzureMonitorWorkspace) UnmarshalJSON(data []byte) error { case "metrics": err = unpopulate(val, "Metrics", &a.Metrics) delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &a.PrivateEndpointConnections) + delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &a.PublicNetworkAccess) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -1798,7 +2067,9 @@ func (a AzureMonitorWorkspaceResourceProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "accountId", a.AccountID) populate(objectMap, "defaultIngestionSettings", a.DefaultIngestionSettings) populate(objectMap, "metrics", a.Metrics) + populate(objectMap, "privateEndpointConnections", a.PrivateEndpointConnections) populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "publicNetworkAccess", a.PublicNetworkAccess) return json.Marshal(objectMap) } @@ -1820,9 +2091,15 @@ func (a *AzureMonitorWorkspaceResourceProperties) UnmarshalJSON(data []byte) err case "metrics": err = unpopulate(val, "Metrics", &a.Metrics) delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &a.PrivateEndpointConnections) + delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &a.PublicNetworkAccess) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -2279,6 +2556,7 @@ func (d *DataCollectionEndpointLogsIngestion) UnmarshalJSON(data []byte) error { func (d DataCollectionEndpointMetadata) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "provisionedBy", d.ProvisionedBy) + populate(objectMap, "provisionedByImmutableId", d.ProvisionedByImmutableID) populate(objectMap, "provisionedByResourceId", d.ProvisionedByResourceID) return json.Marshal(objectMap) } @@ -2295,6 +2573,9 @@ func (d *DataCollectionEndpointMetadata) UnmarshalJSON(data []byte) error { case "provisionedBy": err = unpopulate(val, "ProvisionedBy", &d.ProvisionedBy) delete(rawMsg, key) + case "provisionedByImmutableId": + err = unpopulate(val, "ProvisionedByImmutableID", &d.ProvisionedByImmutableID) + delete(rawMsg, key) case "provisionedByResourceId": err = unpopulate(val, "ProvisionedByResourceID", &d.ProvisionedByResourceID) delete(rawMsg, key) @@ -2606,14 +2887,17 @@ func (d *DataCollectionEndpointResourceSystemData) UnmarshalJSON(data []byte) er // MarshalJSON implements the json.Marshaller interface for type DataCollectionRule. func (d DataCollectionRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "agentSettings", d.AgentSettings) populate(objectMap, "dataCollectionEndpointId", d.DataCollectionEndpointID) populate(objectMap, "dataFlows", d.DataFlows) populate(objectMap, "dataSources", d.DataSources) populate(objectMap, "description", d.Description) populate(objectMap, "destinations", d.Destinations) + populate(objectMap, "endpoints", d.Endpoints) populate(objectMap, "immutableId", d.ImmutableID) populate(objectMap, "metadata", d.Metadata) populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "references", d.References) populate(objectMap, "streamDeclarations", d.StreamDeclarations) return json.Marshal(objectMap) } @@ -2627,6 +2911,9 @@ func (d *DataCollectionRule) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "agentSettings": + err = unpopulate(val, "AgentSettings", &d.AgentSettings) + delete(rawMsg, key) case "dataCollectionEndpointId": err = unpopulate(val, "DataCollectionEndpointID", &d.DataCollectionEndpointID) delete(rawMsg, key) @@ -2642,6 +2929,9 @@ func (d *DataCollectionRule) UnmarshalJSON(data []byte) error { case "destinations": err = unpopulate(val, "Destinations", &d.Destinations) delete(rawMsg, key) + case "endpoints": + err = unpopulate(val, "Endpoints", &d.Endpoints) + delete(rawMsg, key) case "immutableId": err = unpopulate(val, "ImmutableID", &d.ImmutableID) delete(rawMsg, key) @@ -2651,6 +2941,9 @@ func (d *DataCollectionRule) UnmarshalJSON(data []byte) error { case "provisioningState": err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) delete(rawMsg, key) + case "references": + err = unpopulate(val, "References", &d.References) + delete(rawMsg, key) case "streamDeclarations": err = unpopulate(val, "StreamDeclarations", &d.StreamDeclarations) delete(rawMsg, key) @@ -2662,6 +2955,33 @@ func (d *DataCollectionRule) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAgentSettings. +func (d DataCollectionRuleAgentSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "logs", d.Logs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleAgentSettings. +func (d *DataCollectionRuleAgentSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "logs": + err = unpopulate(val, "Logs", &d.Logs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociation. func (d DataCollectionRuleAssociation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2709,6 +3029,7 @@ func (d *DataCollectionRuleAssociation) UnmarshalJSON(data []byte) error { func (d DataCollectionRuleAssociationMetadata) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "provisionedBy", d.ProvisionedBy) + populate(objectMap, "provisionedByImmutableId", d.ProvisionedByImmutableID) populate(objectMap, "provisionedByResourceId", d.ProvisionedByResourceID) return json.Marshal(objectMap) } @@ -2725,6 +3046,9 @@ func (d *DataCollectionRuleAssociationMetadata) UnmarshalJSON(data []byte) error case "provisionedBy": err = unpopulate(val, "ProvisionedBy", &d.ProvisionedBy) delete(rawMsg, key) + case "provisionedByImmutableId": + err = unpopulate(val, "ProvisionedByImmutableID", &d.ProvisionedByImmutableID) + delete(rawMsg, key) case "provisionedByResourceId": err = unpopulate(val, "ProvisionedByResourceID", &d.ProvisionedByResourceID) delete(rawMsg, key) @@ -2970,10 +3294,12 @@ func (d *DataCollectionRuleDataSources) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleDestinations. func (d DataCollectionRuleDestinations) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "azureDataExplorer", d.AzureDataExplorer) populate(objectMap, "azureMonitorMetrics", d.AzureMonitorMetrics) populate(objectMap, "eventHubs", d.EventHubs) populate(objectMap, "eventHubsDirect", d.EventHubsDirect) populate(objectMap, "logAnalytics", d.LogAnalytics) + populate(objectMap, "microsoftFabric", d.MicrosoftFabric) populate(objectMap, "monitoringAccounts", d.MonitoringAccounts) populate(objectMap, "storageAccounts", d.StorageAccounts) populate(objectMap, "storageBlobsDirect", d.StorageBlobsDirect) @@ -2990,6 +3316,9 @@ func (d *DataCollectionRuleDestinations) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "azureDataExplorer": + err = unpopulate(val, "AzureDataExplorer", &d.AzureDataExplorer) + delete(rawMsg, key) case "azureMonitorMetrics": err = unpopulate(val, "AzureMonitorMetrics", &d.AzureMonitorMetrics) delete(rawMsg, key) @@ -3002,6 +3331,9 @@ func (d *DataCollectionRuleDestinations) UnmarshalJSON(data []byte) error { case "logAnalytics": err = unpopulate(val, "LogAnalytics", &d.LogAnalytics) delete(rawMsg, key) + case "microsoftFabric": + err = unpopulate(val, "MicrosoftFabric", &d.MicrosoftFabric) + delete(rawMsg, key) case "monitoringAccounts": err = unpopulate(val, "MonitoringAccounts", &d.MonitoringAccounts) delete(rawMsg, key) @@ -3022,16 +3354,16 @@ func (d *DataCollectionRuleDestinations) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleMetadata. -func (d DataCollectionRuleMetadata) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleEndpoints. +func (d DataCollectionRuleEndpoints) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "provisionedBy", d.ProvisionedBy) - populate(objectMap, "provisionedByResourceId", d.ProvisionedByResourceID) + populate(objectMap, "logsIngestion", d.LogsIngestion) + populate(objectMap, "metricsIngestion", d.MetricsIngestion) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleMetadata. -func (d *DataCollectionRuleMetadata) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleEndpoints. +func (d *DataCollectionRuleEndpoints) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -3039,11 +3371,11 @@ func (d *DataCollectionRuleMetadata) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "provisionedBy": - err = unpopulate(val, "ProvisionedBy", &d.ProvisionedBy) + case "logsIngestion": + err = unpopulate(val, "LogsIngestion", &d.LogsIngestion) delete(rawMsg, key) - case "provisionedByResourceId": - err = unpopulate(val, "ProvisionedByResourceID", &d.ProvisionedByResourceID) + case "metricsIngestion": + err = unpopulate(val, "MetricsIngestion", &d.MetricsIngestion) delete(rawMsg, key) } if err != nil { @@ -3053,13 +3385,75 @@ func (d *DataCollectionRuleMetadata) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleResource. -func (d DataCollectionRuleResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleMetadata. +func (d DataCollectionRuleMetadata) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "etag", d.Etag) - populate(objectMap, "id", d.ID) - populate(objectMap, "identity", d.Identity) - populate(objectMap, "kind", d.Kind) + populate(objectMap, "provisionedBy", d.ProvisionedBy) + populate(objectMap, "provisionedByImmutableId", d.ProvisionedByImmutableID) + populate(objectMap, "provisionedByResourceId", d.ProvisionedByResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleMetadata. +func (d *DataCollectionRuleMetadata) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisionedBy": + err = unpopulate(val, "ProvisionedBy", &d.ProvisionedBy) + delete(rawMsg, key) + case "provisionedByImmutableId": + err = unpopulate(val, "ProvisionedByImmutableID", &d.ProvisionedByImmutableID) + delete(rawMsg, key) + case "provisionedByResourceId": + err = unpopulate(val, "ProvisionedByResourceID", &d.ProvisionedByResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleReferences. +func (d DataCollectionRuleReferences) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enrichmentData", d.EnrichmentData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleReferences. +func (d *DataCollectionRuleReferences) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enrichmentData": + err = unpopulate(val, "EnrichmentData", &d.EnrichmentData) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleResource. +func (d DataCollectionRuleResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", d.Etag) + populate(objectMap, "id", d.ID) + populate(objectMap, "identity", d.Identity) + populate(objectMap, "kind", d.Kind) populate(objectMap, "location", d.Location) populate(objectMap, "name", d.Name) populate(objectMap, "properties", d.Properties) @@ -3189,14 +3583,17 @@ func (d *DataCollectionRuleResourceListResult) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleResourceProperties. func (d DataCollectionRuleResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "agentSettings", d.AgentSettings) populate(objectMap, "dataCollectionEndpointId", d.DataCollectionEndpointID) populate(objectMap, "dataFlows", d.DataFlows) populate(objectMap, "dataSources", d.DataSources) populate(objectMap, "description", d.Description) populate(objectMap, "destinations", d.Destinations) + populate(objectMap, "endpoints", d.Endpoints) populate(objectMap, "immutableId", d.ImmutableID) populate(objectMap, "metadata", d.Metadata) populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "references", d.References) populate(objectMap, "streamDeclarations", d.StreamDeclarations) return json.Marshal(objectMap) } @@ -3210,6 +3607,9 @@ func (d *DataCollectionRuleResourceProperties) UnmarshalJSON(data []byte) error for key, val := range rawMsg { var err error switch key { + case "agentSettings": + err = unpopulate(val, "AgentSettings", &d.AgentSettings) + delete(rawMsg, key) case "dataCollectionEndpointId": err = unpopulate(val, "DataCollectionEndpointID", &d.DataCollectionEndpointID) delete(rawMsg, key) @@ -3225,6 +3625,9 @@ func (d *DataCollectionRuleResourceProperties) UnmarshalJSON(data []byte) error case "destinations": err = unpopulate(val, "Destinations", &d.Destinations) delete(rawMsg, key) + case "endpoints": + err = unpopulate(val, "Endpoints", &d.Endpoints) + delete(rawMsg, key) case "immutableId": err = unpopulate(val, "ImmutableID", &d.ImmutableID) delete(rawMsg, key) @@ -3234,6 +3637,9 @@ func (d *DataCollectionRuleResourceProperties) UnmarshalJSON(data []byte) error case "provisioningState": err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) delete(rawMsg, key) + case "references": + err = unpopulate(val, "References", &d.References) + delete(rawMsg, key) case "streamDeclarations": err = unpopulate(val, "StreamDeclarations", &d.StreamDeclarations) delete(rawMsg, key) @@ -3323,6 +3729,7 @@ func (d *DataContainer) UnmarshalJSON(data []byte) error { func (d DataFlow) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "builtInTransform", d.BuiltInTransform) + populate(objectMap, "captureOverflow", d.CaptureOverflow) populate(objectMap, "destinations", d.Destinations) populate(objectMap, "outputStream", d.OutputStream) populate(objectMap, "streams", d.Streams) @@ -3342,6 +3749,9 @@ func (d *DataFlow) UnmarshalJSON(data []byte) error { case "builtInTransform": err = unpopulate(val, "BuiltInTransform", &d.BuiltInTransform) delete(rawMsg, key) + case "captureOverflow": + err = unpopulate(val, "CaptureOverflow", &d.CaptureOverflow) + delete(rawMsg, key) case "destinations": err = unpopulate(val, "Destinations", &d.Destinations) delete(rawMsg, key) @@ -3544,10 +3954,12 @@ func (d *DefaultErrorResponse) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DestinationsSpec. func (d DestinationsSpec) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "azureDataExplorer", d.AzureDataExplorer) populate(objectMap, "azureMonitorMetrics", d.AzureMonitorMetrics) populate(objectMap, "eventHubs", d.EventHubs) populate(objectMap, "eventHubsDirect", d.EventHubsDirect) populate(objectMap, "logAnalytics", d.LogAnalytics) + populate(objectMap, "microsoftFabric", d.MicrosoftFabric) populate(objectMap, "monitoringAccounts", d.MonitoringAccounts) populate(objectMap, "storageAccounts", d.StorageAccounts) populate(objectMap, "storageBlobsDirect", d.StorageBlobsDirect) @@ -3564,6 +3976,9 @@ func (d *DestinationsSpec) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "azureDataExplorer": + err = unpopulate(val, "AzureDataExplorer", &d.AzureDataExplorer) + delete(rawMsg, key) case "azureMonitorMetrics": err = unpopulate(val, "AzureMonitorMetrics", &d.AzureMonitorMetrics) delete(rawMsg, key) @@ -3576,6 +3991,9 @@ func (d *DestinationsSpec) UnmarshalJSON(data []byte) error { case "logAnalytics": err = unpopulate(val, "LogAnalytics", &d.LogAnalytics) delete(rawMsg, key) + case "microsoftFabric": + err = unpopulate(val, "MicrosoftFabric", &d.MicrosoftFabric) + delete(rawMsg, key) case "monitoringAccounts": err = unpopulate(val, "MonitoringAccounts", &d.MonitoringAccounts) delete(rawMsg, key) @@ -4141,6 +4559,64 @@ func (e *EnableRequest) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type EndpointsSpec. +func (e EndpointsSpec) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "logsIngestion", e.LogsIngestion) + populate(objectMap, "metricsIngestion", e.MetricsIngestion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointsSpec. +func (e *EndpointsSpec) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "logsIngestion": + err = unpopulate(val, "LogsIngestion", &e.LogsIngestion) + delete(rawMsg, key) + case "metricsIngestion": + err = unpopulate(val, "MetricsIngestion", &e.MetricsIngestion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnrichmentData. +func (e EnrichmentData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "storageBlobs", e.StorageBlobs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnrichmentData. +func (e *EnrichmentData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "storageBlobs": + err = unpopulate(val, "StorageBlobs", &e.StorageBlobs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Error. func (e Error) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -4230,15 +4706,19 @@ func (e *ErrorContract) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorContractAutoGenerated. -func (e ErrorContractAutoGenerated) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorContractAutoGenerated. -func (e *ErrorContractAutoGenerated) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) @@ -4246,8 +4726,20 @@ func (e *ErrorContractAutoGenerated) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) delete(rawMsg, key) } if err != nil { @@ -4257,8 +4749,8 @@ func (e *ErrorContractAutoGenerated) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. -func (e ErrorDetail) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorDetailAutoGenerated. +func (e ErrorDetailAutoGenerated) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "additionalInfo", e.AdditionalInfo) populate(objectMap, "code", e.Code) @@ -4268,8 +4760,8 @@ func (e ErrorDetail) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. -func (e *ErrorDetail) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetailAutoGenerated. +func (e *ErrorDetailAutoGenerated) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) @@ -4300,8 +4792,8 @@ func (e *ErrorDetail) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorDetailAutoGenerated. -func (e ErrorDetailAutoGenerated) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorDetailAutoGenerated2. +func (e ErrorDetailAutoGenerated2) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "additionalInfo", e.AdditionalInfo) populate(objectMap, "code", e.Code) @@ -4311,8 +4803,8 @@ func (e ErrorDetailAutoGenerated) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetailAutoGenerated. -func (e *ErrorDetailAutoGenerated) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetailAutoGenerated2. +func (e *ErrorDetailAutoGenerated2) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) @@ -4346,8 +4838,7 @@ func (e *ErrorDetailAutoGenerated) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ErrorResponse. func (e ErrorResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "code", e.Code) - populate(objectMap, "message", e.Message) + populate(objectMap, "error", e.Error) return json.Marshal(objectMap) } @@ -4360,11 +4851,8 @@ func (e *ErrorResponse) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "code": - err = unpopulate(val, "Code", &e.Code) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) + case "error": + err = unpopulate(val, "Error", &e.Error) delete(rawMsg, key) } if err != nil { @@ -4374,16 +4862,16 @@ func (e *ErrorResponse) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponseAdditionalInfo. -func (e ErrorResponseAdditionalInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseAutoGenerated. +func (e ErrorResponseAutoGenerated) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateAny(objectMap, "info", e.Info) - populate(objectMap, "type", e.Type) + populate(objectMap, "code", e.Code) + populate(objectMap, "message", e.Message) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAdditionalInfo. -func (e *ErrorResponseAdditionalInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAutoGenerated. +func (e *ErrorResponseAutoGenerated) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) @@ -4391,11 +4879,11 @@ func (e *ErrorResponseAdditionalInfo) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "info": - err = unpopulate(val, "Info", &e.Info) + case "code": + err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) + case "message": + err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) } if err != nil { @@ -4405,16 +4893,19 @@ func (e *ErrorResponseAdditionalInfo) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponseAutoGenerated. -func (e ErrorResponseAutoGenerated) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseAutoGenerated2. +func (e ErrorResponseAutoGenerated2) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "additionalInfo", e.AdditionalInfo) populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAutoGenerated. -func (e *ErrorResponseAutoGenerated) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAutoGenerated2. +func (e *ErrorResponseAutoGenerated2) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) @@ -4422,12 +4913,21 @@ func (e *ErrorResponseAutoGenerated) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) case "code": err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) case "message": err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) @@ -4436,15 +4936,15 @@ func (e *ErrorResponseAutoGenerated) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponseAutoGenerated2. -func (e ErrorResponseAutoGenerated2) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseAutoGenerated3. +func (e ErrorResponseAutoGenerated3) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "error", e.Error) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAutoGenerated2. -func (e *ErrorResponseAutoGenerated2) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAutoGenerated3. +func (e *ErrorResponseAutoGenerated3) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) @@ -4463,15 +4963,15 @@ func (e *ErrorResponseAutoGenerated2) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponseCommonV2. -func (e ErrorResponseCommonV2) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseAutoGenerated4. +func (e ErrorResponseAutoGenerated4) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "error", e.Error) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseCommonV2. -func (e *ErrorResponseCommonV2) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAutoGenerated4. +func (e *ErrorResponseAutoGenerated4) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) @@ -4490,19 +4990,16 @@ func (e *ErrorResponseCommonV2) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponseDetails. -func (e ErrorResponseDetails) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseAutoGenerated5. +func (e ErrorResponseAutoGenerated5) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "additionalInfo", e.AdditionalInfo) populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) populate(objectMap, "message", e.Message) - populate(objectMap, "target", e.Target) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseDetails. -func (e *ErrorResponseDetails) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAutoGenerated5. +func (e *ErrorResponseAutoGenerated5) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) @@ -4510,20 +5007,38 @@ func (e *ErrorResponseDetails) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "additionalInfo": - err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) - delete(rawMsg, key) case "code": err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &e.Details) - delete(rawMsg, key) case "message": err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &e.Target) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseCommonV2. +func (e ErrorResponseCommonV2) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseCommonV2. +func (e *ErrorResponseCommonV2) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) delete(rawMsg, key) } if err != nil { @@ -5012,6 +5527,7 @@ func (i IisLogsDataSource) MarshalJSON() ([]byte, error) { populate(objectMap, "logDirectories", i.LogDirectories) populate(objectMap, "name", i.Name) populate(objectMap, "streams", i.Streams) + populate(objectMap, "transformKql", i.TransformKql) return json.Marshal(objectMap) } @@ -5033,6 +5549,9 @@ func (i *IisLogsDataSource) UnmarshalJSON(data []byte) error { case "streams": err = unpopulate(val, "Streams", &i.Streams) delete(rawMsg, key) + case "transformKql": + err = unpopulate(val, "TransformKql", &i.TransformKql) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", i, err) @@ -5111,16 +5630,18 @@ func (i *IncidentListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type IngestionSettings. -func (i IngestionSettings) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IncidentReceiver. +func (i IncidentReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "dataCollectionEndpointResourceId", i.DataCollectionEndpointResourceID) - populate(objectMap, "dataCollectionRuleResourceId", i.DataCollectionRuleResourceID) + populate(objectMap, "connection", i.Connection) + populate(objectMap, "incidentManagementService", i.IncidentManagementService) + populate(objectMap, "mappings", i.Mappings) + populate(objectMap, "name", i.Name) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IngestionSettings. -func (i *IngestionSettings) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IncidentReceiver. +func (i *IncidentReceiver) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", i, err) @@ -5128,11 +5649,17 @@ func (i *IngestionSettings) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "dataCollectionEndpointResourceId": - err = unpopulate(val, "DataCollectionEndpointResourceID", &i.DataCollectionEndpointResourceID) + case "connection": + err = unpopulate(val, "Connection", &i.Connection) delete(rawMsg, key) - case "dataCollectionRuleResourceId": - err = unpopulate(val, "DataCollectionRuleResourceID", &i.DataCollectionRuleResourceID) + case "incidentManagementService": + err = unpopulate(val, "IncidentManagementService", &i.IncidentManagementService) + delete(rawMsg, key) + case "mappings": + err = unpopulate(val, "Mappings", &i.Mappings) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) delete(rawMsg, key) } if err != nil { @@ -5142,13 +5669,75 @@ func (i *IngestionSettings) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ItsmReceiver. -func (i ItsmReceiver) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IncidentServiceConnection. +func (i IncidentServiceConnection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "connectionId", i.ConnectionID) + populate(objectMap, "id", i.ID) populate(objectMap, "name", i.Name) - populate(objectMap, "region", i.Region) - populate(objectMap, "ticketConfiguration", i.TicketConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IncidentServiceConnection. +func (i *IncidentServiceConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IngestionSettings. +func (i IngestionSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dataCollectionEndpointResourceId", i.DataCollectionEndpointResourceID) + populate(objectMap, "dataCollectionRuleResourceId", i.DataCollectionRuleResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IngestionSettings. +func (i *IngestionSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataCollectionEndpointResourceId": + err = unpopulate(val, "DataCollectionEndpointResourceID", &i.DataCollectionEndpointResourceID) + delete(rawMsg, key) + case "dataCollectionRuleResourceId": + err = unpopulate(val, "DataCollectionRuleResourceID", &i.DataCollectionRuleResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ItsmReceiver. +func (i ItsmReceiver) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "connectionId", i.ConnectionID) + populate(objectMap, "name", i.Name) + populate(objectMap, "region", i.Region) + populate(objectMap, "ticketConfiguration", i.TicketConfiguration) populate(objectMap, "workspaceId", i.WorkspaceID) return json.Marshal(objectMap) } @@ -5216,6 +5805,37 @@ func (l *LocalizableString) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type LocalizableStringAutoGenerated. +func (l LocalizableStringAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "localizedValue", l.LocalizedValue) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LocalizableStringAutoGenerated. +func (l *LocalizableStringAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "localizedValue": + err = unpopulate(val, "LocalizedValue", &l.LocalizedValue) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type LocationSpec. func (l LocationSpec) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -5410,6 +6030,7 @@ func (l LogFilesDataSource) MarshalJSON() ([]byte, error) { populate(objectMap, "name", l.Name) populate(objectMap, "settings", l.Settings) populate(objectMap, "streams", l.Streams) + populate(objectMap, "transformKql", l.TransformKql) return json.Marshal(objectMap) } @@ -5437,6 +6058,9 @@ func (l *LogFilesDataSource) UnmarshalJSON(data []byte) error { case "streams": err = unpopulate(val, "Streams", &l.Streams) delete(rawMsg, key) + case "transformKql": + err = unpopulate(val, "TransformKql", &l.TransformKql) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) @@ -5838,6 +6462,7 @@ func (m *ManagementEventRuleCondition) UnmarshalJSON(data []byte) error { func (m Metadata) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "provisionedBy", m.ProvisionedBy) + populate(objectMap, "provisionedByImmutableId", m.ProvisionedByImmutableID) populate(objectMap, "provisionedByResourceId", m.ProvisionedByResourceID) return json.Marshal(objectMap) } @@ -5854,6 +6479,9 @@ func (m *Metadata) UnmarshalJSON(data []byte) error { case "provisionedBy": err = unpopulate(val, "ProvisionedBy", &m.ProvisionedBy) delete(rawMsg, key) + case "provisionedByImmutableId": + err = unpopulate(val, "ProvisionedByImmutableID", &m.ProvisionedByImmutableID) + delete(rawMsg, key) case "provisionedByResourceId": err = unpopulate(val, "ProvisionedByResourceID", &m.ProvisionedByResourceID) delete(rawMsg, key) @@ -7123,6 +7751,49 @@ func (m *MetricsIngestionEndpointSpec) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type MicrosoftFabricDestination. +func (m MicrosoftFabricDestination) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "artifactId", m.ArtifactID) + populate(objectMap, "databaseName", m.DatabaseName) + populate(objectMap, "ingestionUri", m.IngestionURI) + populate(objectMap, "name", m.Name) + populate(objectMap, "tenantId", m.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MicrosoftFabricDestination. +func (m *MicrosoftFabricDestination) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "artifactId": + err = unpopulate(val, "ArtifactID", &m.ArtifactID) + delete(rawMsg, key) + case "databaseName": + err = unpopulate(val, "DatabaseName", &m.DatabaseName) + delete(rawMsg, key) + case "ingestionUri": + err = unpopulate(val, "IngestionURI", &m.IngestionURI) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type MonitoringAccountDestination. func (m MonitoringAccountDestination) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -7251,26 +7922,17 @@ func (n *NetworkRuleSet) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type NotificationRequestBody. -func (n NotificationRequestBody) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NetworkSecurityPerimeter. +func (n NetworkSecurityPerimeter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "alertType", n.AlertType) - populate(objectMap, "armRoleReceivers", n.ArmRoleReceivers) - populate(objectMap, "automationRunbookReceivers", n.AutomationRunbookReceivers) - populate(objectMap, "azureAppPushReceivers", n.AzureAppPushReceivers) - populate(objectMap, "azureFunctionReceivers", n.AzureFunctionReceivers) - populate(objectMap, "emailReceivers", n.EmailReceivers) - populate(objectMap, "eventHubReceivers", n.EventHubReceivers) - populate(objectMap, "itsmReceivers", n.ItsmReceivers) - populate(objectMap, "logicAppReceivers", n.LogicAppReceivers) - populate(objectMap, "smsReceivers", n.SmsReceivers) - populate(objectMap, "voiceReceivers", n.VoiceReceivers) - populate(objectMap, "webhookReceivers", n.WebhookReceivers) + populate(objectMap, "id", n.ID) + populate(objectMap, "location", n.Location) + populate(objectMap, "perimeterGuid", n.PerimeterGUID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NotificationRequestBody. -func (n *NotificationRequestBody) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityPerimeter. +func (n *NetworkSecurityPerimeter) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", n, err) @@ -7278,41 +7940,14 @@ func (n *NotificationRequestBody) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "alertType": - err = unpopulate(val, "AlertType", &n.AlertType) - delete(rawMsg, key) - case "armRoleReceivers": - err = unpopulate(val, "ArmRoleReceivers", &n.ArmRoleReceivers) - delete(rawMsg, key) - case "automationRunbookReceivers": - err = unpopulate(val, "AutomationRunbookReceivers", &n.AutomationRunbookReceivers) - delete(rawMsg, key) - case "azureAppPushReceivers": - err = unpopulate(val, "AzureAppPushReceivers", &n.AzureAppPushReceivers) - delete(rawMsg, key) - case "azureFunctionReceivers": - err = unpopulate(val, "AzureFunctionReceivers", &n.AzureFunctionReceivers) - delete(rawMsg, key) - case "emailReceivers": - err = unpopulate(val, "EmailReceivers", &n.EmailReceivers) - delete(rawMsg, key) - case "eventHubReceivers": - err = unpopulate(val, "EventHubReceivers", &n.EventHubReceivers) - delete(rawMsg, key) - case "itsmReceivers": - err = unpopulate(val, "ItsmReceivers", &n.ItsmReceivers) - delete(rawMsg, key) - case "logicAppReceivers": - err = unpopulate(val, "LogicAppReceivers", &n.LogicAppReceivers) - delete(rawMsg, key) - case "smsReceivers": - err = unpopulate(val, "SmsReceivers", &n.SmsReceivers) + case "id": + err = unpopulate(val, "ID", &n.ID) delete(rawMsg, key) - case "voiceReceivers": - err = unpopulate(val, "VoiceReceivers", &n.VoiceReceivers) + case "location": + err = unpopulate(val, "Location", &n.Location) delete(rawMsg, key) - case "webhookReceivers": - err = unpopulate(val, "WebhookReceivers", &n.WebhookReceivers) + case "perimeterGuid": + err = unpopulate(val, "PerimeterGUID", &n.PerimeterGUID) delete(rawMsg, key) } if err != nil { @@ -7322,142 +7957,377 @@ func (n *NotificationRequestBody) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Operation. -func (o Operation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NetworkSecurityPerimeterConfiguration. +func (n NetworkSecurityPerimeterConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "display", o.Display) - populate(objectMap, "name", o.Name) + populate(objectMap, "id", n.ID) + populate(objectMap, "name", n.Name) + populate(objectMap, "properties", n.Properties) + populate(objectMap, "systemData", n.SystemData) + populate(objectMap, "type", n.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. -func (o *Operation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityPerimeterConfiguration. +func (n *NetworkSecurityPerimeterConfiguration) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "display": - err = unpopulate(val, "Display", &o.Display) + case "id": + err = unpopulate(val, "ID", &n.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &o.Name) + err = unpopulate(val, "Name", &n.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &n.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &n.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &n.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationAutoGenerated. -func (o OperationAutoGenerated) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NetworkSecurityPerimeterConfigurationListResult. +func (n NetworkSecurityPerimeterConfigurationListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "actionType", o.ActionType) - populate(objectMap, "display", o.Display) - populate(objectMap, "isDataAction", o.IsDataAction) - populate(objectMap, "name", o.Name) - populate(objectMap, "origin", o.Origin) + populate(objectMap, "nextLink", n.NextLink) + populate(objectMap, "value", n.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationAutoGenerated. -func (o *OperationAutoGenerated) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityPerimeterConfigurationListResult. +func (n *NetworkSecurityPerimeterConfigurationListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "actionType": - err = unpopulate(val, "ActionType", &o.ActionType) - delete(rawMsg, key) - case "display": - err = unpopulate(val, "Display", &o.Display) - delete(rawMsg, key) - case "isDataAction": - err = unpopulate(val, "IsDataAction", &o.IsDataAction) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) + case "nextLink": + err = unpopulate(val, "NextLink", &n.NextLink) delete(rawMsg, key) - case "origin": - err = unpopulate(val, "Origin", &o.Origin) + case "value": + err = unpopulate(val, "Value", &n.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. -func (o OperationDisplay) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NetworkSecurityPerimeterConfigurationProperties. +func (n NetworkSecurityPerimeterConfigurationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "operation", o.Operation) - populate(objectMap, "provider", o.Provider) - populate(objectMap, "resource", o.Resource) + populate(objectMap, "networkSecurityPerimeter", n.NetworkSecurityPerimeter) + populate(objectMap, "profile", n.Profile) + populate(objectMap, "provisioningIssues", n.ProvisioningIssues) + populate(objectMap, "provisioningState", n.ProvisioningState) + populate(objectMap, "resourceAssociation", n.ResourceAssociation) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. -func (o *OperationDisplay) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityPerimeterConfigurationProperties. +func (n *NetworkSecurityPerimeterConfigurationProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "operation": - err = unpopulate(val, "Operation", &o.Operation) + case "networkSecurityPerimeter": + err = unpopulate(val, "NetworkSecurityPerimeter", &n.NetworkSecurityPerimeter) delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &o.Provider) + case "profile": + err = unpopulate(val, "Profile", &n.Profile) delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &o.Resource) + case "provisioningIssues": + err = unpopulate(val, "ProvisioningIssues", &n.ProvisioningIssues) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &n.ProvisioningState) + delete(rawMsg, key) + case "resourceAssociation": + err = unpopulate(val, "ResourceAssociation", &n.ResourceAssociation) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationDisplayAutoGenerated. -func (o OperationDisplayAutoGenerated) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NetworkSecurityProfile. +func (n NetworkSecurityProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", o.Description) - populate(objectMap, "operation", o.Operation) - populate(objectMap, "provider", o.Provider) - populate(objectMap, "resource", o.Resource) + populate(objectMap, "accessRules", n.AccessRules) + populate(objectMap, "accessRulesVersion", n.AccessRulesVersion) + populate(objectMap, "diagnosticSettingsVersion", n.DiagnosticSettingsVersion) + populate(objectMap, "enabledLogCategories", n.EnabledLogCategories) + populate(objectMap, "name", n.Name) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplayAutoGenerated. -func (o *OperationDisplayAutoGenerated) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityProfile. +func (n *NetworkSecurityProfile) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &o.Description) + case "accessRules": + err = unpopulate(val, "AccessRules", &n.AccessRules) delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &o.Operation) + case "accessRulesVersion": + err = unpopulate(val, "AccessRulesVersion", &n.AccessRulesVersion) delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &o.Provider) + case "diagnosticSettingsVersion": + err = unpopulate(val, "DiagnosticSettingsVersion", &n.DiagnosticSettingsVersion) + delete(rawMsg, key) + case "enabledLogCategories": + err = unpopulate(val, "EnabledLogCategories", &n.EnabledLogCategories) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &n.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NotificationRequestBody. +func (n NotificationRequestBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "alertType", n.AlertType) + populate(objectMap, "armRoleReceivers", n.ArmRoleReceivers) + populate(objectMap, "automationRunbookReceivers", n.AutomationRunbookReceivers) + populate(objectMap, "azureAppPushReceivers", n.AzureAppPushReceivers) + populate(objectMap, "azureFunctionReceivers", n.AzureFunctionReceivers) + populate(objectMap, "emailReceivers", n.EmailReceivers) + populate(objectMap, "eventHubReceivers", n.EventHubReceivers) + populate(objectMap, "incidentReceivers", n.IncidentReceivers) + populate(objectMap, "itsmReceivers", n.ItsmReceivers) + populate(objectMap, "logicAppReceivers", n.LogicAppReceivers) + populate(objectMap, "smsReceivers", n.SmsReceivers) + populate(objectMap, "voiceReceivers", n.VoiceReceivers) + populate(objectMap, "webhookReceivers", n.WebhookReceivers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NotificationRequestBody. +func (n *NotificationRequestBody) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertType": + err = unpopulate(val, "AlertType", &n.AlertType) + delete(rawMsg, key) + case "armRoleReceivers": + err = unpopulate(val, "ArmRoleReceivers", &n.ArmRoleReceivers) + delete(rawMsg, key) + case "automationRunbookReceivers": + err = unpopulate(val, "AutomationRunbookReceivers", &n.AutomationRunbookReceivers) + delete(rawMsg, key) + case "azureAppPushReceivers": + err = unpopulate(val, "AzureAppPushReceivers", &n.AzureAppPushReceivers) + delete(rawMsg, key) + case "azureFunctionReceivers": + err = unpopulate(val, "AzureFunctionReceivers", &n.AzureFunctionReceivers) + delete(rawMsg, key) + case "emailReceivers": + err = unpopulate(val, "EmailReceivers", &n.EmailReceivers) + delete(rawMsg, key) + case "eventHubReceivers": + err = unpopulate(val, "EventHubReceivers", &n.EventHubReceivers) + delete(rawMsg, key) + case "incidentReceivers": + err = unpopulate(val, "IncidentReceivers", &n.IncidentReceivers) + delete(rawMsg, key) + case "itsmReceivers": + err = unpopulate(val, "ItsmReceivers", &n.ItsmReceivers) + delete(rawMsg, key) + case "logicAppReceivers": + err = unpopulate(val, "LogicAppReceivers", &n.LogicAppReceivers) + delete(rawMsg, key) + case "smsReceivers": + err = unpopulate(val, "SmsReceivers", &n.SmsReceivers) + delete(rawMsg, key) + case "voiceReceivers": + err = unpopulate(val, "VoiceReceivers", &n.VoiceReceivers) + delete(rawMsg, key) + case "webhookReceivers": + err = unpopulate(val, "WebhookReceivers", &n.WebhookReceivers) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationAutoGenerated. +func (o OperationAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "display", o.Display) + populate(objectMap, "name", o.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationAutoGenerated. +func (o *OperationAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplayAutoGenerated. +func (o OperationDisplayAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplayAutoGenerated. +func (o *OperationDisplayAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) delete(rawMsg, key) case "resource": err = unpopulate(val, "Resource", &o.Resource) @@ -7586,6 +8456,7 @@ func (p PerfCounterDataSource) MarshalJSON() ([]byte, error) { populate(objectMap, "name", p.Name) populate(objectMap, "samplingFrequencyInSeconds", p.SamplingFrequencyInSeconds) populate(objectMap, "streams", p.Streams) + populate(objectMap, "transformKql", p.TransformKql) return json.Marshal(objectMap) } @@ -7610,6 +8481,9 @@ func (p *PerfCounterDataSource) UnmarshalJSON(data []byte) error { case "streams": err = unpopulate(val, "Streams", &p.Streams) delete(rawMsg, key) + case "transformKql": + err = unpopulate(val, "TransformKql", &p.TransformKql) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -7781,18 +8655,88 @@ func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointAutoGenerated. +func (p PrivateEndpointAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointAutoGenerated. +func (p *PrivateEndpointAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionAutoGenerated. +func (p PrivateEndpointConnectionAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionAutoGenerated. +func (p *PrivateEndpointConnectionAutoGenerated) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -7847,8 +8791,47 @@ func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. -func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupIds", p.GroupIDs) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. +func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupIds": + err = unpopulate(val, "GroupIDs", &p.GroupIDs) + delete(rawMsg, key) + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionPropertiesAutoGenerated. +func (p PrivateEndpointConnectionPropertiesAutoGenerated) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "privateEndpoint", p.PrivateEndpoint) populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) @@ -7856,8 +8839,8 @@ func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. -func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionPropertiesAutoGenerated. +func (p *PrivateEndpointConnectionPropertiesAutoGenerated) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -8084,11 +9067,86 @@ func (p *PrometheusForwarderDataSource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ProvisioningIssue. +func (p ProvisioningIssue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisioningIssue. +func (p *ProvisioningIssue) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProvisioningIssueProperties. +func (p ProvisioningIssueProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", p.Description) + populate(objectMap, "issueType", p.IssueType) + populate(objectMap, "severity", p.Severity) + populate(objectMap, "suggestedAccessRules", p.SuggestedAccessRules) + populate(objectMap, "suggestedResourceIds", p.SuggestedResourceIDs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisioningIssueProperties. +func (p *ProvisioningIssueProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "issueType": + err = unpopulate(val, "IssueType", &p.IssueType) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &p.Severity) + delete(rawMsg, key) + case "suggestedAccessRules": + err = unpopulate(val, "SuggestedAccessRules", &p.SuggestedAccessRules) + delete(rawMsg, key) + case "suggestedResourceIds": + err = unpopulate(val, "SuggestedResourceIDs", &p.SuggestedResourceIDs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ProxyResource. func (p ProxyResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) + populate(objectMap, "systemData", p.SystemData) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } @@ -8108,6 +9166,9 @@ func (p *ProxyResource) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) @@ -8154,6 +9215,41 @@ func (p *ProxyResourceAutoGenerated) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ProxyResourceAutoGenerated2. +func (p ProxyResourceAutoGenerated2) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResourceAutoGenerated2. +func (p *ProxyResourceAutoGenerated2) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Recurrence. func (r Recurrence) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -8224,14 +9320,66 @@ func (r *RecurrentSchedule) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ReferencesSpec. +func (r ReferencesSpec) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enrichmentData", r.EnrichmentData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReferencesSpec. +func (r *ReferencesSpec) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enrichmentData": + err = unpopulate(val, "EnrichmentData", &r.EnrichmentData) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReferencesSpecEnrichmentData. +func (r ReferencesSpecEnrichmentData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "storageBlobs", r.StorageBlobs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReferencesSpecEnrichmentData. +func (r *ReferencesSpecEnrichmentData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "storageBlobs": + err = unpopulate(val, "StorageBlobs", &r.StorageBlobs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Resource. func (r Resource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) populate(objectMap, "systemData", r.SystemData) - populate(objectMap, "tags", r.Tags) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } @@ -8248,18 +9396,12 @@ func (r *Resource) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) case "systemData": err = unpopulate(val, "SystemData", &r.SystemData) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) - delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) @@ -8271,19 +9413,129 @@ func (r *Resource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ResourceAssociation. +func (r ResourceAssociation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accessMode", r.AccessMode) + populate(objectMap, "name", r.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAssociation. +func (r *ResourceAssociation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "accessMode": + err = unpopulate(val, "AccessMode", &r.AccessMode) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated. func (r ResourceAutoGenerated) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) - populate(objectMap, "tags", r.Tags) + populate(objectMap, "systemData", r.SystemData) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated. func (r *ResourceAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated2. +func (r ResourceAutoGenerated2) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated2. +func (r *ResourceAutoGenerated2) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated3. +func (r ResourceAutoGenerated3) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated3. +func (r *ResourceAutoGenerated3) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -8300,6 +9552,9 @@ func (r *ResourceAutoGenerated) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &r.Tags) delete(rawMsg, key) @@ -8314,8 +9569,8 @@ func (r *ResourceAutoGenerated) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated2. -func (r ResourceAutoGenerated2) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated4. +func (r ResourceAutoGenerated4) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "location", r.Location) @@ -8325,8 +9580,8 @@ func (r ResourceAutoGenerated2) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated2. -func (r *ResourceAutoGenerated2) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated4. +func (r *ResourceAutoGenerated4) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -8357,17 +9612,19 @@ func (r *ResourceAutoGenerated2) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated3. -func (r ResourceAutoGenerated3) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated5. +func (r ResourceAutoGenerated5) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) + populate(objectMap, "tags", r.Tags) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated3. -func (r *ResourceAutoGenerated3) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated5. +func (r *ResourceAutoGenerated5) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -8378,9 +9635,15 @@ func (r *ResourceAutoGenerated3) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) @@ -8392,19 +9655,17 @@ func (r *ResourceAutoGenerated3) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated4. -func (r ResourceAutoGenerated4) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated6. +func (r ResourceAutoGenerated6) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) - populate(objectMap, "tags", r.Tags) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated4. -func (r *ResourceAutoGenerated4) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated6. +func (r *ResourceAutoGenerated6) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -8415,15 +9676,9 @@ func (r *ResourceAutoGenerated4) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) - delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) @@ -8435,18 +9690,19 @@ func (r *ResourceAutoGenerated4) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated5. -func (r ResourceAutoGenerated5) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated7. +func (r ResourceAutoGenerated7) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) - populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "tags", r.Tags) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated5. -func (r *ResourceAutoGenerated5) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated7. +func (r *ResourceAutoGenerated7) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -8457,11 +9713,14 @@ func (r *ResourceAutoGenerated5) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &r.SystemData) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) @@ -9187,7 +10446,6 @@ func (s ScheduledQueryRuleProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "isWorkspaceAlertsStorageConfigured", s.IsWorkspaceAlertsStorageConfigured) populate(objectMap, "muteActionsDuration", s.MuteActionsDuration) populate(objectMap, "overrideQueryTimeRange", s.OverrideQueryTimeRange) - populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) populate(objectMap, "ruleResolveConfiguration", s.RuleResolveConfiguration) populate(objectMap, "scopes", s.Scopes) populate(objectMap, "severity", s.Severity) @@ -9245,9 +10503,6 @@ func (s *ScheduledQueryRuleProperties) UnmarshalJSON(data []byte) error { case "overrideQueryTimeRange": err = unpopulate(val, "OverrideQueryTimeRange", &s.OverrideQueryTimeRange) delete(rawMsg, key) - case "publicNetworkAccess": - err = unpopulate(val, "PublicNetworkAccess", &s.PublicNetworkAccess) - delete(rawMsg, key) case "ruleResolveConfiguration": err = unpopulate(val, "RuleResolveConfiguration", &s.RuleResolveConfiguration) delete(rawMsg, key) @@ -9695,6 +10950,45 @@ func (s *SmsReceiverAutoGenerated) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type StorageBlob. +func (s StorageBlob) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "blobUrl", s.BlobURL) + populate(objectMap, "lookupType", s.LookupType) + populate(objectMap, "name", s.Name) + populate(objectMap, "resourceId", s.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageBlob. +func (s *StorageBlob) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "blobUrl": + err = unpopulate(val, "BlobURL", &s.BlobURL) + delete(rawMsg, key) + case "lookupType": + err = unpopulate(val, "LookupType", &s.LookupType) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &s.ResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type StorageBlobDestination. func (s StorageBlobDestination) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -9792,61 +11086,6 @@ func (s *StreamDeclaration) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SubscriptionScopeMetric. -func (s SubscriptionScopeMetric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "displayDescription", s.DisplayDescription) - populate(objectMap, "errorCode", s.ErrorCode) - populate(objectMap, "errorMessage", s.ErrorMessage) - populate(objectMap, "id", s.ID) - populate(objectMap, "name", s.Name) - populate(objectMap, "timeseries", s.Timeseries) - populate(objectMap, "type", s.Type) - populate(objectMap, "unit", s.Unit) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionScopeMetric. -func (s *SubscriptionScopeMetric) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "displayDescription": - err = unpopulate(val, "DisplayDescription", &s.DisplayDescription) - delete(rawMsg, key) - case "errorCode": - err = unpopulate(val, "ErrorCode", &s.ErrorCode) - delete(rawMsg, key) - case "errorMessage": - err = unpopulate(val, "ErrorMessage", &s.ErrorMessage) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "timeseries": - err = unpopulate(val, "Timeseries", &s.Timeseries) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &s.Unit) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type SubscriptionScopeMetricDefinition. func (s SubscriptionScopeMetricDefinition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -9949,53 +11188,6 @@ func (s *SubscriptionScopeMetricDefinitionCollection) UnmarshalJSON(data []byte) return nil } -// MarshalJSON implements the json.Marshaller interface for type SubscriptionScopeMetricResponse. -func (s SubscriptionScopeMetricResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "cost", s.Cost) - populate(objectMap, "interval", s.Interval) - populate(objectMap, "namespace", s.Namespace) - populate(objectMap, "resourceregion", s.Resourceregion) - populate(objectMap, "timespan", s.Timespan) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionScopeMetricResponse. -func (s *SubscriptionScopeMetricResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "cost": - err = unpopulate(val, "Cost", &s.Cost) - delete(rawMsg, key) - case "interval": - err = unpopulate(val, "Interval", &s.Interval) - delete(rawMsg, key) - case "namespace": - err = unpopulate(val, "Namespace", &s.Namespace) - delete(rawMsg, key) - case "resourceregion": - err = unpopulate(val, "Resourceregion", &s.Resourceregion) - delete(rawMsg, key) - case "timespan": - err = unpopulate(val, "Timespan", &s.Timespan) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type SubscriptionScopeMetricsRequestBodyParameters. func (s SubscriptionScopeMetricsRequestBodyParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -10008,7 +11200,7 @@ func (s SubscriptionScopeMetricsRequestBodyParameters) MarshalJSON() ([]byte, er populate(objectMap, "orderBy", s.OrderBy) populate(objectMap, "resultType", s.ResultType) populate(objectMap, "rollUpBy", s.RollUpBy) - populateTimeRFC3339(objectMap, "timespan", s.Timespan) + populate(objectMap, "timespan", s.Timespan) populate(objectMap, "top", s.Top) populate(objectMap, "validateDimensions", s.ValidateDimensions) return json.Marshal(objectMap) @@ -10051,7 +11243,7 @@ func (s *SubscriptionScopeMetricsRequestBodyParameters) UnmarshalJSON(data []byt err = unpopulate(val, "RollUpBy", &s.RollUpBy) delete(rawMsg, key) case "timespan": - err = unpopulateTimeRFC3339(val, "Timespan", &s.Timespan) + err = unpopulate(val, "Timespan", &s.Timespan) delete(rawMsg, key) case "top": err = unpopulate(val, "Top", &s.Top) @@ -10074,6 +11266,7 @@ func (s SyslogDataSource) MarshalJSON() ([]byte, error) { populate(objectMap, "logLevels", s.LogLevels) populate(objectMap, "name", s.Name) populate(objectMap, "streams", s.Streams) + populate(objectMap, "transformKql", s.TransformKql) return json.Marshal(objectMap) } @@ -10098,6 +11291,9 @@ func (s *SyslogDataSource) UnmarshalJSON(data []byte) error { case "streams": err = unpopulate(val, "Streams", &s.Streams) delete(rawMsg, key) + case "transformKql": + err = unpopulate(val, "TransformKql", &s.TransformKql) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -10309,6 +11505,53 @@ func (t *TenantActionGroupResource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type TenantNotificationRequestBody. +func (t TenantNotificationRequestBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "alertType", t.AlertType) + populate(objectMap, "azureAppPushReceivers", t.AzureAppPushReceivers) + populate(objectMap, "emailReceivers", t.EmailReceivers) + populate(objectMap, "smsReceivers", t.SmsReceivers) + populate(objectMap, "voiceReceivers", t.VoiceReceivers) + populate(objectMap, "webhookReceivers", t.WebhookReceivers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TenantNotificationRequestBody. +func (t *TenantNotificationRequestBody) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertType": + err = unpopulate(val, "AlertType", &t.AlertType) + delete(rawMsg, key) + case "azureAppPushReceivers": + err = unpopulate(val, "AzureAppPushReceivers", &t.AzureAppPushReceivers) + delete(rawMsg, key) + case "emailReceivers": + err = unpopulate(val, "EmailReceivers", &t.EmailReceivers) + delete(rawMsg, key) + case "smsReceivers": + err = unpopulate(val, "SmsReceivers", &t.SmsReceivers) + delete(rawMsg, key) + case "voiceReceivers": + err = unpopulate(val, "VoiceReceivers", &t.VoiceReceivers) + delete(rawMsg, key) + case "webhookReceivers": + err = unpopulate(val, "WebhookReceivers", &t.WebhookReceivers) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type TestNotificationDetailsResponse. func (t TestNotificationDetailsResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -10352,6 +11595,49 @@ func (t *TestNotificationDetailsResponse) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type TestNotificationDetailsResponseAutoGenerated. +func (t TestNotificationDetailsResponseAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionDetails", t.ActionDetails) + populate(objectMap, "completedTime", t.CompletedTime) + populate(objectMap, "context", t.Context) + populate(objectMap, "createdTime", t.CreatedTime) + populate(objectMap, "state", t.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TestNotificationDetailsResponseAutoGenerated. +func (t *TestNotificationDetailsResponseAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionDetails": + err = unpopulate(val, "ActionDetails", &t.ActionDetails) + delete(rawMsg, key) + case "completedTime": + err = unpopulate(val, "CompletedTime", &t.CompletedTime) + delete(rawMsg, key) + case "context": + err = unpopulate(val, "Context", &t.Context) + delete(rawMsg, key) + case "createdTime": + err = unpopulate(val, "CreatedTime", &t.CreatedTime) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &t.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ThresholdRuleCondition. func (t ThresholdRuleCondition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -10522,6 +11808,7 @@ func (t TrackedResource) MarshalJSON() ([]byte, error) { populate(objectMap, "id", t.ID) populate(objectMap, "location", t.Location) populate(objectMap, "name", t.Name) + populate(objectMap, "systemData", t.SystemData) populate(objectMap, "tags", t.Tags) populate(objectMap, "type", t.Type) return json.Marshal(objectMap) @@ -10545,6 +11832,9 @@ func (t *TrackedResource) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &t.Name) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &t.Tags) delete(rawMsg, key) @@ -10565,7 +11855,6 @@ func (t TrackedResourceAutoGenerated) MarshalJSON() ([]byte, error) { populate(objectMap, "id", t.ID) populate(objectMap, "location", t.Location) populate(objectMap, "name", t.Name) - populate(objectMap, "systemData", t.SystemData) populate(objectMap, "tags", t.Tags) populate(objectMap, "type", t.Type) return json.Marshal(objectMap) @@ -10589,9 +11878,6 @@ func (t *TrackedResourceAutoGenerated) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &t.Name) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &t.SystemData) - delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &t.Tags) delete(rawMsg, key) @@ -11008,6 +12294,7 @@ func (w WindowsEventLogDataSource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "name", w.Name) populate(objectMap, "streams", w.Streams) + populate(objectMap, "transformKql", w.TransformKql) populate(objectMap, "xPathQueries", w.XPathQueries) return json.Marshal(objectMap) } @@ -11027,6 +12314,9 @@ func (w *WindowsEventLogDataSource) UnmarshalJSON(data []byte) error { case "streams": err = unpopulate(val, "Streams", &w.Streams) delete(rawMsg, key) + case "transformKql": + err = unpopulate(val, "TransformKql", &w.TransformKql) + delete(rawMsg, key) case "xPathQueries": err = unpopulate(val, "XPathQueries", &w.XPathQueries) delete(rawMsg, key) @@ -11042,6 +12332,7 @@ func (w *WindowsEventLogDataSource) UnmarshalJSON(data []byte) error { func (w WindowsFirewallLogsDataSource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "name", w.Name) + populate(objectMap, "profileFilter", w.ProfileFilter) populate(objectMap, "streams", w.Streams) return json.Marshal(objectMap) } @@ -11058,6 +12349,9 @@ func (w *WindowsFirewallLogsDataSource) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &w.Name) delete(rawMsg, key) + case "profileFilter": + err = unpopulate(val, "ProfileFilter", &w.ProfileFilter) + delete(rawMsg, key) case "streams": err = unpopulate(val, "Streams", &w.Streams) delete(rawMsg, key) @@ -11152,7 +12446,7 @@ func populateAny(m map[string]any, k string, v any) { } func unpopulate(data json.RawMessage, fn string, v any) error { - if data == nil { + if data == nil || string(data) == "null" { return nil } if err := json.Unmarshal(data, v); err != nil { diff --git a/sdk/resourcemanager/monitor/armmonitor/operations_client.go b/sdk/resourcemanager/monitor/armmonitor/operations_client.go index 1db6ae81d207..01a04b374467 100644 --- a/sdk/resourcemanager/monitor/armmonitor/operations_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/operations_client.go @@ -81,7 +81,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * // listHandleResponse handles the List response. func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { result := OperationsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResultAutoGenerated); err != nil { return OperationsClientListResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/monitor/armmonitor/operations_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/operations_client_example_test.go deleted file mode 100644 index 355e0f5525d9..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/operations_client_example_test.go +++ /dev/null @@ -1,433 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/OperationList.json -func ExampleOperationsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOperationsClient().List(ctx, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationListResult = armmonitor.OperationListResult{ - // Value: []*armmonitor.Operation{ - // { - // Name: to.Ptr("Microsoft.Insights/Operations/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Operations read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Operations"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/MetricDefinitions/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Metric definitions read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Metric Definitions"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Metrics/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Metrics read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Metrics"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AlertRules/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Alert Rule write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Alert Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AlertRules/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Alert Rule delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Alert Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AlertRules/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Alert Rule read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Alert Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/MetricAlerts/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Metric alert write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Metric alerts"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/MetricAlerts/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Metric alert delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Metric alerts"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/MetricAlerts/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Metric alert read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Metric alerts"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AutoscaleSettings/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Autoscale Setting write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Autoscale"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AutoscaleSettings/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Autoscale Setting delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Autoscale"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AutoscaleSettings/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Autoscale Setting read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Autoscale"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AlertRules/Incidents/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Alert Rule Incidents read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Alert Rule Incident resource"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AutoscaleSettings/providers/Microsoft.Insights/MetricDefinitions/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Metric definitions read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Metric Definitions"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ActionGroups/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Action group write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Action groups"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ActionGroups/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Action group delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Action groups"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ActionGroups/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Action group read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Action groups"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ActivityLogAlerts/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Activity log alert read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Activity log alert"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ActivityLogAlerts/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Activity log alert delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Activity log alert"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ActivityLogAlerts/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Activity log alert read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Activity log alert"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ActivityLogAlerts/Activated/Action"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Activity Log Alert Activated"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Activity Log Alert"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/EventCategories/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Event category read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Event category"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/eventtypes/values/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Event types management values read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Events"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/eventtypes/digestevents/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Event types management digest read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Digest events"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/DiagnosticSettings/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Diagnostic settings write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Diagnostic settings"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/DiagnosticSettings/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Diagnostic settings delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Diagnostic settings"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/DiagnosticSettings/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Diagnostic settings read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Diagnostic settings"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ExtendedDiagnosticSettings/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Extended Diagnostic settings write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Extended Diagnostic settings"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ExtendedDiagnosticSettings/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Extended Diagnostic settings delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Extended Diagnostic settings"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ExtendedDiagnosticSettings/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Extended Diagnostic settings read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Extended Diagnostic settings"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/LogProfiles/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Log profile write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Log Profiles"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/LogProfiles/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Log profile delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Log Profiles"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/LogProfiles/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Log profile read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Log Profiles"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/LogDefinitions/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Log Definitions read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Log Definitions"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AutoscaleSettings/Scaleup/Action"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Autoscale scale up operation"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Autoscale"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AutoscaleSettings/Scaledown/Action"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Autoscale scale down operation"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Autoscale"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AlertRules/Activated/Action"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Alert Rule activated"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Alert Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AlertRules/Resolved/Action"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Alert Rule resolved"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Alert Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AlertRules/Throttled/Action"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Alert Rule throttled"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Alert Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Register/Action"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Register Microsoft.Insights"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Microsoft.Insights"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Components/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Application insights component write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Application insights components"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Components/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Application insights component delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Application insights components"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Components/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Application insights component read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Application insights components"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Webtests/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Webtest write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Web tests"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Webtests/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Webtest delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Web tests"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Workbooks/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Workbooks read"), - // Provider: to.Ptr("Microsoft Application Insights"), - // Resource: to.Ptr("Workbooks"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Workbooks/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Workbooks write"), - // Provider: to.Ptr("Microsoft Application Insights"), - // Resource: to.Ptr("Workbooks"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Workbooks/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Workbooks delete"), - // Provider: to.Ptr("Microsoft Application Insights"), - // Resource: to.Ptr("Workbooks"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Workbooks/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Workbooks read"), - // Provider: to.Ptr("Microsoft Application Insights"), - // Resource: to.Ptr("Workbooks"), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client.go b/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client.go index 1f4659654f7e..3ecda33ba6d5 100644 --- a/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client.go @@ -39,7 +39,7 @@ func NewOperationsForMonitorClient(credential azcore.TokenCredential, options *a // NewListPager - Lists available Operations for this Resource Provider // -// Generated from API version 2021-06-03-preview +// Generated from API version 2023-04-03 // - options - OperationsForMonitorClientListOptions contains the optional parameters for the OperationsForMonitorClient.NewListPager // method. func (client *OperationsForMonitorClient) NewListPager(options *OperationsForMonitorClientListOptions) *runtime.Pager[OperationsForMonitorClientListResponse] { @@ -73,7 +73,7 @@ func (client *OperationsForMonitorClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-03-preview") + reqQP.Set("api-version", "2023-04-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -82,7 +82,7 @@ func (client *OperationsForMonitorClient) listCreateRequest(ctx context.Context, // listHandleResponse handles the List response. func (client *OperationsForMonitorClient) listHandleResponse(resp *http.Response) (OperationsForMonitorClientListResponse, error) { result := OperationsForMonitorClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResultAutoGenerated); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { return OperationsForMonitorClientListResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client_example_test.go deleted file mode 100644 index 19685e884442..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client_example_test.go +++ /dev/null @@ -1,101 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/OperationsGet.json -func ExampleOperationsForMonitorClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsForMonitorClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResultAutoGenerated = armmonitor.OperationListResultAutoGenerated{ - // Value: []*armmonitor.OperationAutoGenerated{ - // { - // Name: to.Ptr("microsoft.monitor/accounts/read"), - // Display: &armmonitor.OperationDisplayAutoGenerated{ - // Description: to.Ptr("Read any Azure Monitor Workspace"), - // Operation: to.Ptr("Read Azure Monitor Workspaces"), - // Provider: to.Ptr("Microsoft Monitoring"), - // Resource: to.Ptr("Azure Monitor Workspaces"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armmonitor.Origin("user, system")), - // }, - // { - // Name: to.Ptr("microsoft.monitor/accounts/write"), - // Display: &armmonitor.OperationDisplayAutoGenerated{ - // Description: to.Ptr("Create or Update any Azure Monitor Workspace"), - // Operation: to.Ptr("Create or Update Azure Monitor Workspaces"), - // Provider: to.Ptr("Microsoft Monitoring"), - // Resource: to.Ptr("Azure Monitor Workspaces"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armmonitor.Origin("user, system")), - // }, - // { - // Name: to.Ptr("microsoft.monitor/accounts/delete"), - // Display: &armmonitor.OperationDisplayAutoGenerated{ - // Description: to.Ptr("Delete any Azure Monitor Workspace"), - // Operation: to.Ptr("Delete Azure Monitor Workspaces"), - // Provider: to.Ptr("Microsoft Monitoring"), - // Resource: to.Ptr("Azure Monitor Workspaces"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armmonitor.Origin("user, system")), - // }, - // { - // Name: to.Ptr("microsoft.monitor/accounts/metrics/read"), - // Display: &armmonitor.OperationDisplayAutoGenerated{ - // Description: to.Ptr("Read Azure Monitor Workspace metrics"), - // Operation: to.Ptr("Read Azure Monitor Workspace metrics"), - // Provider: to.Ptr("Microsoft Monitoring"), - // Resource: to.Ptr("Azure Monitor Workspaces"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armmonitor.Origin("user, system")), - // }, - // { - // Name: to.Ptr("microsoft.monitor/accounts/data/metrics/read"), - // Display: &armmonitor.OperationDisplayAutoGenerated{ - // Description: to.Ptr("Read metrics data in any Azure Monitor Workspace"), - // Operation: to.Ptr("Read Metrics Data"), - // Provider: to.Ptr("Microsoft Monitoring"), - // Resource: to.Ptr("Azure Monitor Workspaces"), - // }, - // IsDataAction: to.Ptr(true), - // Origin: to.Ptr(armmonitor.Origin("user, system")), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/options.go b/sdk/resourcemanager/monitor/armmonitor/options.go index b737f70d4922..05c02aef5353 100644 --- a/sdk/resourcemanager/monitor/armmonitor/options.go +++ b/sdk/resourcemanager/monitor/armmonitor/options.go @@ -15,6 +15,13 @@ type ActionGroupsClientBeginCreateNotificationsAtActionGroupResourceLevelOptions ResumeToken string } +// ActionGroupsClientBeginReconcileNSPOptions contains the optional parameters for the ActionGroupsClient.BeginReconcileNSP +// method. +type ActionGroupsClientBeginReconcileNSPOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // ActionGroupsClientCreateOrUpdateOptions contains the optional parameters for the ActionGroupsClient.CreateOrUpdate method. type ActionGroupsClientCreateOrUpdateOptions struct { // placeholder for future optional parameters @@ -30,6 +37,11 @@ type ActionGroupsClientEnableReceiverOptions struct { // placeholder for future optional parameters } +// ActionGroupsClientGetNSPOptions contains the optional parameters for the ActionGroupsClient.GetNSP method. +type ActionGroupsClientGetNSPOptions struct { + // placeholder for future optional parameters +} + // ActionGroupsClientGetOptions contains the optional parameters for the ActionGroupsClient.Get method. type ActionGroupsClientGetOptions struct { // placeholder for future optional parameters @@ -53,6 +65,11 @@ type ActionGroupsClientListBySubscriptionIDOptions struct { // placeholder for future optional parameters } +// ActionGroupsClientListNSPOptions contains the optional parameters for the ActionGroupsClient.NewListNSPPager method. +type ActionGroupsClientListNSPOptions struct { + // placeholder for future optional parameters +} + // ActionGroupsClientUpdateOptions contains the optional parameters for the ActionGroupsClient.Update method. type ActionGroupsClientUpdateOptions struct { // placeholder for future optional parameters @@ -177,15 +194,16 @@ type AutoscaleSettingsClientUpdateOptions struct { // placeholder for future optional parameters } -// AzureMonitorWorkspacesClientCreateOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Create +// AzureMonitorWorkspacesClientBeginDeleteOptions contains the optional parameters for the AzureMonitorWorkspacesClient.BeginDelete // method. -type AzureMonitorWorkspacesClientCreateOptions struct { - // placeholder for future optional parameters +type AzureMonitorWorkspacesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string } -// AzureMonitorWorkspacesClientDeleteOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Delete +// AzureMonitorWorkspacesClientCreateOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Create // method. -type AzureMonitorWorkspacesClientDeleteOptions struct { +type AzureMonitorWorkspacesClientCreateOptions struct { // placeholder for future optional parameters } @@ -250,6 +268,26 @@ type BaselinesClientListOptions struct { Timespan *string } +// ClientBeginCreateNotificationsAtTenantActionGroupResourceLevelOptions contains the optional parameters for the Client.BeginCreateNotificationsAtTenantActionGroupResourceLevel +// method. +type ClientBeginCreateNotificationsAtTenantActionGroupResourceLevelOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientGetTestNotificationsAtTenantActionGroupResourceLevelOptions contains the optional parameters for the Client.GetTestNotificationsAtTenantActionGroupResourceLevel +// method. +type ClientGetTestNotificationsAtTenantActionGroupResourceLevelOptions struct { + // placeholder for future optional parameters +} + +// DataCollectionEndpointsClientBeginReconcileNSPOptions contains the optional parameters for the DataCollectionEndpointsClient.BeginReconcileNSP +// method. +type DataCollectionEndpointsClientBeginReconcileNSPOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // DataCollectionEndpointsClientCreateOptions contains the optional parameters for the DataCollectionEndpointsClient.Create // method. type DataCollectionEndpointsClientCreateOptions struct { @@ -263,6 +301,12 @@ type DataCollectionEndpointsClientDeleteOptions struct { // placeholder for future optional parameters } +// DataCollectionEndpointsClientGetNSPOptions contains the optional parameters for the DataCollectionEndpointsClient.GetNSP +// method. +type DataCollectionEndpointsClientGetNSPOptions struct { + // placeholder for future optional parameters +} + // DataCollectionEndpointsClientGetOptions contains the optional parameters for the DataCollectionEndpointsClient.Get method. type DataCollectionEndpointsClientGetOptions struct { // placeholder for future optional parameters @@ -280,6 +324,12 @@ type DataCollectionEndpointsClientListBySubscriptionOptions struct { // placeholder for future optional parameters } +// DataCollectionEndpointsClientListNSPOptions contains the optional parameters for the DataCollectionEndpointsClient.NewListNSPPager +// method. +type DataCollectionEndpointsClientListNSPOptions struct { + // placeholder for future optional parameters +} + // DataCollectionEndpointsClientUpdateOptions contains the optional parameters for the DataCollectionEndpointsClient.Update // method. type DataCollectionEndpointsClientUpdateOptions struct { @@ -332,7 +382,8 @@ type DataCollectionRulesClientCreateOptions struct { // DataCollectionRulesClientDeleteOptions contains the optional parameters for the DataCollectionRulesClient.Delete method. type DataCollectionRulesClientDeleteOptions struct { - // placeholder for future optional parameters + // If set to 'true' then all associations of this data collection rule will also be deleted + DeleteAssociations *bool } // DataCollectionRulesClientGetOptions contains the optional parameters for the DataCollectionRulesClient.Get method. @@ -486,7 +537,7 @@ type MetricNamespacesClientListOptions struct { // MetricsClientListAtSubscriptionScopeOptions contains the optional parameters for the MetricsClient.ListAtSubscriptionScope // method. type MetricsClientListAtSubscriptionScopeOptions struct { - // The list of aggregation types (comma separated) to retrieve. + // The list of aggregation types (comma separated) to retrieve.Examples: average, minimum, maximum Aggregation *string // When set to true, if the timespan passed in is not supported by this metric, the API will return the result using the closest @@ -508,7 +559,9 @@ type MetricsClientListAtSubscriptionScopeOptions struct { // $filter=A eq ‘a1’ and B eq ‘’ and C eq ‘’. Filter *string - // The interval (i.e. timegrain) of the query. + // The interval (i.e. timegrain) of the query in ISO 8601 duration format. Defaults to PT1M. Special case for 'FULL' value + // that returns single datapoint for entire time span requested.Examples: PT15M, + // PT1H, P1D, FULL Interval *string // The names of the metrics (comma separated) to retrieve. @@ -517,17 +570,23 @@ type MetricsClientListAtSubscriptionScopeOptions struct { // Metric namespace where the metrics you want reside. Metricnamespace *string - // The aggregation to use for sorting results and the direction of the sort. Only one order can be specified. Examples: sum - // asc. + // The aggregation to use for sorting results and the direction of the sort. Only one order can be specified.Examples: sum + // asc Orderby *string // Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details. ResultType *MetricResultType + // 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 + // The timespan of the query. It is a string with the following format 'startDateTimeISO/endDateTimeISO'. Timespan *string - // The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10. + // The maximum number of records to retrieve per resource ID in the request. Valid only if filter is specified. Defaults to + // 10. Top *int32 // When set to false, invalid filter parameter values will be ignored. When set to true, an error is returned for invalid @@ -538,7 +597,7 @@ type MetricsClientListAtSubscriptionScopeOptions struct { // MetricsClientListAtSubscriptionScopePostOptions contains the optional parameters for the MetricsClient.ListAtSubscriptionScopePost // method. type MetricsClientListAtSubscriptionScopePostOptions struct { - // The list of aggregation types (comma separated) to retrieve. + // The list of aggregation types (comma separated) to retrieve.Examples: average, minimum, maximum Aggregation *string // When set to true, if the timespan passed in is not supported by this metric, the API will return the result using the closest @@ -563,7 +622,9 @@ type MetricsClientListAtSubscriptionScopePostOptions struct { // $filter=A eq ‘a1’ and B eq ‘’ and C eq ‘’. Filter *string - // The interval (i.e. timegrain) of the query. + // The interval (i.e. timegrain) of the query in ISO 8601 duration format. Defaults to PT1M. Special case for 'FULL' value + // that returns single datapoint for entire time span requested.Examples: PT15M, + // PT1H, P1D, FULL Interval *string // The names of the metrics (comma separated) to retrieve. @@ -572,17 +633,23 @@ type MetricsClientListAtSubscriptionScopePostOptions struct { // Metric namespace where the metrics you want reside. Metricnamespace *string - // The aggregation to use for sorting results and the direction of the sort. Only one order can be specified. Examples: sum - // asc. + // The aggregation to use for sorting results and the direction of the sort. Only one order can be specified.Examples: sum + // asc Orderby *string // Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details. ResultType *MetricResultType + // 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 + // The timespan of the query. It is a string with the following format 'startDateTimeISO/endDateTimeISO'. Timespan *string - // The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10. + // The maximum number of records to retrieve per resource ID in the request. Valid only if filter is specified. Defaults to + // 10. Top *int32 // When set to false, invalid filter parameter values will be ignored. When set to true, an error is returned for invalid @@ -592,7 +659,7 @@ type MetricsClientListAtSubscriptionScopePostOptions struct { // MetricsClientListOptions contains the optional parameters for the MetricsClient.List method. type MetricsClientListOptions struct { - // The list of aggregation types (comma separated) to retrieve. + // The list of aggregation types (comma separated) to retrieve.Examples: average, minimum, maximum Aggregation *string // When set to true, if the timespan passed in is not supported by this metric, the API will return the result using the closest @@ -614,7 +681,9 @@ type MetricsClientListOptions struct { // $filter=A eq ‘a1’ and B eq ‘’ and C eq ‘’. Filter *string - // The interval (i.e. timegrain) of the query. + // The interval (i.e. timegrain) of the query in ISO 8601 duration format. Defaults to PT1M. Special case for 'FULL' value + // that returns single datapoint for entire time span requested.Examples: PT15M, + // PT1H, P1D, FULL Interval *string // The names of the metrics (comma separated) to retrieve. @@ -623,17 +692,23 @@ type MetricsClientListOptions struct { // Metric namespace where the metrics you want reside. Metricnamespace *string - // The aggregation to use for sorting results and the direction of the sort. Only one order can be specified. Examples: sum - // asc. + // The aggregation to use for sorting results and the direction of the sort. Only one order can be specified.Examples: sum + // asc Orderby *string // Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details. ResultType *ResultType + // 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 + // The timespan of the query. It is a string with the following format 'startDateTimeISO/endDateTimeISO'. Timespan *string - // The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10. + // The maximum number of records to retrieve per resource ID in the request. Valid only if filter is specified. Defaults to + // 10. Top *int32 // When set to false, invalid filter parameter values will be ignored. When set to true, an error is returned for invalid @@ -760,6 +835,24 @@ type PrivateLinkScopesClientUpdateTagsOptions struct { // placeholder for future optional parameters } +// ScheduledQueryRuleClientBeginReconcileNSPOptions contains the optional parameters for the ScheduledQueryRuleClient.BeginReconcileNSP +// method. +type ScheduledQueryRuleClientBeginReconcileNSPOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ScheduledQueryRuleClientGetNSPOptions contains the optional parameters for the ScheduledQueryRuleClient.GetNSP method. +type ScheduledQueryRuleClientGetNSPOptions struct { + // placeholder for future optional parameters +} + +// ScheduledQueryRuleClientListNSPOptions contains the optional parameters for the ScheduledQueryRuleClient.NewListNSPPager +// method. +type ScheduledQueryRuleClientListNSPOptions struct { + // placeholder for future optional parameters +} + // ScheduledQueryRulesClientCreateOrUpdateOptions contains the optional parameters for the ScheduledQueryRulesClient.CreateOrUpdate // method. type ScheduledQueryRulesClientCreateOrUpdateOptions struct { diff --git a/sdk/resourcemanager/monitor/armmonitor/polymorphic_helpers.go b/sdk/resourcemanager/monitor/armmonitor/polymorphic_helpers.go index 1f0b3c87ddb2..f4b7b00af54f 100644 --- a/sdk/resourcemanager/monitor/armmonitor/polymorphic_helpers.go +++ b/sdk/resourcemanager/monitor/armmonitor/polymorphic_helpers.go @@ -11,7 +11,7 @@ package armmonitor import "encoding/json" func unmarshalMetricAlertCriteriaClassification(rawMsg json.RawMessage) (MetricAlertCriteriaClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -36,7 +36,7 @@ func unmarshalMetricAlertCriteriaClassification(rawMsg json.RawMessage) (MetricA } func unmarshalMultiMetricCriteriaClassification(rawMsg json.RawMessage) (MultiMetricCriteriaClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -59,7 +59,7 @@ func unmarshalMultiMetricCriteriaClassification(rawMsg json.RawMessage) (MultiMe } func unmarshalMultiMetricCriteriaClassificationArray(rawMsg json.RawMessage) ([]MultiMetricCriteriaClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var rawMessages []json.RawMessage @@ -78,7 +78,7 @@ func unmarshalMultiMetricCriteriaClassificationArray(rawMsg json.RawMessage) ([] } func unmarshalRuleActionClassification(rawMsg json.RawMessage) (RuleActionClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -101,7 +101,7 @@ func unmarshalRuleActionClassification(rawMsg json.RawMessage) (RuleActionClassi } func unmarshalRuleActionClassificationArray(rawMsg json.RawMessage) ([]RuleActionClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var rawMessages []json.RawMessage @@ -120,7 +120,7 @@ func unmarshalRuleActionClassificationArray(rawMsg json.RawMessage) ([]RuleActio } func unmarshalRuleConditionClassification(rawMsg json.RawMessage) (RuleConditionClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -145,7 +145,7 @@ func unmarshalRuleConditionClassification(rawMsg json.RawMessage) (RuleCondition } func unmarshalRuleDataSourceClassification(rawMsg json.RawMessage) (RuleDataSourceClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any diff --git a/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client.go b/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client.go index 698a72d55834..c47c5e9cc25f 100644 --- a/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client.go @@ -28,7 +28,7 @@ type PredictiveMetricClient struct { } // NewPredictiveMetricClient creates a new instance of PredictiveMetricClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPredictiveMetricClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PredictiveMetricClient, error) { @@ -98,12 +98,12 @@ func (client *PredictiveMetricClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("timespan", timespan) - reqQP.Set("interval", interval) - reqQP.Set("metricNamespace", metricNamespace) - reqQP.Set("metricName", metricName) reqQP.Set("aggregation", aggregation) reqQP.Set("api-version", "2022-10-01") + reqQP.Set("interval", interval) + reqQP.Set("metricName", metricName) + reqQP.Set("metricNamespace", metricNamespace) + reqQP.Set("timespan", timespan) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client_example_test.go deleted file mode 100644 index 71d9445a99f2..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client_example_test.go +++ /dev/null @@ -1,61 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/GetPredictiveMetric.json -func ExamplePredictiveMetricClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPredictiveMetricClient().Get(ctx, "myRG", "vmss1-Autoscale-775", "2021-10-14T22:00:00.000Z/2021-10-16T22:00:00.000Z", "PT1H", "Microsoft.Compute/virtualMachineScaleSets", "PercentageCPU", "Total", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PredictiveResponse = armmonitor.PredictiveResponse{ - // Data: []*armmonitor.PredictiveValue{ - // { - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-14T22:00:00.000Z"); return t}()), - // Value: to.Ptr[float64](123), - // }, - // { - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-14T22:02:00.000Z"); return t}()), - // Value: to.Ptr[float64](120), - // }, - // { - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-14T22:02:00.000Z"); return t}()), - // Value: to.Ptr[float64](88), - // }, - // { - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-14T22:03:00.000Z"); return t}()), - // Value: to.Ptr[float64](100), - // }}, - // Interval: to.Ptr("PT1H"), - // MetricName: to.Ptr("PercentageCPU"), - // TargetResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1"), - // Timespan: to.Ptr("2021-10-14T22:00:00.000Z/2021-10-16T22:00:00.000Z"), - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client.go b/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client.go index 140bdc5484a6..26621b094c33 100644 --- a/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client.go @@ -28,7 +28,7 @@ type PrivateEndpointConnectionsClient struct { } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { @@ -52,7 +52,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // - privateEndpointConnectionName - The name of the private endpoint connection. // - options - PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate // method. -func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[PrivateEndpointConnectionsClientCreateOrUpdateResponse], error) { +func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnectionAutoGenerated, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[PrivateEndpointConnectionsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, scopeName, privateEndpointConnectionName, parameters, options) if err != nil { @@ -73,7 +73,7 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2021-07-01-preview -func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { +func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnectionAutoGenerated, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginCreateOrUpdate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) @@ -95,7 +95,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Conte } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnectionAutoGenerated, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -272,7 +272,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con // getHandleResponse handles the Get response. func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientGetResponse, error) { result := PrivateEndpointConnectionsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionAutoGenerated); err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client_example_test.go deleted file mode 100644 index beac5fb035f5..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client_example_test.go +++ /dev/null @@ -1,178 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateEndpointConnectionGet.json -func ExamplePrivateEndpointConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "MyResourceGroup", "MyPrivateLinkScope", "private-endpoint-connection-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armmonitor.PrivateEndpointConnection{ - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/privateEndpointConnections/private-endpoint-connection-name"), - // Properties: &armmonitor.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmonitor.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armmonitor.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armmonitor.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armmonitor.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateEndpointConnectionUpdate.json -func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginCreateOrUpdate(ctx, "MyResourceGroup", "MyPrivateLinkScope", "private-endpoint-connection-name", armmonitor.PrivateEndpointConnection{ - Properties: &armmonitor.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armmonitor.PrivateLinkServiceConnectionState{ - Description: to.Ptr("Approved by johndoe@contoso.com"), - Status: to.Ptr(armmonitor.PrivateEndpointServiceConnectionStatusApproved), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armmonitor.PrivateEndpointConnection{ - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/privateEndpointConnections/private-endpoint-connection-name"), - // Properties: &armmonitor.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmonitor.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armmonitor.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Approved by johndoe@contoso.com"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armmonitor.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armmonitor.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateEndpointConnectionDelete.json -func ExamplePrivateEndpointConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "MyResourceGroup", "MyPrivateLinkScope", "private-endpoint-connection-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateEndpointConnectionList.json -func ExamplePrivateEndpointConnectionsClient_ListByPrivateLinkScope() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().ListByPrivateLinkScope(ctx, "MyResourceGroup", "MyPrivateLinkScope", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnectionListResult = armmonitor.PrivateEndpointConnectionListResult{ - // Value: []*armmonitor.PrivateEndpointConnection{ - // { - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/privateEndpointConnections/private-endpoint-connection-name-2"), - // Properties: &armmonitor.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmonitor.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armmonitor.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armmonitor.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armmonitor.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("private-endpoint-connection-name-2"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/privateEndpointConnections/private-endpoint-connection-name-2"), - // Properties: &armmonitor.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmonitor.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name-2"), - // }, - // PrivateLinkServiceConnectionState: &armmonitor.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Please approve my connection."), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armmonitor.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armmonitor.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client.go index 748423399549..0816dd30b6d9 100644 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client.go @@ -28,7 +28,7 @@ type PrivateLinkResourcesClient struct { } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client_example_test.go deleted file mode 100644 index 3d2730ab12e0..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client_example_test.go +++ /dev/null @@ -1,105 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopePrivateLinkResourceListGet.json -func ExamplePrivateLinkResourcesClient_ListByPrivateLinkScope() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkResourcesClient().ListByPrivateLinkScope(ctx, "MyResourceGroup", "MyPrivateLinkScope", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkResourceListResult = armmonitor.PrivateLinkResourceListResult{ - // Value: []*armmonitor.PrivateLinkResource{ - // { - // Name: to.Ptr("azuremonitor"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/privateLinkResources"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/privateLinkResources/azuremonitor"), - // Properties: &armmonitor.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("azuremonitor"), - // RequiredMembers: []*string{ - // to.Ptr("api"), - // to.Ptr("global.in.ai"), - // to.Ptr("profiler"), - // to.Ptr("live"), - // to.Ptr("snapshot"), - // to.Ptr("agentsolutionpackstore"), - // to.Ptr("dce-global")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.monitor.azure.com"), - // to.Ptr("privatelink.oms.opinsights.azure.com"), - // to.Ptr("privatelink.ods.opinsights.azure.com"), - // to.Ptr("privatelink.agentsvc.azure-automation.net"), - // to.Ptr("privatelink.blob.core.windows.net")}, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopePrivateLinkResourceGet.json -func ExamplePrivateLinkResourcesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkResourcesClient().Get(ctx, "MyResourceGroup", "MyPrivateLinkScope", "azuremonitor", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkResource = armmonitor.PrivateLinkResource{ - // Name: to.Ptr("azuremonitor"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/privateLinkResources"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/privateLinkResources/azuremonitor"), - // Properties: &armmonitor.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("azuremonitor"), - // RequiredMembers: []*string{ - // to.Ptr("api"), - // to.Ptr("global.in.ai"), - // to.Ptr("profiler"), - // to.Ptr("live"), - // to.Ptr("snapshot"), - // to.Ptr("agentsolutionpackstore"), - // to.Ptr("dce-global")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.monitor.azure.com"), - // to.Ptr("privatelink.oms.opinsights.azure.com"), - // to.Ptr("privatelink.ods.opinsights.azure.com"), - // to.Ptr("privatelink.agentsvc.azure-automation.net"), - // to.Ptr("privatelink.blob.core.windows.net")}, - // }, - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client.go index b95b70511c0b..f4ef459e442a 100644 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client.go @@ -28,7 +28,7 @@ type PrivateLinkScopedResourcesClient struct { } // NewPrivateLinkScopedResourcesClient creates a new instance of PrivateLinkScopedResourcesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPrivateLinkScopedResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkScopedResourcesClient, error) { diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client_example_test.go deleted file mode 100644 index 00798ed9e730..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client_example_test.go +++ /dev/null @@ -1,184 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopedResourceGet.json -func ExamplePrivateLinkScopedResourcesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopedResourcesClient().Get(ctx, "MyResourceGroup", "MyPrivateLinkScope", "scoped-resource-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ScopedResource = armmonitor.ScopedResource{ - // Name: to.Ptr("scoped-resource-name"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/scopedResources"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/scopedResources/scoped-resource-name"), - // Properties: &armmonitor.ScopedResourceProperties{ - // LinkedResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/components/my-component"), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopedResourceUpdate.json -func ExamplePrivateLinkScopedResourcesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateLinkScopedResourcesClient().BeginCreateOrUpdate(ctx, "MyResourceGroup", "MyPrivateLinkScope", "scoped-resource-name", armmonitor.ScopedResource{ - Properties: &armmonitor.ScopedResourceProperties{ - LinkedResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/components/my-component"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ScopedResource = armmonitor.ScopedResource{ - // Name: to.Ptr("scoped-resource-name"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/scopedResources"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/scopedResources/scoped-resource-name"), - // Properties: &armmonitor.ScopedResourceProperties{ - // LinkedResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/components/my-component"), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopedResourceDelete.json -func ExamplePrivateLinkScopedResourcesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateLinkScopedResourcesClient().BeginDelete(ctx, "MyResourceGroup", "MyPrivateLinkScope", "scoped-resource-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopedResourceList.json -func ExamplePrivateLinkScopedResourcesClient_NewListByPrivateLinkScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkScopedResourcesClient().NewListByPrivateLinkScopePager("MyResourceGroup", "MyPrivateLinkScope", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ScopedResourceListResult = armmonitor.ScopedResourceListResult{ - // Value: []*armmonitor.ScopedResource{ - // { - // Name: to.Ptr("scoped-resource-name"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/scopedResources"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/scopedResources/scoped-resource-name"), - // Properties: &armmonitor.ScopedResourceProperties{ - // LinkedResourceID: to.Ptr("/subscriptions/00000000-0000-2222-3333-444444444444/resourceGroups/MyComponentResourceGroup/providers/Microsoft.Insights/components/my-component"), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("other-scoped-resource-name"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/scopedResources"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/scopedResources/other-scoped-resource-name"), - // Properties: &armmonitor.ScopedResourceProperties{ - // LinkedResourceID: to.Ptr("/subscriptions/00000000-3333-2222-5555-444444444444/resourceGroups/MyWorkspaceResourceGroup/providers/Microsoft.OperationalInsights/workspaces/my-workspace"), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client.go index 9f73ea7a6bca..c24e821b30b9 100644 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client.go @@ -28,7 +28,7 @@ type PrivateLinkScopeOperationStatusClient struct { } // NewPrivateLinkScopeOperationStatusClient creates a new instance of PrivateLinkScopeOperationStatusClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPrivateLinkScopeOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkScopeOperationStatusClient, error) { diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client_example_test.go deleted file mode 100644 index d8612988e855..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client_example_test.go +++ /dev/null @@ -1,45 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/privateLinkScopeOperationStatuses.json -func ExamplePrivateLinkScopeOperationStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopeOperationStatusClient().Get(ctx, "713192d7-503f-477a-9cfe-4efc3ee2bd11", "MyResourceGroup", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationStatus = armmonitor.OperationStatus{ - // Name: to.Ptr("713192d7-503f-477a-9cfe-4efc3ee2bd11"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-01-01T16:13:13.933Z"); return t}()), - // ID: to.Ptr("/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopeOperationStatuses/713192d7-503f-477a-9cfe-4efc3ee2bd11"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-01-01T13:13:13.933Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client.go index 228ac97d775c..c21c06b669ac 100644 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client.go @@ -28,7 +28,7 @@ type PrivateLinkScopesClient struct { } // NewPrivateLinkScopesClient creates a new instance of PrivateLinkScopesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPrivateLinkScopesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkScopesClient, error) { diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client_example_test.go deleted file mode 100644 index d45d301cfd2a..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client_example_test.go +++ /dev/null @@ -1,405 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesList.json -func ExamplePrivateLinkScopesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkScopesClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AzureMonitorPrivateLinkScopeListResult = armmonitor.AzureMonitorPrivateLinkScopeListResult{ - // Value: []*armmonitor.AzureMonitorPrivateLinkScope{ - // { - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.insights/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("my-other-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-other-resource-group/providers/microsoft.insights/privateLinkScopes/my-other-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesListByResourceGroup.json -func ExamplePrivateLinkScopesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkScopesClient().NewListByResourceGroupPager("my-resource-group", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AzureMonitorPrivateLinkScopeListResult = armmonitor.AzureMonitorPrivateLinkScopeListResult{ - // Value: []*armmonitor.AzureMonitorPrivateLinkScope{ - // { - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.insights/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("my-other-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.insights/privateLinkScopes/my-other-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesDelete.json -func ExamplePrivateLinkScopesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateLinkScopesClient().BeginDelete(ctx, "my-resource-group", "my-privatelinkscope", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesGet.json -func ExamplePrivateLinkScopesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopesClient().Get(ctx, "my-resource-group", "my-privatelinkscope", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureMonitorPrivateLinkScope = armmonitor.AzureMonitorPrivateLinkScope{ - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.insights/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesCreate.json -func ExamplePrivateLinkScopesClient_CreateOrUpdate_privateLinkScopeCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopesClient().CreateOrUpdate(ctx, "my-resource-group", "my-privatelinkscope", armmonitor.AzureMonitorPrivateLinkScope{ - Location: to.Ptr("Global"), - Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - AccessModeSettings: &armmonitor.AccessModeSettings{ - Exclusions: []*armmonitor.AccessModeSettingsExclusion{}, - IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureMonitorPrivateLinkScope = armmonitor.AzureMonitorPrivateLinkScope{ - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.insights/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesUpdate.json -func ExamplePrivateLinkScopesClient_CreateOrUpdate_privateLinkScopeUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopesClient().CreateOrUpdate(ctx, "my-resource-group", "my-privatelinkscope", armmonitor.AzureMonitorPrivateLinkScope{ - Location: to.Ptr("Global"), - Tags: map[string]*string{ - "Tag1": to.Ptr("Value1"), - }, - Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - AccessModeSettings: &armmonitor.AccessModeSettings{ - Exclusions: []*armmonitor.AccessModeSettingsExclusion{}, - IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureMonitorPrivateLinkScope = armmonitor.AzureMonitorPrivateLinkScope{ - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.insights/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // "Tag1": to.Ptr("Value1"), - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesUpdateTagsOnly.json -func ExamplePrivateLinkScopesClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopesClient().UpdateTags(ctx, "my-resource-group", "my-privatelinkscope", armmonitor.TagsResource{ - Tags: map[string]*string{ - "Tag1": to.Ptr("Value1"), - "Tag2": to.Ptr("Value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureMonitorPrivateLinkScope = armmonitor.AzureMonitorPrivateLinkScope{ - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/microsoft.insights/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // "Tag1": to.Ptr("Value1"), - // "Tag2": to.Ptr("Value2"), - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/response_types.go b/sdk/resourcemanager/monitor/armmonitor/responses.go similarity index 89% rename from sdk/resourcemanager/monitor/armmonitor/response_types.go rename to sdk/resourcemanager/monitor/armmonitor/responses.go index 812a8e44cf92..f2cb27c7afd3 100644 --- a/sdk/resourcemanager/monitor/armmonitor/response_types.go +++ b/sdk/resourcemanager/monitor/armmonitor/responses.go @@ -30,6 +30,12 @@ type ActionGroupsClientEnableReceiverResponse struct { // placeholder for future response values } +// ActionGroupsClientGetNSPResponse contains the response from method ActionGroupsClient.GetNSP. +type ActionGroupsClientGetNSPResponse struct { + // Network security perimeter (NSP) configuration resource + NetworkSecurityPerimeterConfiguration +} + // ActionGroupsClientGetResponse contains the response from method ActionGroupsClient.Get. type ActionGroupsClientGetResponse struct { // An action group resource. @@ -54,6 +60,17 @@ type ActionGroupsClientListBySubscriptionIDResponse struct { ActionGroupList } +// ActionGroupsClientListNSPResponse contains the response from method ActionGroupsClient.NewListNSPPager. +type ActionGroupsClientListNSPResponse struct { + // Result of a list NSP (network security perimeter) configurations request. + NetworkSecurityPerimeterConfigurationListResult +} + +// ActionGroupsClientReconcileNSPResponse contains the response from method ActionGroupsClient.BeginReconcileNSP. +type ActionGroupsClientReconcileNSPResponse struct { + // placeholder for future response values +} + // ActionGroupsClientUpdateResponse contains the response from method ActionGroupsClient.Update. type ActionGroupsClientUpdateResponse struct { // An action group resource. @@ -189,7 +206,7 @@ type AzureMonitorWorkspacesClientCreateResponse struct { AzureMonitorWorkspaceResource } -// AzureMonitorWorkspacesClientDeleteResponse contains the response from method AzureMonitorWorkspacesClient.Delete. +// AzureMonitorWorkspacesClientDeleteResponse contains the response from method AzureMonitorWorkspacesClient.BeginDelete. type AzureMonitorWorkspacesClientDeleteResponse struct { // placeholder for future response values } @@ -224,6 +241,18 @@ type BaselinesClientListResponse struct { MetricBaselinesResponse } +// ClientCreateNotificationsAtTenantActionGroupResourceLevelResponse contains the response from method Client.BeginCreateNotificationsAtTenantActionGroupResourceLevel. +type ClientCreateNotificationsAtTenantActionGroupResourceLevelResponse struct { + // The details of the test notification results. + TestNotificationDetailsResponseAutoGenerated +} + +// ClientGetTestNotificationsAtTenantActionGroupResourceLevelResponse contains the response from method Client.GetTestNotificationsAtTenantActionGroupResourceLevel. +type ClientGetTestNotificationsAtTenantActionGroupResourceLevelResponse struct { + // The details of the test notification results. + TestNotificationDetailsResponseAutoGenerated +} + // DataCollectionEndpointsClientCreateResponse contains the response from method DataCollectionEndpointsClient.Create. type DataCollectionEndpointsClientCreateResponse struct { // Definition of ARM tracked top level resource. @@ -235,6 +264,12 @@ type DataCollectionEndpointsClientDeleteResponse struct { // placeholder for future response values } +// DataCollectionEndpointsClientGetNSPResponse contains the response from method DataCollectionEndpointsClient.GetNSP. +type DataCollectionEndpointsClientGetNSPResponse struct { + // Network security perimeter (NSP) configuration resource + NetworkSecurityPerimeterConfiguration +} + // DataCollectionEndpointsClientGetResponse contains the response from method DataCollectionEndpointsClient.Get. type DataCollectionEndpointsClientGetResponse struct { // Definition of ARM tracked top level resource. @@ -253,6 +288,17 @@ type DataCollectionEndpointsClientListBySubscriptionResponse struct { DataCollectionEndpointResourceListResult } +// DataCollectionEndpointsClientListNSPResponse contains the response from method DataCollectionEndpointsClient.NewListNSPPager. +type DataCollectionEndpointsClientListNSPResponse struct { + // Result of a list NSP (network security perimeter) configurations request. + NetworkSecurityPerimeterConfigurationListResult +} + +// DataCollectionEndpointsClientReconcileNSPResponse contains the response from method DataCollectionEndpointsClient.BeginReconcileNSP. +type DataCollectionEndpointsClientReconcileNSPResponse struct { + // placeholder for future response values +} + // DataCollectionEndpointsClientUpdateResponse contains the response from method DataCollectionEndpointsClient.Update. type DataCollectionEndpointsClientUpdateResponse struct { // Definition of ARM tracked top level resource. @@ -467,14 +513,14 @@ type MetricNamespacesClientListResponse struct { // MetricsClientListAtSubscriptionScopePostResponse contains the response from method MetricsClient.ListAtSubscriptionScopePost. type MetricsClientListAtSubscriptionScopePostResponse struct { - // The response to a subscription scope metrics query. - SubscriptionScopeMetricResponse + // The response to a metrics query. + Response } // MetricsClientListAtSubscriptionScopeResponse contains the response from method MetricsClient.ListAtSubscriptionScope. type MetricsClientListAtSubscriptionScopeResponse struct { - // The response to a subscription scope metrics query. - SubscriptionScopeMetricResponse + // The response to a metrics query. + Response } // MetricsClientListResponse contains the response from method MetricsClient.List. @@ -487,13 +533,13 @@ type MetricsClientListResponse struct { type OperationsClientListResponse struct { // 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. - OperationListResult + OperationListResultAutoGenerated } // OperationsForMonitorClientListResponse contains the response from method OperationsForMonitorClient.NewListPager. type OperationsForMonitorClientListResponse struct { // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. - OperationListResultAutoGenerated + OperationListResult } // PredictiveMetricClientGetResponse contains the response from method PredictiveMetricClient.Get. @@ -505,7 +551,7 @@ type PredictiveMetricClientGetResponse struct { // PrivateEndpointConnectionsClientCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsClient.BeginCreateOrUpdate. type PrivateEndpointConnectionsClientCreateOrUpdateResponse struct { // The Private Endpoint Connection resource. - PrivateEndpointConnection + PrivateEndpointConnectionAutoGenerated } // PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.BeginDelete. @@ -516,7 +562,7 @@ type PrivateEndpointConnectionsClientDeleteResponse struct { // PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. type PrivateEndpointConnectionsClientGetResponse struct { // The Private Endpoint Connection resource. - PrivateEndpointConnection + PrivateEndpointConnectionAutoGenerated } // PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse contains the response from method PrivateEndpointConnectionsClient.ListByPrivateLinkScope. @@ -601,6 +647,23 @@ type PrivateLinkScopesClientUpdateTagsResponse struct { AzureMonitorPrivateLinkScope } +// ScheduledQueryRuleClientGetNSPResponse contains the response from method ScheduledQueryRuleClient.GetNSP. +type ScheduledQueryRuleClientGetNSPResponse struct { + // Network security perimeter (NSP) configuration resource + NetworkSecurityPerimeterConfiguration +} + +// ScheduledQueryRuleClientListNSPResponse contains the response from method ScheduledQueryRuleClient.NewListNSPPager. +type ScheduledQueryRuleClientListNSPResponse struct { + // Result of a list NSP (network security perimeter) configurations request. + NetworkSecurityPerimeterConfigurationListResult +} + +// ScheduledQueryRuleClientReconcileNSPResponse contains the response from method ScheduledQueryRuleClient.BeginReconcileNSP. +type ScheduledQueryRuleClientReconcileNSPResponse struct { + // placeholder for future response values +} + // ScheduledQueryRulesClientCreateOrUpdateResponse contains the response from method ScheduledQueryRulesClient.CreateOrUpdate. type ScheduledQueryRulesClientCreateOrUpdateResponse struct { // The scheduled query rule resource. diff --git a/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrule_client.go b/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrule_client.go new file mode 100644 index 000000000000..245c74183077 --- /dev/null +++ b/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrule_client.go @@ -0,0 +1,261 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmonitor + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ScheduledQueryRuleClient contains the methods for the ScheduledQueryRule group. +// Don't use this type directly, use NewScheduledQueryRuleClient() instead. +type ScheduledQueryRuleClient struct { + internal *arm.Client + subscriptionID string +} + +// NewScheduledQueryRuleClient creates a new instance of ScheduledQueryRuleClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewScheduledQueryRuleClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ScheduledQueryRuleClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ScheduledQueryRuleClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// GetNSP - Gets a network security perimeter configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - ruleName - The name of the rule. +// - networkSecurityPerimeterConfigurationName - The name for a network security perimeter configuration +// - options - ScheduledQueryRuleClientGetNSPOptions contains the optional parameters for the ScheduledQueryRuleClient.GetNSP +// method. +func (client *ScheduledQueryRuleClient) GetNSP(ctx context.Context, resourceGroupName string, ruleName string, networkSecurityPerimeterConfigurationName string, options *ScheduledQueryRuleClientGetNSPOptions) (ScheduledQueryRuleClientGetNSPResponse, error) { + var err error + const operationName = "ScheduledQueryRuleClient.GetNSP" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getNSPCreateRequest(ctx, resourceGroupName, ruleName, networkSecurityPerimeterConfigurationName, options) + if err != nil { + return ScheduledQueryRuleClientGetNSPResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledQueryRuleClientGetNSPResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ScheduledQueryRuleClientGetNSPResponse{}, err + } + resp, err := client.getNSPHandleResponse(httpResp) + return resp, err +} + +// getNSPCreateRequest creates the GetNSP request. +func (client *ScheduledQueryRuleClient) getNSPCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, networkSecurityPerimeterConfigurationName string, options *ScheduledQueryRuleClientGetNSPOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}/networkSecurityPerimeterConfigurations/{networkSecurityPerimeterConfigurationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if ruleName == "" { + return nil, errors.New("parameter ruleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) + if networkSecurityPerimeterConfigurationName == "" { + return nil, errors.New("parameter networkSecurityPerimeterConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkSecurityPerimeterConfigurationName}", url.PathEscape(networkSecurityPerimeterConfigurationName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getNSPHandleResponse handles the GetNSP response. +func (client *ScheduledQueryRuleClient) getNSPHandleResponse(resp *http.Response) (ScheduledQueryRuleClientGetNSPResponse, error) { + result := ScheduledQueryRuleClientGetNSPResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkSecurityPerimeterConfiguration); err != nil { + return ScheduledQueryRuleClientGetNSPResponse{}, err + } + return result, nil +} + +// NewListNSPPager - Gets a list of NSP configurations for specified scheduled query rule. +// +// Generated from API version 2021-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - ruleName - The name of the rule. +// - options - ScheduledQueryRuleClientListNSPOptions contains the optional parameters for the ScheduledQueryRuleClient.NewListNSPPager +// method. +func (client *ScheduledQueryRuleClient) NewListNSPPager(resourceGroupName string, ruleName string, options *ScheduledQueryRuleClientListNSPOptions) *runtime.Pager[ScheduledQueryRuleClientListNSPResponse] { + return runtime.NewPager(runtime.PagingHandler[ScheduledQueryRuleClientListNSPResponse]{ + More: func(page ScheduledQueryRuleClientListNSPResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ScheduledQueryRuleClientListNSPResponse) (ScheduledQueryRuleClientListNSPResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ScheduledQueryRuleClient.NewListNSPPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listNSPCreateRequest(ctx, resourceGroupName, ruleName, options) + }, nil) + if err != nil { + return ScheduledQueryRuleClientListNSPResponse{}, err + } + return client.listNSPHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listNSPCreateRequest creates the ListNSP request. +func (client *ScheduledQueryRuleClient) listNSPCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, options *ScheduledQueryRuleClientListNSPOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}/networkSecurityPerimeterConfigurations" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if ruleName == "" { + return nil, errors.New("parameter ruleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listNSPHandleResponse handles the ListNSP response. +func (client *ScheduledQueryRuleClient) listNSPHandleResponse(resp *http.Response) (ScheduledQueryRuleClientListNSPResponse, error) { + result := ScheduledQueryRuleClientListNSPResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkSecurityPerimeterConfigurationListResult); err != nil { + return ScheduledQueryRuleClientListNSPResponse{}, err + } + return result, nil +} + +// BeginReconcileNSP - Reconcile network security perimeter configuration for ScheduledQueryRule resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - ruleName - The name of the rule. +// - networkSecurityPerimeterConfigurationName - The name for a network security perimeter configuration +// - options - ScheduledQueryRuleClientBeginReconcileNSPOptions contains the optional parameters for the ScheduledQueryRuleClient.BeginReconcileNSP +// method. +func (client *ScheduledQueryRuleClient) BeginReconcileNSP(ctx context.Context, resourceGroupName string, ruleName string, networkSecurityPerimeterConfigurationName string, options *ScheduledQueryRuleClientBeginReconcileNSPOptions) (*runtime.Poller[ScheduledQueryRuleClientReconcileNSPResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.reconcileNSP(ctx, resourceGroupName, ruleName, networkSecurityPerimeterConfigurationName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ScheduledQueryRuleClientReconcileNSPResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ScheduledQueryRuleClientReconcileNSPResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ReconcileNSP - Reconcile network security perimeter configuration for ScheduledQueryRule resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-10-01 +func (client *ScheduledQueryRuleClient) reconcileNSP(ctx context.Context, resourceGroupName string, ruleName string, networkSecurityPerimeterConfigurationName string, options *ScheduledQueryRuleClientBeginReconcileNSPOptions) (*http.Response, error) { + var err error + const operationName = "ScheduledQueryRuleClient.BeginReconcileNSP" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.reconcileNSPCreateRequest(ctx, resourceGroupName, ruleName, networkSecurityPerimeterConfigurationName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// reconcileNSPCreateRequest creates the ReconcileNSP request. +func (client *ScheduledQueryRuleClient) reconcileNSPCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, networkSecurityPerimeterConfigurationName string, options *ScheduledQueryRuleClientBeginReconcileNSPOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}/networkSecurityPerimeterConfigurations/{networkSecurityPerimeterConfigurationName}/reconcile" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if ruleName == "" { + return nil, errors.New("parameter ruleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) + if networkSecurityPerimeterConfigurationName == "" { + return nil, errors.New("parameter networkSecurityPerimeterConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkSecurityPerimeterConfigurationName}", url.PathEscape(networkSecurityPerimeterConfigurationName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client.go b/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client.go index 96c5d6d1a89d..b5aa195251f1 100644 --- a/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client.go @@ -28,7 +28,7 @@ type ScheduledQueryRulesClient struct { } // NewScheduledQueryRulesClient creates a new instance of ScheduledQueryRulesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewScheduledQueryRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ScheduledQueryRulesClient, error) { @@ -46,7 +46,7 @@ func NewScheduledQueryRulesClient(subscriptionID string, credential azcore.Token // CreateOrUpdate - Creates or updates a scheduled query rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01-preview +// Generated from API version 2023-12-01 // - 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. @@ -94,7 +94,7 @@ func (client *ScheduledQueryRulesClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -115,7 +115,7 @@ func (client *ScheduledQueryRulesClient) createOrUpdateHandleResponse(resp *http // Delete - Deletes a scheduled query rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01-preview +// Generated from API version 2023-12-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - ruleName - The name of the rule. // - options - ScheduledQueryRulesClientDeleteOptions contains the optional parameters for the ScheduledQueryRulesClient.Delete @@ -161,7 +161,7 @@ func (client *ScheduledQueryRulesClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -170,7 +170,7 @@ func (client *ScheduledQueryRulesClient) deleteCreateRequest(ctx context.Context // Get - Retrieve an scheduled query rule definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01-preview +// Generated from API version 2023-12-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - ruleName - The name of the rule. // - options - ScheduledQueryRulesClientGetOptions contains the optional parameters for the ScheduledQueryRulesClient.Get method. @@ -216,7 +216,7 @@ func (client *ScheduledQueryRulesClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -233,7 +233,7 @@ func (client *ScheduledQueryRulesClient) getHandleResponse(resp *http.Response) // NewListByResourceGroupPager - Retrieve scheduled query rule definitions in a resource group. // -// Generated from API version 2022-08-01-preview +// Generated from API version 2023-12-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ScheduledQueryRulesClientListByResourceGroupOptions contains the optional parameters for the ScheduledQueryRulesClient.NewListByResourceGroupPager // method. @@ -276,7 +276,7 @@ func (client *ScheduledQueryRulesClient) listByResourceGroupCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -293,7 +293,7 @@ func (client *ScheduledQueryRulesClient) listByResourceGroupHandleResponse(resp // NewListBySubscriptionPager - Retrieve a scheduled query rule definitions in a subscription. // -// Generated from API version 2022-08-01-preview +// Generated from API version 2023-12-01 // - options - ScheduledQueryRulesClientListBySubscriptionOptions contains the optional parameters for the ScheduledQueryRulesClient.NewListBySubscriptionPager // method. func (client *ScheduledQueryRulesClient) NewListBySubscriptionPager(options *ScheduledQueryRulesClientListBySubscriptionOptions) *runtime.Pager[ScheduledQueryRulesClientListBySubscriptionResponse] { @@ -331,7 +331,7 @@ func (client *ScheduledQueryRulesClient) listBySubscriptionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -349,7 +349,7 @@ func (client *ScheduledQueryRulesClient) listBySubscriptionHandleResponse(resp * // Update - Update a scheduled query rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01-preview +// Generated from API version 2023-12-01 // - 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. @@ -397,7 +397,7 @@ func (client *ScheduledQueryRulesClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client_example_test.go deleted file mode 100644 index 405112627130..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client_example_test.go +++ /dev/null @@ -1,859 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/listScheduledQueryRulesBySubscription.json -func ExampleScheduledQueryRulesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewScheduledQueryRulesClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ScheduledQueryRuleResourceCollection = armmonitor.ScheduledQueryRuleResourceCollection{ - // Value: []*armmonitor.ScheduledQueryRuleResource{ - // { - // Name: to.Ptr("perf"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/perf"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Performance rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // { - // Name: to.Ptr("ComputerIp"), - // Operator: to.Ptr(armmonitor.DimensionOperatorExclude), - // Values: []*string{ - // to.Ptr("192.168.1.1")}, - // }, - // { - // Name: to.Ptr("OSType"), - // Operator: to.Ptr(armmonitor.DimensionOperatorInclude), - // Values: []*string{ - // to.Ptr("*")}, - // }}, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // MetricMeasureColumn: to.Ptr("% Processor Time"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Perf | where ObjectName == \"Processor\""), - // ResourceIDColumn: to.Ptr("resourceId"), - // Threshold: to.Ptr[float64](70), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // TargetResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines")}, - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // }, - // { - // Name: to.Ptr("heartbeat"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/MyResourceGroupName2/providers/microsoft.insights/scheduledqueryrules/heartbeat"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Health check rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // }, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Heartbeat"), - // Threshold: to.Ptr[float64](360), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationCount), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // TargetResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines")}, - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/listScheduledQueryRulesByResourceGroup.json -func ExampleScheduledQueryRulesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewScheduledQueryRulesClient().NewListByResourceGroupPager("QueryResourceGroupName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ScheduledQueryRuleResourceCollection = armmonitor.ScheduledQueryRuleResourceCollection{ - // Value: []*armmonitor.ScheduledQueryRuleResource{ - // { - // Name: to.Ptr("perf"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/perf"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Performance rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // { - // Name: to.Ptr("ComputerIp"), - // Operator: to.Ptr(armmonitor.DimensionOperatorExclude), - // Values: []*string{ - // to.Ptr("192.168.1.1")}, - // }, - // { - // Name: to.Ptr("OSType"), - // Operator: to.Ptr(armmonitor.DimensionOperatorInclude), - // Values: []*string{ - // to.Ptr("*")}, - // }}, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // MetricMeasureColumn: to.Ptr("% Processor Time"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Perf | where ObjectName == \"Processor\""), - // ResourceIDColumn: to.Ptr("resourceId"), - // Threshold: to.Ptr[float64](70), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // TargetResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines")}, - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // }, - // { - // Name: to.Ptr("heartbeat"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/heartbeat"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Health check rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // }, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Heartbeat"), - // Threshold: to.Ptr[float64](360), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationCount), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // TargetResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines")}, - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/getScheduledQueryRule.json -func ExampleScheduledQueryRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScheduledQueryRulesClient().Get(ctx, "QueryResourceGroupName", "perf", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ScheduledQueryRuleResource = armmonitor.ScheduledQueryRuleResource{ - // Name: to.Ptr("perf"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/perf"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Performance rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // { - // Name: to.Ptr("ComputerIp"), - // Operator: to.Ptr(armmonitor.DimensionOperatorExclude), - // Values: []*string{ - // to.Ptr("192.168.1.1")}, - // }, - // { - // Name: to.Ptr("OSType"), - // Operator: to.Ptr(armmonitor.DimensionOperatorInclude), - // Values: []*string{ - // to.Ptr("*")}, - // }}, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // MetricMeasureColumn: to.Ptr("% Processor Time"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Perf | where ObjectName == \"Processor\""), - // ResourceIDColumn: to.Ptr("resourceId"), - // Threshold: to.Ptr[float64](70), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1/providers/Microsoft.Compute/virtualMachines/vm1")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/createOrUpdateScheduledQueryRule.json -func ExampleScheduledQueryRulesClient_CreateOrUpdate_createOrUpdateAScheduledQueryRuleForSingleResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScheduledQueryRulesClient().CreateOrUpdate(ctx, "QueryResourceGroupName", "perf", armmonitor.ScheduledQueryRuleResource{ - Location: to.Ptr("eastus"), - Properties: &armmonitor.ScheduledQueryRuleProperties{ - Description: to.Ptr("Performance rule"), - Actions: &armmonitor.Actions{ - ActionGroups: []*string{ - to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - CustomProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }, - CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - AllOf: []*armmonitor.Condition{ - { - Dimensions: []*armmonitor.Dimension{ - { - Name: to.Ptr("ComputerIp"), - Operator: to.Ptr(armmonitor.DimensionOperatorExclude), - Values: []*string{ - to.Ptr("192.168.1.1")}, - }, - { - Name: to.Ptr("OSType"), - Operator: to.Ptr(armmonitor.DimensionOperatorInclude), - Values: []*string{ - to.Ptr("*")}, - }}, - FailingPeriods: &armmonitor.ConditionFailingPeriods{ - MinFailingPeriodsToAlert: to.Ptr[int64](1), - NumberOfEvaluationPeriods: to.Ptr[int64](1), - }, - MetricMeasureColumn: to.Ptr("% Processor Time"), - Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - Query: to.Ptr("Perf | where ObjectName == \"Processor\""), - ResourceIDColumn: to.Ptr("resourceId"), - Threshold: to.Ptr[float64](70), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT5M"), - MuteActionsDuration: to.Ptr("PT30M"), - RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - AutoResolved: to.Ptr(true), - TimeToResolve: to.Ptr("PT10M"), - }, - Scopes: []*string{ - to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1/providers/Microsoft.Compute/virtualMachines/vm1")}, - Severity: to.Ptr(armmonitor.AlertSeverity(4)), - SkipQueryValidation: to.Ptr(true), - WindowSize: to.Ptr("PT10M"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ScheduledQueryRuleResource = armmonitor.ScheduledQueryRuleResource{ - // Name: to.Ptr("perf"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/perf"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Performance rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // { - // Name: to.Ptr("ComputerIp"), - // Operator: to.Ptr(armmonitor.DimensionOperatorExclude), - // Values: []*string{ - // to.Ptr("192.168.1.1")}, - // }, - // { - // Name: to.Ptr("OSType"), - // Operator: to.Ptr(armmonitor.DimensionOperatorInclude), - // Values: []*string{ - // to.Ptr("*")}, - // }}, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // MetricMeasureColumn: to.Ptr("% Processor Time"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Perf | where ObjectName == \"Processor\""), - // ResourceIDColumn: to.Ptr("resourceId"), - // Threshold: to.Ptr[float64](70), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1/providers/Microsoft.Compute/virtualMachines/vm1")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/createOrUpdateScheduledQueryRuleResourceGroup.json -func ExampleScheduledQueryRulesClient_CreateOrUpdate_createOrUpdateAScheduledQueryRuleOnResourceGroupS() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScheduledQueryRulesClient().CreateOrUpdate(ctx, "QueryResourceGroupName", "heartbeat", armmonitor.ScheduledQueryRuleResource{ - Location: to.Ptr("eastus"), - Properties: &armmonitor.ScheduledQueryRuleProperties{ - Description: to.Ptr("Health check rule"), - Actions: &armmonitor.Actions{ - ActionGroups: []*string{ - to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - CustomProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }, - CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - AllOf: []*armmonitor.Condition{ - { - Dimensions: []*armmonitor.Dimension{}, - FailingPeriods: &armmonitor.ConditionFailingPeriods{ - MinFailingPeriodsToAlert: to.Ptr[int64](1), - NumberOfEvaluationPeriods: to.Ptr[int64](1), - }, - Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - Query: to.Ptr("Heartbeat"), - Threshold: to.Ptr[float64](360), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationCount), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT5M"), - MuteActionsDuration: to.Ptr("PT30M"), - RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - AutoResolved: to.Ptr(true), - TimeToResolve: to.Ptr("PT10M"), - }, - Scopes: []*string{ - to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1")}, - Severity: to.Ptr(armmonitor.AlertSeverity(4)), - SkipQueryValidation: to.Ptr(true), - TargetResourceTypes: []*string{ - to.Ptr("Microsoft.Compute/virtualMachines")}, - WindowSize: to.Ptr("PT10M"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ScheduledQueryRuleResource = armmonitor.ScheduledQueryRuleResource{ - // Name: to.Ptr("heartbeat"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/heartbeat"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Health check rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // }, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Heartbeat"), - // Threshold: to.Ptr[float64](360), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationCount), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // TargetResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines")}, - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/createOrUpdateScheduledQueryRuleSubscription.json -func ExampleScheduledQueryRulesClient_CreateOrUpdate_createOrUpdateAScheduledQueryRuleOnSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScheduledQueryRulesClient().CreateOrUpdate(ctx, "QueryResourceGroupName", "perf", armmonitor.ScheduledQueryRuleResource{ - Location: to.Ptr("eastus"), - Properties: &armmonitor.ScheduledQueryRuleProperties{ - Description: to.Ptr("Performance rule"), - Actions: &armmonitor.Actions{ - ActionGroups: []*string{ - to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - CustomProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }, - CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - AllOf: []*armmonitor.Condition{ - { - Dimensions: []*armmonitor.Dimension{ - { - Name: to.Ptr("ComputerIp"), - Operator: to.Ptr(armmonitor.DimensionOperatorExclude), - Values: []*string{ - to.Ptr("192.168.1.1")}, - }, - { - Name: to.Ptr("OSType"), - Operator: to.Ptr(armmonitor.DimensionOperatorInclude), - Values: []*string{ - to.Ptr("*")}, - }}, - FailingPeriods: &armmonitor.ConditionFailingPeriods{ - MinFailingPeriodsToAlert: to.Ptr[int64](1), - NumberOfEvaluationPeriods: to.Ptr[int64](1), - }, - MetricMeasureColumn: to.Ptr("% Processor Time"), - Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - Query: to.Ptr("Perf | where ObjectName == \"Processor\""), - ResourceIDColumn: to.Ptr("resourceId"), - Threshold: to.Ptr[float64](70), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT5M"), - MuteActionsDuration: to.Ptr("PT30M"), - RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - AutoResolved: to.Ptr(true), - TimeToResolve: to.Ptr("PT10M"), - }, - Scopes: []*string{ - to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147")}, - Severity: to.Ptr(armmonitor.AlertSeverity(4)), - SkipQueryValidation: to.Ptr(true), - TargetResourceTypes: []*string{ - to.Ptr("Microsoft.Compute/virtualMachines")}, - WindowSize: to.Ptr("PT10M"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ScheduledQueryRuleResource = armmonitor.ScheduledQueryRuleResource{ - // Name: to.Ptr("perf"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/perf"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Performance rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // { - // Name: to.Ptr("ComputerIp"), - // Operator: to.Ptr(armmonitor.DimensionOperatorExclude), - // Values: []*string{ - // to.Ptr("192.168.1.1")}, - // }, - // { - // Name: to.Ptr("OSType"), - // Operator: to.Ptr(armmonitor.DimensionOperatorInclude), - // Values: []*string{ - // to.Ptr("*")}, - // }}, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // MetricMeasureColumn: to.Ptr("% Processor Time"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Perf | where ObjectName == \"Processor\""), - // ResourceIDColumn: to.Ptr("resourceId"), - // Threshold: to.Ptr[float64](70), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // TargetResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines")}, - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/patchScheduledQueryRule.json -func ExampleScheduledQueryRulesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScheduledQueryRulesClient().Update(ctx, "QueryResourceGroupName", "heartbeat", armmonitor.ScheduledQueryRuleResourcePatch{ - Properties: &armmonitor.ScheduledQueryRuleProperties{ - Enabled: to.Ptr(false), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ScheduledQueryRuleResource = armmonitor.ScheduledQueryRuleResource{ - // Name: to.Ptr("heartbeat"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/heartbeat"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Health check rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // }, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Heartbeat"), - // Threshold: to.Ptr[float64](360), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationCount), - // }}, - // }, - // Enabled: to.Ptr(false), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // TargetResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines")}, - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/deleteScheduledQueryRule.json -func ExampleScheduledQueryRulesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewScheduledQueryRulesClient().Delete(ctx, "QueryResourceGroupName", "heartbeat", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client.go b/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client.go index 06e332a4dbb0..6b50f7746bdb 100644 --- a/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client.go @@ -43,7 +43,7 @@ func NewTenantActionGroupsClient(credential azcore.TokenCredential, options *arm // CreateOrUpdate - Create a new tenant action group or update an existing one. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2023-05-01-preview // - managementGroupID - The management group id. // - tenantActionGroupName - The name of the action group. // - xmsClientTenantID - The tenant ID of the client making the request. @@ -88,10 +88,10 @@ func (client *TenantActionGroupsClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-client-tenant-id"] = []string{xmsClientTenantID} req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["x-ms-client-tenant-id"] = []string{xmsClientTenantID} if err := runtime.MarshalAsJSON(req, actionGroup); err != nil { return nil, err } @@ -110,7 +110,7 @@ func (client *TenantActionGroupsClient) createOrUpdateHandleResponse(resp *http. // Delete - Delete a tenant action group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2023-05-01-preview // - managementGroupID - The management group id. // - tenantActionGroupName - The name of the action group. // - xmsClientTenantID - The tenant ID of the client making the request. @@ -153,17 +153,17 @@ func (client *TenantActionGroupsClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-client-tenant-id"] = []string{xmsClientTenantID} req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["x-ms-client-tenant-id"] = []string{xmsClientTenantID} return req, nil } // Get - Get a tenant action group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2023-05-01-preview // - managementGroupID - The management group id. // - tenantActionGroupName - The name of the action group. // - xmsClientTenantID - The tenant ID of the client making the request. @@ -206,10 +206,10 @@ func (client *TenantActionGroupsClient) getCreateRequest(ctx context.Context, ma return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-client-tenant-id"] = []string{xmsClientTenantID} req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["x-ms-client-tenant-id"] = []string{xmsClientTenantID} return req, nil } @@ -224,7 +224,7 @@ func (client *TenantActionGroupsClient) getHandleResponse(resp *http.Response) ( // NewListByManagementGroupIDPager - Get a list of all tenant action groups in a management group. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2023-05-01-preview // - managementGroupID - The management group id. // - xmsClientTenantID - The tenant ID of the client making the request. // - options - TenantActionGroupsClientListByManagementGroupIDOptions contains the optional parameters for the TenantActionGroupsClient.NewListByManagementGroupIDPager @@ -265,10 +265,10 @@ func (client *TenantActionGroupsClient) listByManagementGroupIDCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-client-tenant-id"] = []string{xmsClientTenantID} req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["x-ms-client-tenant-id"] = []string{xmsClientTenantID} return req, nil } @@ -284,7 +284,7 @@ func (client *TenantActionGroupsClient) listByManagementGroupIDHandleResponse(re // Update - Updates an existing tenant action group's tags. To update other fields use the CreateOrUpdate method. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2023-05-01-preview // - managementGroupID - The management group id. // - tenantActionGroupName - The name of the action group. // - xmsClientTenantID - The tenant ID of the client making the request. @@ -329,10 +329,10 @@ func (client *TenantActionGroupsClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-client-tenant-id"] = []string{xmsClientTenantID} req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["x-ms-client-tenant-id"] = []string{xmsClientTenantID} if err := runtime.MarshalAsJSON(req, tenantActionGroupPatch); err != nil { return nil, err } diff --git a/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client_example_test.go deleted file mode 100644 index e63ca7241bbc..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client_example_test.go +++ /dev/null @@ -1,425 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2023-03-01-preview/examples/createOrUpdateTenantActionGroup.json -func ExampleTenantActionGroupsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTenantActionGroupsClient().CreateOrUpdate(ctx, "72f988bf-86f1-41af-91ab-2d7cd011db47", "testTenantActionGroup", "72f988bf-86f1-41af-91ab-2d7cd011db47", armmonitor.TenantActionGroupResource{ - Location: to.Ptr("Global"), - Tags: map[string]*string{}, - Properties: &armmonitor.TenantActionGroup{ - AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiverAutoGenerated{ - { - Name: to.Ptr("Sample azureAppPush"), - EmailAddress: to.Ptr("johndoe@email.com"), - }}, - EmailReceivers: []*armmonitor.EmailReceiverAutoGenerated{ - { - Name: to.Ptr("John Doe's email"), - EmailAddress: to.Ptr("johndoe@email.com"), - UseCommonAlertSchema: to.Ptr(false), - }, - { - Name: to.Ptr("Jane Smith's email"), - EmailAddress: to.Ptr("janesmith@email.com"), - UseCommonAlertSchema: to.Ptr(true), - }}, - Enabled: to.Ptr(true), - GroupShortName: to.Ptr("sample"), - SmsReceivers: []*armmonitor.SmsReceiverAutoGenerated{ - { - Name: to.Ptr("John Doe's mobile"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("2062022299"), - }, - { - Name: to.Ptr("Jane Smith's mobile"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("0987654321"), - }}, - VoiceReceivers: []*armmonitor.VoiceReceiverAutoGenerated{ - { - Name: to.Ptr("Sample voice"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("2062022299"), - }}, - WebhookReceivers: []*armmonitor.WebhookReceiverAutoGenerated{ - { - Name: to.Ptr("Sample webhook 1"), - ServiceURI: to.Ptr("http://www.example.com/webhook1"), - UseCommonAlertSchema: to.Ptr(true), - }, - { - Name: to.Ptr("Sample webhook 2"), - IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - ServiceURI: to.Ptr("http://www.example.com/webhook2"), - TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - UseAADAuth: to.Ptr(true), - UseCommonAlertSchema: to.Ptr(true), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TenantActionGroupResource = armmonitor.TenantActionGroupResource{ - // Name: to.Ptr("testTenantActionGroup"), - // Type: to.Ptr("Microsoft.Insights/TenantActionGroups"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.Insights/tenantActionGroups/testTenantActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.TenantActionGroup{ - // EmailReceivers: []*armmonitor.EmailReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(true), - // GroupShortName: to.Ptr("sample"), - // SmsReceivers: []*armmonitor.SmsReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample voice"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // }}, - // WebhookReceivers: []*armmonitor.WebhookReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample webhook 1"), - // ServiceURI: to.Ptr("http://www.example.com/webhook1"), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2023-03-01-preview/examples/getTenantActionGroup.json -func ExampleTenantActionGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTenantActionGroupsClient().Get(ctx, "72f988bf-86f1-41af-91ab-2d7cd011db47", "testTenantActionGroup", "72f988bf-86f1-41af-91ab-2d7cd011db47", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TenantActionGroupResource = armmonitor.TenantActionGroupResource{ - // Name: to.Ptr("testTenantActionGroup"), - // Type: to.Ptr("Microsoft.Insights/TenantActionGroups"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.Insights/tenantActionGroups/testTenantActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.TenantActionGroup{ - // EmailReceivers: []*armmonitor.EmailReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(true), - // GroupShortName: to.Ptr("sample"), - // SmsReceivers: []*armmonitor.SmsReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample voice"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // }}, - // WebhookReceivers: []*armmonitor.WebhookReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample webhook 1"), - // ServiceURI: to.Ptr("http://www.example.com/webhook1"), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2023-03-01-preview/examples/deleteTenantActionGroup.json -func ExampleTenantActionGroupsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewTenantActionGroupsClient().Delete(ctx, "72f988bf-86f1-41af-91ab-2d7cd011db47", "testTenantActionGroup", "72f988bf-86f1-41af-91ab-2d7cd011db47", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2023-03-01-preview/examples/patchTenantActionGroup.json -func ExampleTenantActionGroupsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTenantActionGroupsClient().Update(ctx, "72f988bf-86f1-41af-91ab-2d7cd011db47", "testTenantActionGroup", "72f988bf-86f1-41af-91ab-2d7cd011db47", armmonitor.ActionGroupPatchBodyAutoGenerated{ - Properties: &armmonitor.ActionGroupPatchAutoGenerated{ - Enabled: to.Ptr(false), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TenantActionGroupResource = armmonitor.TenantActionGroupResource{ - // Name: to.Ptr("testTenantActionGroup"), - // Type: to.Ptr("Microsoft.Insights/TenantActionGroups"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.Insights/tenantActionGroups/testTenantActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armmonitor.TenantActionGroup{ - // EmailReceivers: []*armmonitor.EmailReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(false), - // GroupShortName: to.Ptr("sample"), - // SmsReceivers: []*armmonitor.SmsReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample voice"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // }}, - // WebhookReceivers: []*armmonitor.WebhookReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample webhook 1"), - // ServiceURI: to.Ptr("http://www.example.com/webhook1"), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2023-03-01-preview/examples/listTenantActionGroups.json -func ExampleTenantActionGroupsClient_NewListByManagementGroupIDPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTenantActionGroupsClient().NewListByManagementGroupIDPager("72f988bf-86f1-41af-91ab-2d7cd011db47", "72f988bf-86f1-41af-91ab-2d7cd011db47", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.TenantActionGroupList = armmonitor.TenantActionGroupList{ - // Value: []*armmonitor.TenantActionGroupResource{ - // { - // Name: to.Ptr("testTenantActionGroup"), - // Type: to.Ptr("Microsoft.Insights/TenantActionGroups"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.Insights/tenantActionGroups/testTenantActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.TenantActionGroup{ - // EmailReceivers: []*armmonitor.EmailReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(true), - // GroupShortName: to.Ptr("sample"), - // SmsReceivers: []*armmonitor.SmsReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample voice"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // }}, - // WebhookReceivers: []*armmonitor.WebhookReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample webhook 1"), - // ServiceURI: to.Ptr("http://www.example.com/webhook1"), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client.go b/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client.go index 5fba971cf4ba..496db69780ec 100644 --- a/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client.go @@ -76,13 +76,13 @@ func (client *TenantActivityLogsClient) listCreateRequest(ctx context.Context, o return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-04-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } if options != nil && options.Select != nil { reqQP.Set("$select", *options.Select) } + reqQP.Set("api-version", "2015-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client_example_test.go deleted file mode 100644 index 21dd5bab2e23..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client_example_test.go +++ /dev/null @@ -1,325 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetTenantActivityLogsFiltered.json -func ExampleTenantActivityLogsClient_NewListPager_getTenantActivityLogsWithFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTenantActivityLogsClient().NewListPager(&armmonitor.TenantActivityLogsClientListOptions{Filter: to.Ptr("eventTimestamp ge '2015-01-21T20:00:00Z' and eventTimestamp le '2015-01-23T20:00:00Z' and resourceGroupName eq 'MSSupportGroup'"), - Select: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EventDataCollection = armmonitor.EventDataCollection{ - // Value: []*armmonitor.EventData{ - // { - // OperationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // Description: to.Ptr(""), - // Authorization: &armmonitor.SenderAuthorization{ - // Action: to.Ptr("microsoft.support/supporttickets/write"), - // Role: to.Ptr("Subscription Admin"), - // Scope: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841"), - // }, - // Caller: to.Ptr("admin@contoso.com"), - // Claims: map[string]*string{ - // "name": to.Ptr("John Smith"), - // "appid": to.Ptr("c44b4083-3bq0-49c1-b47d-974e53cbdf3c"), - // "appidacr": to.Ptr("2"), - // "aud": to.Ptr("https://management.core.windows.net/"), - // "exp": to.Ptr("1421880271"), - // "groups": to.Ptr("cacfe77c-e058-4712-83qw-f9b08849fd60,7f71d11d-4c41-4b23-99d2-d32ce7aa621c,31522864-0578-4ea0-9gdc-e66cc564d18c"), - // "http://schemas.microsoft.com/claims/authnclassreference": to.Ptr("1"), - // "http://schemas.microsoft.com/claims/authnmethodsreferences": to.Ptr("pwd"), - // "http://schemas.microsoft.com/identity/claims/objectidentifier": to.Ptr("2468adf0-8211-44e3-95xq-85137af64708"), - // "http://schemas.microsoft.com/identity/claims/scope": to.Ptr("user_impersonation"), - // "http://schemas.microsoft.com/identity/claims/tenantid": to.Ptr("1e8d8218-c5e7-4578-9acc-9abbd5d23315"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname": to.Ptr("John"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name": to.Ptr("admin@contoso.com"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier": to.Ptr("9vckmEGF7zDKk1YzIY8k0t1_EAPaXoeHyPRn6f413zM"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname": to.Ptr("Smith"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn": to.Ptr("admin@contoso.com"), - // "iat": to.Ptr("1421876371"), - // "iss": to.Ptr("https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/"), - // "nbf": to.Ptr("1421876371"), - // "puid": to.Ptr("20030000801A118C"), - // "ver": to.Ptr("1.0"), - // }, - // CorrelationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // EventDataID: to.Ptr("44ade6b4-3813-45e6-ae27-7420a95fa2f8"), - // EventName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("End request"), - // Value: to.Ptr("EndRequest"), - // }, - // EventTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:26.979Z"); return t}()), - // HTTPRequest: &armmonitor.HTTPRequestInfo{ - // Method: to.Ptr("PUT"), - // ClientIPAddress: to.Ptr("192.168.35.115"), - // ClientRequestID: to.Ptr("27003b25-91d3-418f-8eb1-29e537dcb249"), - // }, - // ID: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841/events/44ade6b4-3813-45e6-ae27-7420a95fa2f8/ticks/635574752669792776"), - // Level: to.Ptr(armmonitor.EventLevelInformational), - // OperationName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support/supporttickets/write"), - // Value: to.Ptr("microsoft.support/supporttickets/write"), - // }, - // Properties: map[string]*string{ - // "statusCode": to.Ptr("Created"), - // }, - // ResourceGroupName: to.Ptr("MSSupportGroup"), - // ResourceProviderName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support"), - // Value: to.Ptr("microsoft.support"), - // }, - // Status: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Succeeded"), - // Value: to.Ptr("Succeeded"), - // }, - // SubStatus: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Created (HTTP Status Code: 201)"), - // Value: to.Ptr("Created"), - // }, - // SubmissionTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:39.993Z"); return t}()), - // SubscriptionID: to.Ptr("089bd33f-d4ec-47fe-8ba5-0753aa5c5b33"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetTenantActivityLogsFilteredAndSelected.json -func ExampleTenantActivityLogsClient_NewListPager_getTenantActivityLogsWithFilterAndSelect() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTenantActivityLogsClient().NewListPager(&armmonitor.TenantActivityLogsClientListOptions{Filter: to.Ptr("eventTimestamp ge '2015-01-21T20:00:00Z' and eventTimestamp le '2015-01-23T20:00:00Z' and resourceGroupName eq 'MSSupportGroup'"), - Select: to.Ptr("eventName,id,resourceGroupName,resourceProviderName,operationName,status,eventTimestamp,correlationId,submissionTimestamp,level"), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EventDataCollection = armmonitor.EventDataCollection{ - // Value: []*armmonitor.EventData{ - // { - // CorrelationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // EventName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("End request"), - // Value: to.Ptr("EndRequest"), - // }, - // EventTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:26.979Z"); return t}()), - // ID: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841/events/44ade6b4-3813-45e6-ae27-7420a95fa2f8/ticks/635574752669792776"), - // Level: to.Ptr(armmonitor.EventLevelInformational), - // OperationName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support/supporttickets/write"), - // Value: to.Ptr("microsoft.support/supporttickets/write"), - // }, - // ResourceGroupName: to.Ptr("MSSupportGroup"), - // ResourceProviderName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support"), - // Value: to.Ptr("microsoft.support"), - // }, - // Status: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Succeeded"), - // Value: to.Ptr("Succeeded"), - // }, - // SubmissionTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:39.993Z"); return t}()), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetTenantActivityLogsSelected.json -func ExampleTenantActivityLogsClient_NewListPager_getTenantActivityLogsWithSelect() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTenantActivityLogsClient().NewListPager(&armmonitor.TenantActivityLogsClientListOptions{Filter: nil, - Select: to.Ptr("eventName,id,resourceGroupName,resourceProviderName,operationName,status,eventTimestamp,correlationId,submissionTimestamp,level"), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EventDataCollection = armmonitor.EventDataCollection{ - // Value: []*armmonitor.EventData{ - // { - // CorrelationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // EventName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("End request"), - // Value: to.Ptr("EndRequest"), - // }, - // EventTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:26.979Z"); return t}()), - // ID: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841/events/44ade6b4-3813-45e6-ae27-7420a95fa2f8/ticks/635574752669792776"), - // Level: to.Ptr(armmonitor.EventLevelInformational), - // OperationName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support/supporttickets/write"), - // Value: to.Ptr("microsoft.support/supporttickets/write"), - // }, - // ResourceGroupName: to.Ptr("MSSupportGroup"), - // ResourceProviderName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support"), - // Value: to.Ptr("microsoft.support"), - // }, - // Status: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Succeeded"), - // Value: to.Ptr("Succeeded"), - // }, - // SubmissionTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:39.993Z"); return t}()), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetTenantActivityLogsNoParams.json -func ExampleTenantActivityLogsClient_NewListPager_getTenantActivityLogsWithoutFilterOrSelect() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTenantActivityLogsClient().NewListPager(&armmonitor.TenantActivityLogsClientListOptions{Filter: nil, - Select: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EventDataCollection = armmonitor.EventDataCollection{ - // Value: []*armmonitor.EventData{ - // { - // OperationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // Description: to.Ptr(""), - // Authorization: &armmonitor.SenderAuthorization{ - // Action: to.Ptr("microsoft.support/supporttickets/write"), - // Role: to.Ptr("Subscription Admin"), - // Scope: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841"), - // }, - // Caller: to.Ptr("admin@contoso.com"), - // Claims: map[string]*string{ - // "name": to.Ptr("John Smith"), - // "appid": to.Ptr("c44b4083-3bq0-49c1-b47d-974e53cbdf3c"), - // "appidacr": to.Ptr("2"), - // "aud": to.Ptr("https://management.core.windows.net/"), - // "exp": to.Ptr("1421880271"), - // "groups": to.Ptr("cacfe77c-e058-4712-83qw-f9b08849fd60,7f71d11d-4c41-4b23-99d2-d32ce7aa621c,31522864-0578-4ea0-9gdc-e66cc564d18c"), - // "http://schemas.microsoft.com/claims/authnclassreference": to.Ptr("1"), - // "http://schemas.microsoft.com/claims/authnmethodsreferences": to.Ptr("pwd"), - // "http://schemas.microsoft.com/identity/claims/objectidentifier": to.Ptr("2468adf0-8211-44e3-95xq-85137af64708"), - // "http://schemas.microsoft.com/identity/claims/scope": to.Ptr("user_impersonation"), - // "http://schemas.microsoft.com/identity/claims/tenantid": to.Ptr("1e8d8218-c5e7-4578-9acc-9abbd5d23315"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname": to.Ptr("John"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name": to.Ptr("admin@contoso.com"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier": to.Ptr("9vckmEGF7zDKk1YzIY8k0t1_EAPaXoeHyPRn6f413zM"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname": to.Ptr("Smith"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn": to.Ptr("admin@contoso.com"), - // "iat": to.Ptr("1421876371"), - // "iss": to.Ptr("https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/"), - // "nbf": to.Ptr("1421876371"), - // "puid": to.Ptr("20030000801A118C"), - // "ver": to.Ptr("1.0"), - // }, - // CorrelationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // EventDataID: to.Ptr("44ade6b4-3813-45e6-ae27-7420a95fa2f8"), - // EventName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("End request"), - // Value: to.Ptr("EndRequest"), - // }, - // EventTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:26.979Z"); return t}()), - // HTTPRequest: &armmonitor.HTTPRequestInfo{ - // Method: to.Ptr("PUT"), - // ClientIPAddress: to.Ptr("192.168.35.115"), - // ClientRequestID: to.Ptr("27003b25-91d3-418f-8eb1-29e537dcb249"), - // }, - // ID: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841/events/44ade6b4-3813-45e6-ae27-7420a95fa2f8/ticks/635574752669792776"), - // Level: to.Ptr(armmonitor.EventLevelInformational), - // OperationName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support/supporttickets/write"), - // Value: to.Ptr("microsoft.support/supporttickets/write"), - // }, - // Properties: map[string]*string{ - // "statusCode": to.Ptr("Created"), - // }, - // ResourceGroupName: to.Ptr("MSSupportGroup"), - // ResourceProviderName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support"), - // Value: to.Ptr("microsoft.support"), - // }, - // Status: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Succeeded"), - // Value: to.Ptr("Succeeded"), - // }, - // SubStatus: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Created (HTTP Status Code: 201)"), - // Value: to.Ptr("Created"), - // }, - // SubmissionTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:39.993Z"); return t}()), - // SubscriptionID: to.Ptr("089bd33f-d4ec-47fe-8ba5-0753aa5c5b33"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/time_rfc3339.go b/sdk/resourcemanager/monitor/armmonitor/time_rfc3339.go index b3823502263e..1f36b79835b0 100644 --- a/sdk/resourcemanager/monitor/armmonitor/time_rfc3339.go +++ b/sdk/resourcemanager/monitor/armmonitor/time_rfc3339.go @@ -19,12 +19,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +44,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 @@ -84,72 +108,3 @@ func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) e *t = (*time.Time)(&aux) return nil } - -const ( - utcTimeJSON = `"15:04:05.999999999"` - utcTime = "15:04:05.999999999" - timeFormat = "15:04:05.999999999Z07:00" -) - -type timeRFC3339 time.Time - -func (t timeRFC3339) MarshalJSON() ([]byte, error) { - s, _ := t.MarshalText() - return []byte(fmt.Sprintf("\"%s\"", s)), nil -} - -func (t timeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return []byte(tt.Format(timeFormat)), nil -} - -func (t *timeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcTimeJSON - if tzOffsetRegex.Match(data) { - layout = timeFormat - } - return t.Parse(layout, string(data)) -} - -func (t *timeRFC3339) UnmarshalText(data []byte) error { - layout := utcTime - if tzOffsetRegex.Match(data) { - layout = timeFormat - } - return t.Parse(layout, string(data)) -} - -func (t *timeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = timeRFC3339(p) - return err -} - -func (t timeRFC3339) String() string { - tt := time.Time(t) - return tt.Format(timeFormat) -} - -func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*timeRFC3339)(t) -} - -func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { - return nil - } - var aux timeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/vminsights_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/vminsights_client_example_test.go deleted file mode 100644 index 6834327911e3..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/vminsights_client_example_test.go +++ /dev/null @@ -1,219 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusVMScaleSet.json -func ExampleVMInsightsClient_GetOnboardingStatus_getStatusForAVmScaleSetThatIsActivelyReportingData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVMInsightsClient().GetOnboardingStatus(ctx, "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/my-service-cluster/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-01", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VMInsightsOnboardingStatus = armmonitor.VMInsightsOnboardingStatus{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Insights/vmInsightsOnboardingStatuses"), - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/my-service-cluster/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-01/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default"), - // Properties: &armmonitor.VMInsightsOnboardingStatusProperties{ - // Data: []*armmonitor.DataContainer{ - // { - // Workspace: &armmonitor.WorkspaceInfo{ - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourcegroups/monitoring/providers/microsoft.operationalinsights/workspaces/vm-monitoring"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.WorkspaceInfoProperties{ - // CustomerID: to.Ptr("c7f8f44d-d8ee-4b79-9d9a-4d8a1f2a112a"), - // }, - // }, - // }}, - // DataStatus: to.Ptr(armmonitor.DataStatusPresent), - // OnboardingStatus: to.Ptr(armmonitor.OnboardingStatusOnboarded), - // ResourceID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/my-service-cluster/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-01"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusSingleVMUnknown.json -func ExampleVMInsightsClient_GetOnboardingStatus_getStatusForAVmThatHasNotYetReportedData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVMInsightsClient().GetOnboardingStatus(ctx, "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VMInsightsOnboardingStatus = armmonitor.VMInsightsOnboardingStatus{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Insights/vmInsightsOnboardingStatuses"), - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default"), - // Properties: &armmonitor.VMInsightsOnboardingStatusProperties{ - // Data: []*armmonitor.DataContainer{ - // }, - // DataStatus: to.Ptr(armmonitor.DataStatusNotPresent), - // OnboardingStatus: to.Ptr(armmonitor.OnboardingStatusUnknown), - // ResourceID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusSingleVM.json -func ExampleVMInsightsClient_GetOnboardingStatus_getStatusForAVmThatIsActivelyReportingData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVMInsightsClient().GetOnboardingStatus(ctx, "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VMInsightsOnboardingStatus = armmonitor.VMInsightsOnboardingStatus{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Insights/vmInsightsOnboardingStatuses"), - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default"), - // Properties: &armmonitor.VMInsightsOnboardingStatusProperties{ - // Data: []*armmonitor.DataContainer{ - // { - // Workspace: &armmonitor.WorkspaceInfo{ - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourcegroups/monitoring/providers/microsoft.operationalinsights/workspaces/vm-monitoring"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.WorkspaceInfoProperties{ - // CustomerID: to.Ptr("c7f8f44d-d8ee-4b79-9d9a-4d8a1f2a112a"), - // }, - // }, - // }}, - // DataStatus: to.Ptr(armmonitor.DataStatusPresent), - // OnboardingStatus: to.Ptr(armmonitor.OnboardingStatusOnboarded), - // ResourceID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusResourceGroup.json -func ExampleVMInsightsClient_GetOnboardingStatus_getStatusForAResourceGroupThatHasAtLeastOneVmThatIsActivelyReportingData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVMInsightsClient().GetOnboardingStatus(ctx, "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/resource-group-with-vms", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VMInsightsOnboardingStatus = armmonitor.VMInsightsOnboardingStatus{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Insights/vmInsightsOnboardingStatuses"), - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/resource-group-with-vms/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default"), - // Properties: &armmonitor.VMInsightsOnboardingStatusProperties{ - // Data: []*armmonitor.DataContainer{ - // { - // Workspace: &armmonitor.WorkspaceInfo{ - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourcegroups/monitoring/providers/microsoft.operationalinsights/workspaces/vm-monitoring"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.WorkspaceInfoProperties{ - // CustomerID: to.Ptr("c7f8f44d-d8ee-4b79-9d9a-4d8a1f2a112a"), - // }, - // }, - // }}, - // DataStatus: to.Ptr(armmonitor.DataStatusPresent), - // OnboardingStatus: to.Ptr(armmonitor.OnboardingStatusOnboarded), - // ResourceID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/resource-group-with-vms"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusSubscription.json -func ExampleVMInsightsClient_GetOnboardingStatus_getStatusForASubscriptionThatHasAtLeastOneVmThatIsActivelyReportingData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVMInsightsClient().GetOnboardingStatus(ctx, "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VMInsightsOnboardingStatus = armmonitor.VMInsightsOnboardingStatus{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Insights/vmInsightsOnboardingStatuses"), - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default"), - // Properties: &armmonitor.VMInsightsOnboardingStatusProperties{ - // Data: []*armmonitor.DataContainer{ - // { - // Workspace: &armmonitor.WorkspaceInfo{ - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourcegroups/monitoring/providers/microsoft.operationalinsights/workspaces/vm-monitoring-secondary"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.WorkspaceInfoProperties{ - // CustomerID: to.Ptr("f096d163-206e-4abf-9db3-2c62af003d68"), - // }, - // }, - // }, - // { - // Workspace: &armmonitor.WorkspaceInfo{ - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourcegroups/monitoring/providers/microsoft.operationalinsights/workspaces/vm-monitoring"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.WorkspaceInfoProperties{ - // CustomerID: to.Ptr("c7f8f44d-d8ee-4b79-9d9a-4d8a1f2a112a"), - // }, - // }, - // }}, - // DataStatus: to.Ptr(armmonitor.DataStatusPresent), - // OnboardingStatus: to.Ptr(armmonitor.OnboardingStatusOnboarded), - // ResourceID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87"), - // }, - // } -}