diff --git a/sdk/insights/Azure.ResourceManager.Insights/Azure.ResourceManager.Insights.sln b/sdk/insights/Azure.ResourceManager.Insights/Azure.ResourceManager.Insights.sln
new file mode 100644
index 000000000000..7f8a76898e3d
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/Azure.ResourceManager.Insights.sln
@@ -0,0 +1,48 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.26124.0
+MinimumVisualStudioVersion = 15.0.26124.0
+Project("{777F92EC-C448-487F-8296-282356D9BAF8}") = "Azure.ResourceManager.Insights", "src\Azure.ResourceManager.Insights.csproj", "{A8FF99B2-B8CD-4CFF-A9AC-14058FAFBB13}"
+EndProject
+Project("{777F92EC-C448-487F-8296-282356D9BAF8}") = "Azure.ResourceManager.Insights.Tests", "tests\Azure.ResourceManager.Insights.Tests.csproj", "{93133479-68E2-4E4B-9CC7-0FC8CAB16E30}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|Any CPU = Release|Any CPU
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {A8FF99B2-B8CD-4CFF-A9AC-14058FAFBB13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A8FF99B2-B8CD-4CFF-A9AC-14058FAFBB13}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A8FF99B2-B8CD-4CFF-A9AC-14058FAFBB13}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {A8FF99B2-B8CD-4CFF-A9AC-14058FAFBB13}.Debug|x64.Build.0 = Debug|Any CPU
+ {A8FF99B2-B8CD-4CFF-A9AC-14058FAFBB13}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {A8FF99B2-B8CD-4CFF-A9AC-14058FAFBB13}.Debug|x86.Build.0 = Debug|Any CPU
+ {A8FF99B2-B8CD-4CFF-A9AC-14058FAFBB13}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A8FF99B2-B8CD-4CFF-A9AC-14058FAFBB13}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A8FF99B2-B8CD-4CFF-A9AC-14058FAFBB13}.Release|x64.ActiveCfg = Release|Any CPU
+ {A8FF99B2-B8CD-4CFF-A9AC-14058FAFBB13}.Release|x64.Build.0 = Release|Any CPU
+ {A8FF99B2-B8CD-4CFF-A9AC-14058FAFBB13}.Release|x86.ActiveCfg = Release|Any CPU
+ {A8FF99B2-B8CD-4CFF-A9AC-14058FAFBB13}.Release|x86.Build.0 = Release|Any CPU
+ {93133479-68E2-4E4B-9CC7-0FC8CAB16E30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {93133479-68E2-4E4B-9CC7-0FC8CAB16E30}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {93133479-68E2-4E4B-9CC7-0FC8CAB16E30}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {93133479-68E2-4E4B-9CC7-0FC8CAB16E30}.Debug|x64.Build.0 = Debug|Any CPU
+ {93133479-68E2-4E4B-9CC7-0FC8CAB16E30}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {93133479-68E2-4E4B-9CC7-0FC8CAB16E30}.Debug|x86.Build.0 = Debug|Any CPU
+ {93133479-68E2-4E4B-9CC7-0FC8CAB16E30}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {93133479-68E2-4E4B-9CC7-0FC8CAB16E30}.Release|Any CPU.Build.0 = Release|Any CPU
+ {93133479-68E2-4E4B-9CC7-0FC8CAB16E30}.Release|x64.ActiveCfg = Release|Any CPU
+ {93133479-68E2-4E4B-9CC7-0FC8CAB16E30}.Release|x64.Build.0 = Release|Any CPU
+ {93133479-68E2-4E4B-9CC7-0FC8CAB16E30}.Release|x86.ActiveCfg = Release|Any CPU
+ {93133479-68E2-4E4B-9CC7-0FC8CAB16E30}.Release|x86.Build.0 = Release|Any CPU
+ EndGlobalSection
+EndGlobal
diff --git a/sdk/insights/Azure.ResourceManager.Insights/CHANGELOG.md b/sdk/insights/Azure.ResourceManager.Insights/CHANGELOG.md
new file mode 100644
index 000000000000..fb4896e58647
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/CHANGELOG.md
@@ -0,0 +1,3 @@
+# Release History
+
+- Started changelog to capture release notes.
\ No newline at end of file
diff --git a/sdk/insights/Azure.ResourceManager.Insights/Directory.Build.props b/sdk/insights/Azure.ResourceManager.Insights/Directory.Build.props
new file mode 100644
index 000000000000..1a9611bd4924
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/Directory.Build.props
@@ -0,0 +1,6 @@
+
+
+
+
diff --git a/sdk/insights/Azure.ResourceManager.Insights/README.md b/sdk/insights/Azure.ResourceManager.Insights/README.md
new file mode 100644
index 000000000000..1dd341e71db9
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/README.md
@@ -0,0 +1,96 @@
+# README.md template
+
+Use the guidelines in each section of this template to ensure consistency and readability of your README. The README resides in your package's GitHub repository at the root of its directory within the repo. It's also used as the package distribution page (NuGet, PyPi, npm, etc.) and as a Quickstart on docs.microsoft.com. See [Azure.Template/README.md](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/template/Azure.Template/README.md) for an example following this template.
+
+This package follows the [new Azure SDK guidelines](https://azure.github.io/azure-sdk/general_introduction.html) which provide a number of core capabilities that are shared amongst all Azure SDKs, including the intuitive Azure Identity library, an HTTP Pipeline with custom policies, error-handling, distributed tracing, and much more.
+
+# Azure Management Insights client library for .NET
+
+**Introduction**: The introduction appears directly under the title (H1) of your README.
+
+* **DO NOT** use an "Introduction" or "Overview" heading (H2) for this section.
+* First sentence: **Describe the service** briefly. You can usually use the first line of the service's docs landing page for this (Example: [Cosmos DB docs landing page](https://docs.microsoft.com/azure/cosmos-db/)).
+* Next, add a **bulleted list** of the **most common tasks** supported by the package or library, prefaced with "Use the client library for [Product Name] to:". Then, provide code snippets for these tasks in the [Examples](#examples) section later in the document. Keep the task list short but include those tasks most developers need to perform with your package.
+* Include this single line of links targeting your product's content at the bottom of the introduction, making any adjustments as necessary (for example, NuGet instead of PyPi):
+
+ [Source code](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/batch/azure-batch) | [Package (PyPi)](https://pypi.org/project/azure-batch/) | [API reference documentation](https://docs.microsoft.com/python/api/overview/azure/batch?view=azure-python) | [Product documentation](https://docs.microsoft.com/azure/batch/)
+
+> TIP: Your README should be as **brief** as possible but **no more brief** than necessary to get a developer new to Azure, the service, or the package up and running quickly. Keep it brief, but include everything a developer needs to make their first API call successfully.
+
+## Getting started
+
+This section should include everything a developer needs to do to install and create their first client connection *very quickly*.
+
+### Install the package
+
+First, provide instruction for obtaining and installing the package or library. This section might include only a single line of code, like `pip install package-name`, but should enable a developer to successfully install the package from NuGet, pip, npm, Maven, or even cloning a GitHub repository.
+
+Include a **Prerequisites** line after the install command that details any requirements that must be satisfied before a developer can [authenticate](#authenticate-the-client) and test all of the snippets in the [Examples](#examples) section. For example, for Cosmos DB:
+
+**Prerequisites**: You must have an [Azure subscription](https://azure.microsoft.com/free/), [Cosmos DB account](https://docs.microsoft.com/azure/cosmos-db/account-overview) (SQL API), and [Python 3.6+](https://www.python.org/downloads/) to use this package.
+
+### Authenticate the client
+
+If your library requires authentication for use, such as for Azure services, include instructions and example code needed for initializing and authenticating.
+
+For example, include details on obtaining an account key and endpoint URI, setting environment variables for each, and initializing the client object.
+
+## Key concepts
+
+The *Key concepts* section should describe the functionality of the main classes. Point out the most important and useful classes in the package (with links to their reference pages) and explain how those classes work together. Feel free to use bulleted lists, tables, code blocks, or even diagrams for clarity.
+
+## Examples
+
+Include code snippets and short descriptions for each task you listed in the [Introduction](#introduction) (the bulleted list). Briefly explain each operation, but include enough clarity to explain complex or otherwise tricky operations.
+
+If possible, use the same example snippets that your in-code documentation uses. For example, use the snippets in your `examples.py` that Sphinx ingests via its [literalinclude](https://www.sphinx-doc.org/en/1.5/markup/code.html?highlight=code%20examples#includes) directive. The `examples.py` file containing the snippets should reside alongside your package's code, and should be tested in an automated fashion.
+
+Each example in the *Examples* section starts with an H3 that describes the example. At the top of this section, just under the *Examples* H2, add a bulleted list linking to each example H3. Each example should deep-link to the types and/or members used in the example.
+
+* [Create the thing](#create-the-thing)
+* [Get the thing](#get-the-thing)
+* [List the things](#list-the-things)
+
+### Create the thing
+
+Use the `create_thing` method to create a Thing reference; this method does not make a network call. To persist the Thing in the service, call `Thing.save`.
+
+```Python
+thing = client.create_thing(id, name)
+thing.save()
+```
+
+### Get the thing
+
+The `get_thing` method retrieves a Thing from the service. The `id` parameter is the unique ID of the Thing, not its "name" property.
+
+```C# Snippet:GetSecret
+var client = new MiniSecretClient(new Uri(endpoint), new DefaultAzureCredential());
+
+SecretBundle secret = client.GetSecret("TestSecret");
+
+Console.WriteLine(secret.Value);
+```Python
+things = client.list_things()
+```
+
+## Troubleshooting
+
+Describe common errors and exceptions, how to "unpack" them if necessary, and include guidance for graceful handling and recovery.
+
+Provide information to help developers avoid throttling or other service-enforced errors they might encounter. For example, provide guidance and examples for using retry or connection policies in the API.
+
+If the package or a related package supports it, include tips for logging or enabling instrumentation to help them debug their code.
+
+## Next steps
+
+* Provide a link to additional code examples, ideally to those sitting alongside the README in the package's `/samples` directory.
+* If appropriate, point users to other packages that might be useful.
+* If you think there's a good chance that developers might stumble across your package in error (because they're searching for specific functionality and mistakenly think the package provides that functionality), point them to the packages they might be looking for.
+
+## Contributing
+
+This is a template, but your SDK readme should include details on how to contribute code to the repo/package.
+
+
+![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net%2Fsdk%2Ftemplate%2FAzure.Template%2FREADME.png)
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Azure.ResourceManager.Insights.csproj b/sdk/insights/Azure.ResourceManager.Insights/src/Azure.ResourceManager.Insights.csproj
new file mode 100644
index 000000000000..3c24c5b949ad
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Azure.ResourceManager.Insights.csproj
@@ -0,0 +1,13 @@
+
+
+ 1.0.0-preview.1
+ Azure.ResourceManager.Insights
+ Azure Resource Manager client SDK for Azure resource provider Microsoft.Insights
+ azure;management;arm;resource manager;insights
+
+
+
+
+ $(NoWarn);AZC0001
+
+
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/ActionGroupsOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/ActionGroupsOperations.cs
new file mode 100644
index 000000000000..e1bd4a55cf3d
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/ActionGroupsOperations.cs
@@ -0,0 +1,338 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ /// The ActionGroups service client.
+ public partial class ActionGroupsOperations
+ {
+ private readonly ClientDiagnostics _clientDiagnostics;
+ private readonly HttpPipeline _pipeline;
+ internal ActionGroupsRestOperations RestClient { get; }
+ /// Initializes a new instance of ActionGroupsOperations for mocking.
+ protected ActionGroupsOperations()
+ {
+ }
+ /// Initializes a new instance of ActionGroupsOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The Azure subscription Id.
+ /// server parameter.
+ internal ActionGroupsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ RestClient = new ActionGroupsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ /// Create a new action group or update an existing one.
+ /// The name of the resource group.
+ /// The name of the action group.
+ /// The action group to create or use for the update.
+ /// The cancellation token to use.
+ public virtual async Task> CreateOrUpdateAsync(string resourceGroupName, string actionGroupName, ActionGroupResource actionGroup, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActionGroupsOperations.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ return await RestClient.CreateOrUpdateAsync(resourceGroupName, actionGroupName, actionGroup, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Create a new action group or update an existing one.
+ /// The name of the resource group.
+ /// The name of the action group.
+ /// The action group to create or use for the update.
+ /// The cancellation token to use.
+ public virtual Response CreateOrUpdate(string resourceGroupName, string actionGroupName, ActionGroupResource actionGroup, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActionGroupsOperations.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ return RestClient.CreateOrUpdate(resourceGroupName, actionGroupName, actionGroup, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Get an action group.
+ /// The name of the resource group.
+ /// The name of the action group.
+ /// The cancellation token to use.
+ public virtual async Task> GetAsync(string resourceGroupName, string actionGroupName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActionGroupsOperations.Get");
+ scope.Start();
+ try
+ {
+ return await RestClient.GetAsync(resourceGroupName, actionGroupName, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Get an action group.
+ /// The name of the resource group.
+ /// The name of the action group.
+ /// The cancellation token to use.
+ public virtual Response Get(string resourceGroupName, string actionGroupName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActionGroupsOperations.Get");
+ scope.Start();
+ try
+ {
+ return RestClient.Get(resourceGroupName, actionGroupName, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Delete an action group.
+ /// The name of the resource group.
+ /// The name of the action group.
+ /// The cancellation token to use.
+ public virtual async Task DeleteAsync(string resourceGroupName, string actionGroupName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActionGroupsOperations.Delete");
+ scope.Start();
+ try
+ {
+ return await RestClient.DeleteAsync(resourceGroupName, actionGroupName, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Delete an action group.
+ /// The name of the resource group.
+ /// The name of the action group.
+ /// The cancellation token to use.
+ public virtual Response Delete(string resourceGroupName, string actionGroupName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActionGroupsOperations.Delete");
+ scope.Start();
+ try
+ {
+ return RestClient.Delete(resourceGroupName, actionGroupName, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Updates an existing action group's tags. To update other fields use the CreateOrUpdate method.
+ /// The name of the resource group.
+ /// The name of the action group.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ public virtual async Task> UpdateAsync(string resourceGroupName, string actionGroupName, ActionGroupPatchBody actionGroupPatch, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActionGroupsOperations.Update");
+ scope.Start();
+ try
+ {
+ return await RestClient.UpdateAsync(resourceGroupName, actionGroupName, actionGroupPatch, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Updates an existing action group's tags. To update other fields use the CreateOrUpdate method.
+ /// The name of the resource group.
+ /// The name of the action group.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ public virtual Response Update(string resourceGroupName, string actionGroupName, ActionGroupPatchBody actionGroupPatch, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActionGroupsOperations.Update");
+ scope.Start();
+ try
+ {
+ return RestClient.Update(resourceGroupName, actionGroupName, actionGroupPatch, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This operation is only supported for Email or SMS receivers.
+ /// The name of the resource group.
+ /// The name of the action group.
+ /// The receiver to re-enable.
+ /// The cancellation token to use.
+ public virtual async Task EnableReceiverAsync(string resourceGroupName, string actionGroupName, EnableRequest enableRequest, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActionGroupsOperations.EnableReceiver");
+ scope.Start();
+ try
+ {
+ return await RestClient.EnableReceiverAsync(resourceGroupName, actionGroupName, enableRequest, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This operation is only supported for Email or SMS receivers.
+ /// The name of the resource group.
+ /// The name of the action group.
+ /// The receiver to re-enable.
+ /// The cancellation token to use.
+ public virtual Response EnableReceiver(string resourceGroupName, string actionGroupName, EnableRequest enableRequest, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActionGroupsOperations.EnableReceiver");
+ scope.Start();
+ try
+ {
+ return RestClient.EnableReceiver(resourceGroupName, actionGroupName, enableRequest, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Get a list of all action groups in a subscription.
+ /// The cancellation token to use.
+ public virtual AsyncPageable ListBySubscriptionIdAsync(CancellationToken cancellationToken = default)
+ {
+ async Task> FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActionGroupsOperations.ListBySubscriptionId");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListBySubscriptionIdAsync(cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null);
+ }
+
+ /// Get a list of all action groups in a subscription.
+ /// The cancellation token to use.
+ public virtual Pageable ListBySubscriptionId(CancellationToken cancellationToken = default)
+ {
+ Page FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActionGroupsOperations.ListBySubscriptionId");
+ scope.Start();
+ try
+ {
+ var response = RestClient.ListBySubscriptionId(cancellationToken);
+ return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateEnumerable(FirstPageFunc, null);
+ }
+
+ /// Get a list of all action groups in a resource group.
+ /// The name of the resource group.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual AsyncPageable ListByResourceGroupAsync(string resourceGroupName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+
+ async Task> FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActionGroupsOperations.ListByResourceGroup");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null);
+ }
+
+ /// Get a list of all action groups in a resource group.
+ /// The name of the resource group.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual Pageable ListByResourceGroup(string resourceGroupName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+
+ Page FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActionGroupsOperations.ListByResourceGroup");
+ scope.Start();
+ try
+ {
+ var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken);
+ return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateEnumerable(FirstPageFunc, null);
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/ActionGroupsRestOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/ActionGroupsRestOperations.cs
new file mode 100644
index 000000000000..7c4cd25cf6aa
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/ActionGroupsRestOperations.cs
@@ -0,0 +1,611 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ internal partial class ActionGroupsRestOperations
+ {
+ private string subscriptionId;
+ private Uri endpoint;
+ private ClientDiagnostics _clientDiagnostics;
+ private HttpPipeline _pipeline;
+
+ /// Initializes a new instance of ActionGroupsRestOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The Azure subscription Id.
+ /// server parameter.
+ /// is null.
+ public ActionGroupsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ if (subscriptionId == null)
+ {
+ throw new ArgumentNullException(nameof(subscriptionId));
+ }
+ endpoint ??= new Uri("https://management.azure.com");
+
+ this.subscriptionId = subscriptionId;
+ this.endpoint = endpoint;
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string actionGroupName, ActionGroupResource actionGroup)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Put;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/microsoft.insights/actionGroups/", false);
+ uri.AppendPath(actionGroupName, true);
+ uri.AppendQuery("api-version", "2019-06-01", true);
+ request.Uri = uri;
+ request.Headers.Add("Content-Type", "application/json");
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(actionGroup);
+ request.Content = content;
+ return message;
+ }
+
+ /// Create a new action group or update an existing one.
+ /// The name of the resource group.
+ /// The name of the action group.
+ /// The action group to create or use for the update.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public async Task> CreateOrUpdateAsync(string resourceGroupName, string actionGroupName, ActionGroupResource actionGroup, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (actionGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(actionGroupName));
+ }
+ if (actionGroup == null)
+ {
+ throw new ArgumentNullException(nameof(actionGroup));
+ }
+
+ using var message = CreateCreateOrUpdateRequest(resourceGroupName, actionGroupName, actionGroup);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 201:
+ {
+ ActionGroupResource value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = ActionGroupResource.DeserializeActionGroupResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Create a new action group or update an existing one.
+ /// The name of the resource group.
+ /// The name of the action group.
+ /// The action group to create or use for the update.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public Response CreateOrUpdate(string resourceGroupName, string actionGroupName, ActionGroupResource actionGroup, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (actionGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(actionGroupName));
+ }
+ if (actionGroup == null)
+ {
+ throw new ArgumentNullException(nameof(actionGroup));
+ }
+
+ using var message = CreateCreateOrUpdateRequest(resourceGroupName, actionGroupName, actionGroup);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 201:
+ {
+ ActionGroupResource value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = ActionGroupResource.DeserializeActionGroupResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateGetRequest(string resourceGroupName, string actionGroupName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/microsoft.insights/actionGroups/", false);
+ uri.AppendPath(actionGroupName, true);
+ uri.AppendQuery("api-version", "2019-06-01", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Get an action group.
+ /// The name of the resource group.
+ /// The name of the action group.
+ /// The cancellation token to use.
+ /// or is null.
+ public async Task> GetAsync(string resourceGroupName, string actionGroupName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (actionGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(actionGroupName));
+ }
+
+ using var message = CreateGetRequest(resourceGroupName, actionGroupName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ ActionGroupResource value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = ActionGroupResource.DeserializeActionGroupResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Get an action group.
+ /// The name of the resource group.
+ /// The name of the action group.
+ /// The cancellation token to use.
+ /// or is null.
+ public Response Get(string resourceGroupName, string actionGroupName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (actionGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(actionGroupName));
+ }
+
+ using var message = CreateGetRequest(resourceGroupName, actionGroupName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ ActionGroupResource value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = ActionGroupResource.DeserializeActionGroupResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string actionGroupName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Delete;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/microsoft.insights/actionGroups/", false);
+ uri.AppendPath(actionGroupName, true);
+ uri.AppendQuery("api-version", "2019-06-01", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Delete an action group.
+ /// The name of the resource group.
+ /// The name of the action group.
+ /// The cancellation token to use.
+ /// or is null.
+ public async Task DeleteAsync(string resourceGroupName, string actionGroupName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (actionGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(actionGroupName));
+ }
+
+ using var message = CreateDeleteRequest(resourceGroupName, actionGroupName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 204:
+ return message.Response;
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Delete an action group.
+ /// The name of the resource group.
+ /// The name of the action group.
+ /// The cancellation token to use.
+ /// or is null.
+ public Response Delete(string resourceGroupName, string actionGroupName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (actionGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(actionGroupName));
+ }
+
+ using var message = CreateDeleteRequest(resourceGroupName, actionGroupName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 204:
+ return message.Response;
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string actionGroupName, ActionGroupPatchBody actionGroupPatch)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Patch;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/microsoft.insights/actionGroups/", false);
+ uri.AppendPath(actionGroupName, true);
+ uri.AppendQuery("api-version", "2019-06-01", true);
+ request.Uri = uri;
+ request.Headers.Add("Content-Type", "application/json");
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(actionGroupPatch);
+ request.Content = content;
+ return message;
+ }
+
+ /// Updates an existing action group's tags. To update other fields use the CreateOrUpdate method.
+ /// The name of the resource group.
+ /// The name of the action group.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public async Task> UpdateAsync(string resourceGroupName, string actionGroupName, ActionGroupPatchBody actionGroupPatch, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (actionGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(actionGroupName));
+ }
+ if (actionGroupPatch == null)
+ {
+ throw new ArgumentNullException(nameof(actionGroupPatch));
+ }
+
+ using var message = CreateUpdateRequest(resourceGroupName, actionGroupName, actionGroupPatch);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ ActionGroupResource value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = ActionGroupResource.DeserializeActionGroupResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Updates an existing action group's tags. To update other fields use the CreateOrUpdate method.
+ /// The name of the resource group.
+ /// The name of the action group.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public Response Update(string resourceGroupName, string actionGroupName, ActionGroupPatchBody actionGroupPatch, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (actionGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(actionGroupName));
+ }
+ if (actionGroupPatch == null)
+ {
+ throw new ArgumentNullException(nameof(actionGroupPatch));
+ }
+
+ using var message = CreateUpdateRequest(resourceGroupName, actionGroupName, actionGroupPatch);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ ActionGroupResource value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = ActionGroupResource.DeserializeActionGroupResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateListBySubscriptionIdRequest()
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/providers/microsoft.insights/actionGroups", false);
+ uri.AppendQuery("api-version", "2019-06-01", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Get a list of all action groups in a subscription.
+ /// The cancellation token to use.
+ public async Task> ListBySubscriptionIdAsync(CancellationToken cancellationToken = default)
+ {
+ using var message = CreateListBySubscriptionIdRequest();
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ ActionGroupList value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = ActionGroupList.DeserializeActionGroupList(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Get a list of all action groups in a subscription.
+ /// The cancellation token to use.
+ public Response ListBySubscriptionId(CancellationToken cancellationToken = default)
+ {
+ using var message = CreateListBySubscriptionIdRequest();
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ ActionGroupList value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = ActionGroupList.DeserializeActionGroupList(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/microsoft.insights/actionGroups", false);
+ uri.AppendQuery("api-version", "2019-06-01", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Get a list of all action groups in a resource group.
+ /// The name of the resource group.
+ /// The cancellation token to use.
+ /// is null.
+ public async Task> ListByResourceGroupAsync(string resourceGroupName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+
+ using var message = CreateListByResourceGroupRequest(resourceGroupName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ ActionGroupList value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = ActionGroupList.DeserializeActionGroupList(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Get a list of all action groups in a resource group.
+ /// The name of the resource group.
+ /// The cancellation token to use.
+ /// is null.
+ public Response ListByResourceGroup(string resourceGroupName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+
+ using var message = CreateListByResourceGroupRequest(resourceGroupName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ ActionGroupList value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = ActionGroupList.DeserializeActionGroupList(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateEnableReceiverRequest(string resourceGroupName, string actionGroupName, EnableRequest enableRequest)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Post;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/microsoft.insights/actionGroups/", false);
+ uri.AppendPath(actionGroupName, true);
+ uri.AppendPath("/subscribe", false);
+ uri.AppendQuery("api-version", "2019-06-01", true);
+ request.Uri = uri;
+ request.Headers.Add("Content-Type", "application/json");
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(enableRequest);
+ request.Content = content;
+ return message;
+ }
+
+ /// Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This operation is only supported for Email or SMS receivers.
+ /// The name of the resource group.
+ /// The name of the action group.
+ /// The receiver to re-enable.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public async Task EnableReceiverAsync(string resourceGroupName, string actionGroupName, EnableRequest enableRequest, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (actionGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(actionGroupName));
+ }
+ if (enableRequest == null)
+ {
+ throw new ArgumentNullException(nameof(enableRequest));
+ }
+
+ using var message = CreateEnableReceiverRequest(resourceGroupName, actionGroupName, enableRequest);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 409:
+ return message.Response;
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This operation is only supported for Email or SMS receivers.
+ /// The name of the resource group.
+ /// The name of the action group.
+ /// The receiver to re-enable.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public Response EnableReceiver(string resourceGroupName, string actionGroupName, EnableRequest enableRequest, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (actionGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(actionGroupName));
+ }
+ if (enableRequest == null)
+ {
+ throw new ArgumentNullException(nameof(enableRequest));
+ }
+
+ using var message = CreateEnableReceiverRequest(resourceGroupName, actionGroupName, enableRequest);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 409:
+ return message.Response;
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/ActivityLogAlertsOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/ActivityLogAlertsOperations.cs
new file mode 100644
index 000000000000..0a12168d4ef1
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/ActivityLogAlertsOperations.cs
@@ -0,0 +1,298 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ /// The ActivityLogAlerts service client.
+ public partial class ActivityLogAlertsOperations
+ {
+ private readonly ClientDiagnostics _clientDiagnostics;
+ private readonly HttpPipeline _pipeline;
+ internal ActivityLogAlertsRestOperations RestClient { get; }
+ /// Initializes a new instance of ActivityLogAlertsOperations for mocking.
+ protected ActivityLogAlertsOperations()
+ {
+ }
+ /// Initializes a new instance of ActivityLogAlertsOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The Azure subscription Id.
+ /// server parameter.
+ internal ActivityLogAlertsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ RestClient = new ActivityLogAlertsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ /// Create a new activity log alert or update an existing one.
+ /// The name of the resource group.
+ /// The name of the activity log alert.
+ /// The activity log alert to create or use for the update.
+ /// The cancellation token to use.
+ public virtual async Task> CreateOrUpdateAsync(string resourceGroupName, string activityLogAlertName, ActivityLogAlertResource activityLogAlert, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActivityLogAlertsOperations.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ return await RestClient.CreateOrUpdateAsync(resourceGroupName, activityLogAlertName, activityLogAlert, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Create a new activity log alert or update an existing one.
+ /// The name of the resource group.
+ /// The name of the activity log alert.
+ /// The activity log alert to create or use for the update.
+ /// The cancellation token to use.
+ public virtual Response CreateOrUpdate(string resourceGroupName, string activityLogAlertName, ActivityLogAlertResource activityLogAlert, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActivityLogAlertsOperations.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ return RestClient.CreateOrUpdate(resourceGroupName, activityLogAlertName, activityLogAlert, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Get an activity log alert.
+ /// The name of the resource group.
+ /// The name of the activity log alert.
+ /// The cancellation token to use.
+ public virtual async Task> GetAsync(string resourceGroupName, string activityLogAlertName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActivityLogAlertsOperations.Get");
+ scope.Start();
+ try
+ {
+ return await RestClient.GetAsync(resourceGroupName, activityLogAlertName, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Get an activity log alert.
+ /// The name of the resource group.
+ /// The name of the activity log alert.
+ /// The cancellation token to use.
+ public virtual Response Get(string resourceGroupName, string activityLogAlertName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActivityLogAlertsOperations.Get");
+ scope.Start();
+ try
+ {
+ return RestClient.Get(resourceGroupName, activityLogAlertName, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Delete an activity log alert.
+ /// The name of the resource group.
+ /// The name of the activity log alert.
+ /// The cancellation token to use.
+ public virtual async Task DeleteAsync(string resourceGroupName, string activityLogAlertName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActivityLogAlertsOperations.Delete");
+ scope.Start();
+ try
+ {
+ return await RestClient.DeleteAsync(resourceGroupName, activityLogAlertName, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Delete an activity log alert.
+ /// The name of the resource group.
+ /// The name of the activity log alert.
+ /// The cancellation token to use.
+ public virtual Response Delete(string resourceGroupName, string activityLogAlertName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActivityLogAlertsOperations.Delete");
+ scope.Start();
+ try
+ {
+ return RestClient.Delete(resourceGroupName, activityLogAlertName, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method.
+ /// The name of the resource group.
+ /// The name of the activity log alert.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ public virtual async Task> UpdateAsync(string resourceGroupName, string activityLogAlertName, ActivityLogAlertPatchBody activityLogAlertPatch, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActivityLogAlertsOperations.Update");
+ scope.Start();
+ try
+ {
+ return await RestClient.UpdateAsync(resourceGroupName, activityLogAlertName, activityLogAlertPatch, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method.
+ /// The name of the resource group.
+ /// The name of the activity log alert.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ public virtual Response Update(string resourceGroupName, string activityLogAlertName, ActivityLogAlertPatchBody activityLogAlertPatch, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActivityLogAlertsOperations.Update");
+ scope.Start();
+ try
+ {
+ return RestClient.Update(resourceGroupName, activityLogAlertName, activityLogAlertPatch, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Get a list of all activity log alerts in a subscription.
+ /// The cancellation token to use.
+ public virtual AsyncPageable ListBySubscriptionIdAsync(CancellationToken cancellationToken = default)
+ {
+ async Task> FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActivityLogAlertsOperations.ListBySubscriptionId");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListBySubscriptionIdAsync(cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null);
+ }
+
+ /// Get a list of all activity log alerts in a subscription.
+ /// The cancellation token to use.
+ public virtual Pageable ListBySubscriptionId(CancellationToken cancellationToken = default)
+ {
+ Page FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActivityLogAlertsOperations.ListBySubscriptionId");
+ scope.Start();
+ try
+ {
+ var response = RestClient.ListBySubscriptionId(cancellationToken);
+ return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateEnumerable(FirstPageFunc, null);
+ }
+
+ /// Get a list of all activity log alerts in a resource group.
+ /// The name of the resource group.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual AsyncPageable ListByResourceGroupAsync(string resourceGroupName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+
+ async Task> FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActivityLogAlertsOperations.ListByResourceGroup");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null);
+ }
+
+ /// Get a list of all activity log alerts in a resource group.
+ /// The name of the resource group.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual Pageable ListByResourceGroup(string resourceGroupName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+
+ Page FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActivityLogAlertsOperations.ListByResourceGroup");
+ scope.Start();
+ try
+ {
+ var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken);
+ return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateEnumerable(FirstPageFunc, null);
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/ActivityLogAlertsRestOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/ActivityLogAlertsRestOperations.cs
new file mode 100644
index 000000000000..6184b5f54b8b
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/ActivityLogAlertsRestOperations.cs
@@ -0,0 +1,522 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ internal partial class ActivityLogAlertsRestOperations
+ {
+ private string subscriptionId;
+ private Uri endpoint;
+ private ClientDiagnostics _clientDiagnostics;
+ private HttpPipeline _pipeline;
+
+ /// Initializes a new instance of ActivityLogAlertsRestOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The Azure subscription Id.
+ /// server parameter.
+ /// is null.
+ public ActivityLogAlertsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ if (subscriptionId == null)
+ {
+ throw new ArgumentNullException(nameof(subscriptionId));
+ }
+ endpoint ??= new Uri("https://management.azure.com");
+
+ this.subscriptionId = subscriptionId;
+ this.endpoint = endpoint;
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string activityLogAlertName, ActivityLogAlertResource activityLogAlert)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Put;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/microsoft.insights/activityLogAlerts/", false);
+ uri.AppendPath(activityLogAlertName, true);
+ uri.AppendQuery("api-version", "2017-04-01", true);
+ request.Uri = uri;
+ request.Headers.Add("Content-Type", "application/json");
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(activityLogAlert);
+ request.Content = content;
+ return message;
+ }
+
+ /// Create a new activity log alert or update an existing one.
+ /// The name of the resource group.
+ /// The name of the activity log alert.
+ /// The activity log alert to create or use for the update.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public async Task> CreateOrUpdateAsync(string resourceGroupName, string activityLogAlertName, ActivityLogAlertResource activityLogAlert, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (activityLogAlertName == null)
+ {
+ throw new ArgumentNullException(nameof(activityLogAlertName));
+ }
+ if (activityLogAlert == null)
+ {
+ throw new ArgumentNullException(nameof(activityLogAlert));
+ }
+
+ using var message = CreateCreateOrUpdateRequest(resourceGroupName, activityLogAlertName, activityLogAlert);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 201:
+ {
+ ActivityLogAlertResource value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = ActivityLogAlertResource.DeserializeActivityLogAlertResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Create a new activity log alert or update an existing one.
+ /// The name of the resource group.
+ /// The name of the activity log alert.
+ /// The activity log alert to create or use for the update.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public Response CreateOrUpdate(string resourceGroupName, string activityLogAlertName, ActivityLogAlertResource activityLogAlert, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (activityLogAlertName == null)
+ {
+ throw new ArgumentNullException(nameof(activityLogAlertName));
+ }
+ if (activityLogAlert == null)
+ {
+ throw new ArgumentNullException(nameof(activityLogAlert));
+ }
+
+ using var message = CreateCreateOrUpdateRequest(resourceGroupName, activityLogAlertName, activityLogAlert);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 201:
+ {
+ ActivityLogAlertResource value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = ActivityLogAlertResource.DeserializeActivityLogAlertResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateGetRequest(string resourceGroupName, string activityLogAlertName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/microsoft.insights/activityLogAlerts/", false);
+ uri.AppendPath(activityLogAlertName, true);
+ uri.AppendQuery("api-version", "2017-04-01", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Get an activity log alert.
+ /// The name of the resource group.
+ /// The name of the activity log alert.
+ /// The cancellation token to use.
+ /// or is null.
+ public async Task> GetAsync(string resourceGroupName, string activityLogAlertName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (activityLogAlertName == null)
+ {
+ throw new ArgumentNullException(nameof(activityLogAlertName));
+ }
+
+ using var message = CreateGetRequest(resourceGroupName, activityLogAlertName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ ActivityLogAlertResource value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = ActivityLogAlertResource.DeserializeActivityLogAlertResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Get an activity log alert.
+ /// The name of the resource group.
+ /// The name of the activity log alert.
+ /// The cancellation token to use.
+ /// or is null.
+ public Response Get(string resourceGroupName, string activityLogAlertName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (activityLogAlertName == null)
+ {
+ throw new ArgumentNullException(nameof(activityLogAlertName));
+ }
+
+ using var message = CreateGetRequest(resourceGroupName, activityLogAlertName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ ActivityLogAlertResource value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = ActivityLogAlertResource.DeserializeActivityLogAlertResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string activityLogAlertName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Delete;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/microsoft.insights/activityLogAlerts/", false);
+ uri.AppendPath(activityLogAlertName, true);
+ uri.AppendQuery("api-version", "2017-04-01", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Delete an activity log alert.
+ /// The name of the resource group.
+ /// The name of the activity log alert.
+ /// The cancellation token to use.
+ /// or is null.
+ public async Task DeleteAsync(string resourceGroupName, string activityLogAlertName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (activityLogAlertName == null)
+ {
+ throw new ArgumentNullException(nameof(activityLogAlertName));
+ }
+
+ using var message = CreateDeleteRequest(resourceGroupName, activityLogAlertName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 204:
+ return message.Response;
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Delete an activity log alert.
+ /// The name of the resource group.
+ /// The name of the activity log alert.
+ /// The cancellation token to use.
+ /// or is null.
+ public Response Delete(string resourceGroupName, string activityLogAlertName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (activityLogAlertName == null)
+ {
+ throw new ArgumentNullException(nameof(activityLogAlertName));
+ }
+
+ using var message = CreateDeleteRequest(resourceGroupName, activityLogAlertName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 204:
+ return message.Response;
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string activityLogAlertName, ActivityLogAlertPatchBody activityLogAlertPatch)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Patch;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/microsoft.insights/activityLogAlerts/", false);
+ uri.AppendPath(activityLogAlertName, true);
+ uri.AppendQuery("api-version", "2017-04-01", true);
+ request.Uri = uri;
+ request.Headers.Add("Content-Type", "application/json");
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(activityLogAlertPatch);
+ request.Content = content;
+ return message;
+ }
+
+ /// Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method.
+ /// The name of the resource group.
+ /// The name of the activity log alert.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public async Task> UpdateAsync(string resourceGroupName, string activityLogAlertName, ActivityLogAlertPatchBody activityLogAlertPatch, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (activityLogAlertName == null)
+ {
+ throw new ArgumentNullException(nameof(activityLogAlertName));
+ }
+ if (activityLogAlertPatch == null)
+ {
+ throw new ArgumentNullException(nameof(activityLogAlertPatch));
+ }
+
+ using var message = CreateUpdateRequest(resourceGroupName, activityLogAlertName, activityLogAlertPatch);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ ActivityLogAlertResource value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = ActivityLogAlertResource.DeserializeActivityLogAlertResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method.
+ /// The name of the resource group.
+ /// The name of the activity log alert.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public Response Update(string resourceGroupName, string activityLogAlertName, ActivityLogAlertPatchBody activityLogAlertPatch, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (activityLogAlertName == null)
+ {
+ throw new ArgumentNullException(nameof(activityLogAlertName));
+ }
+ if (activityLogAlertPatch == null)
+ {
+ throw new ArgumentNullException(nameof(activityLogAlertPatch));
+ }
+
+ using var message = CreateUpdateRequest(resourceGroupName, activityLogAlertName, activityLogAlertPatch);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ ActivityLogAlertResource value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = ActivityLogAlertResource.DeserializeActivityLogAlertResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateListBySubscriptionIdRequest()
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/providers/microsoft.insights/activityLogAlerts", false);
+ uri.AppendQuery("api-version", "2017-04-01", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Get a list of all activity log alerts in a subscription.
+ /// The cancellation token to use.
+ public async Task> ListBySubscriptionIdAsync(CancellationToken cancellationToken = default)
+ {
+ using var message = CreateListBySubscriptionIdRequest();
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ ActivityLogAlertList value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = ActivityLogAlertList.DeserializeActivityLogAlertList(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Get a list of all activity log alerts in a subscription.
+ /// The cancellation token to use.
+ public Response ListBySubscriptionId(CancellationToken cancellationToken = default)
+ {
+ using var message = CreateListBySubscriptionIdRequest();
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ ActivityLogAlertList value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = ActivityLogAlertList.DeserializeActivityLogAlertList(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/microsoft.insights/activityLogAlerts", false);
+ uri.AppendQuery("api-version", "2017-04-01", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Get a list of all activity log alerts in a resource group.
+ /// The name of the resource group.
+ /// The cancellation token to use.
+ /// is null.
+ public async Task> ListByResourceGroupAsync(string resourceGroupName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+
+ using var message = CreateListByResourceGroupRequest(resourceGroupName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ ActivityLogAlertList value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = ActivityLogAlertList.DeserializeActivityLogAlertList(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Get a list of all activity log alerts in a resource group.
+ /// The name of the resource group.
+ /// The cancellation token to use.
+ /// is null.
+ public Response ListByResourceGroup(string resourceGroupName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+
+ using var message = CreateListByResourceGroupRequest(resourceGroupName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ ActivityLogAlertList value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = ActivityLogAlertList.DeserializeActivityLogAlertList(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/ActivityLogsOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/ActivityLogsOperations.cs
new file mode 100644
index 000000000000..680813836b37
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/ActivityLogsOperations.cs
@@ -0,0 +1,130 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ /// The ActivityLogs service client.
+ public partial class ActivityLogsOperations
+ {
+ private readonly ClientDiagnostics _clientDiagnostics;
+ private readonly HttpPipeline _pipeline;
+ internal ActivityLogsRestOperations RestClient { get; }
+ /// Initializes a new instance of ActivityLogsOperations for mocking.
+ protected ActivityLogsOperations()
+ {
+ }
+ /// Initializes a new instance of ActivityLogsOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The Azure subscription Id.
+ /// server parameter.
+ internal ActivityLogsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ RestClient = new ActivityLogsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ /// Provides the list of records from the activity logs.
+ /// Reduces the set of data collected.<br>This argument is required and it also requires at least the start date/time.<br>The **$filter** argument is very restricted and allows only the following patterns.<br>- *List events for a resource group*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.<br>- *List events for resource*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.<br>- *List events for a subscription in a time range*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z'.<br>- *List events for a resource provider*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq 'resourceProviderName'.<br>- *List events for a correlation Id*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq 'correlationID'.<br><br>**NOTE**: No other syntax is allowed.
+ /// Used to fetch events with only the given properties.<br>The **$select** argument is a comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, *subStatus*, *subscriptionId*.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual AsyncPageable ListAsync(string filter, string select = null, CancellationToken cancellationToken = default)
+ {
+ if (filter == null)
+ {
+ throw new ArgumentNullException(nameof(filter));
+ }
+
+ async Task> FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActivityLogsOperations.List");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListAsync(filter, select, cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ async Task> NextPageFunc(string nextLink, int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActivityLogsOperations.List");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListNextPageAsync(nextLink, filter, select, cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
+ }
+
+ /// Provides the list of records from the activity logs.
+ /// Reduces the set of data collected.<br>This argument is required and it also requires at least the start date/time.<br>The **$filter** argument is very restricted and allows only the following patterns.<br>- *List events for a resource group*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.<br>- *List events for resource*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.<br>- *List events for a subscription in a time range*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z'.<br>- *List events for a resource provider*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq 'resourceProviderName'.<br>- *List events for a correlation Id*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq 'correlationID'.<br><br>**NOTE**: No other syntax is allowed.
+ /// Used to fetch events with only the given properties.<br>The **$select** argument is a comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, *subStatus*, *subscriptionId*.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual Pageable List(string filter, string select = null, CancellationToken cancellationToken = default)
+ {
+ if (filter == null)
+ {
+ throw new ArgumentNullException(nameof(filter));
+ }
+
+ Page FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActivityLogsOperations.List");
+ scope.Start();
+ try
+ {
+ var response = RestClient.List(filter, select, cancellationToken);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ Page NextPageFunc(string nextLink, int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("ActivityLogsOperations.List");
+ scope.Start();
+ try
+ {
+ var response = RestClient.ListNextPage(nextLink, filter, select, cancellationToken);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/ActivityLogsRestOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/ActivityLogsRestOperations.cs
new file mode 100644
index 000000000000..d1415c220298
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/ActivityLogsRestOperations.cs
@@ -0,0 +1,200 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ internal partial class ActivityLogsRestOperations
+ {
+ private string subscriptionId;
+ private Uri endpoint;
+ private ClientDiagnostics _clientDiagnostics;
+ private HttpPipeline _pipeline;
+
+ /// Initializes a new instance of ActivityLogsRestOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The Azure subscription Id.
+ /// server parameter.
+ /// is null.
+ public ActivityLogsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ if (subscriptionId == null)
+ {
+ throw new ArgumentNullException(nameof(subscriptionId));
+ }
+ endpoint ??= new Uri("https://management.azure.com");
+
+ this.subscriptionId = subscriptionId;
+ this.endpoint = endpoint;
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ internal HttpMessage CreateListRequest(string filter, string select)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/providers/microsoft.insights/eventtypes/management/values", false);
+ uri.AppendQuery("api-version", "2015-04-01", true);
+ uri.AppendQuery("$filter", filter, true);
+ if (select != null)
+ {
+ uri.AppendQuery("$select", select, true);
+ }
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Provides the list of records from the activity logs.
+ /// Reduces the set of data collected.<br>This argument is required and it also requires at least the start date/time.<br>The **$filter** argument is very restricted and allows only the following patterns.<br>- *List events for a resource group*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.<br>- *List events for resource*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.<br>- *List events for a subscription in a time range*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z'.<br>- *List events for a resource provider*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq 'resourceProviderName'.<br>- *List events for a correlation Id*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq 'correlationID'.<br><br>**NOTE**: No other syntax is allowed.
+ /// Used to fetch events with only the given properties.<br>The **$select** argument is a comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, *subStatus*, *subscriptionId*.
+ /// The cancellation token to use.
+ /// is null.
+ public async Task> ListAsync(string filter, string select = null, CancellationToken cancellationToken = default)
+ {
+ if (filter == null)
+ {
+ throw new ArgumentNullException(nameof(filter));
+ }
+
+ using var message = CreateListRequest(filter, select);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ EventDataCollection value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = EventDataCollection.DeserializeEventDataCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Provides the list of records from the activity logs.
+ /// Reduces the set of data collected.<br>This argument is required and it also requires at least the start date/time.<br>The **$filter** argument is very restricted and allows only the following patterns.<br>- *List events for a resource group*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.<br>- *List events for resource*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.<br>- *List events for a subscription in a time range*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z'.<br>- *List events for a resource provider*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq 'resourceProviderName'.<br>- *List events for a correlation Id*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq 'correlationID'.<br><br>**NOTE**: No other syntax is allowed.
+ /// Used to fetch events with only the given properties.<br>The **$select** argument is a comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, *subStatus*, *subscriptionId*.
+ /// The cancellation token to use.
+ /// is null.
+ public Response List(string filter, string select = null, CancellationToken cancellationToken = default)
+ {
+ if (filter == null)
+ {
+ throw new ArgumentNullException(nameof(filter));
+ }
+
+ using var message = CreateListRequest(filter, select);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ EventDataCollection value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = EventDataCollection.DeserializeEventDataCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateListNextPageRequest(string nextLink, string filter, string select)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendRawNextLink(nextLink, false);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Provides the list of records from the activity logs.
+ /// The URL to the next page of results.
+ /// Reduces the set of data collected.<br>This argument is required and it also requires at least the start date/time.<br>The **$filter** argument is very restricted and allows only the following patterns.<br>- *List events for a resource group*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.<br>- *List events for resource*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.<br>- *List events for a subscription in a time range*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z'.<br>- *List events for a resource provider*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq 'resourceProviderName'.<br>- *List events for a correlation Id*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq 'correlationID'.<br><br>**NOTE**: No other syntax is allowed.
+ /// Used to fetch events with only the given properties.<br>The **$select** argument is a comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, *subStatus*, *subscriptionId*.
+ /// The cancellation token to use.
+ /// or is null.
+ public async Task> ListNextPageAsync(string nextLink, string filter, string select = null, CancellationToken cancellationToken = default)
+ {
+ if (nextLink == null)
+ {
+ throw new ArgumentNullException(nameof(nextLink));
+ }
+ if (filter == null)
+ {
+ throw new ArgumentNullException(nameof(filter));
+ }
+
+ using var message = CreateListNextPageRequest(nextLink, filter, select);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ EventDataCollection value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = EventDataCollection.DeserializeEventDataCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Provides the list of records from the activity logs.
+ /// The URL to the next page of results.
+ /// Reduces the set of data collected.<br>This argument is required and it also requires at least the start date/time.<br>The **$filter** argument is very restricted and allows only the following patterns.<br>- *List events for a resource group*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.<br>- *List events for resource*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.<br>- *List events for a subscription in a time range*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z'.<br>- *List events for a resource provider*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq 'resourceProviderName'.<br>- *List events for a correlation Id*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq 'correlationID'.<br><br>**NOTE**: No other syntax is allowed.
+ /// Used to fetch events with only the given properties.<br>The **$select** argument is a comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, *subStatus*, *subscriptionId*.
+ /// The cancellation token to use.
+ /// or is null.
+ public Response ListNextPage(string nextLink, string filter, string select = null, CancellationToken cancellationToken = default)
+ {
+ if (nextLink == null)
+ {
+ throw new ArgumentNullException(nameof(nextLink));
+ }
+ if (filter == null)
+ {
+ throw new ArgumentNullException(nameof(filter));
+ }
+
+ using var message = CreateListNextPageRequest(nextLink, filter, select);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ EventDataCollection value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = EventDataCollection.DeserializeEventDataCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/AlertRuleIncidentsOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/AlertRuleIncidentsOperations.cs
new file mode 100644
index 000000000000..1fd546589bc3
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/AlertRuleIncidentsOperations.cs
@@ -0,0 +1,148 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ /// The AlertRuleIncidents service client.
+ public partial class AlertRuleIncidentsOperations
+ {
+ private readonly ClientDiagnostics _clientDiagnostics;
+ private readonly HttpPipeline _pipeline;
+ internal AlertRuleIncidentsRestOperations RestClient { get; }
+ /// Initializes a new instance of AlertRuleIncidentsOperations for mocking.
+ protected AlertRuleIncidentsOperations()
+ {
+ }
+ /// Initializes a new instance of AlertRuleIncidentsOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The Azure subscription Id.
+ /// server parameter.
+ internal AlertRuleIncidentsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ RestClient = new AlertRuleIncidentsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ /// Gets an incident associated to an alert rule.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The name of the incident to retrieve.
+ /// The cancellation token to use.
+ public virtual async Task> GetAsync(string resourceGroupName, string ruleName, string incidentName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AlertRuleIncidentsOperations.Get");
+ scope.Start();
+ try
+ {
+ return await RestClient.GetAsync(resourceGroupName, ruleName, incidentName, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets an incident associated to an alert rule.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The name of the incident to retrieve.
+ /// The cancellation token to use.
+ public virtual Response Get(string resourceGroupName, string ruleName, string incidentName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AlertRuleIncidentsOperations.Get");
+ scope.Start();
+ try
+ {
+ return RestClient.Get(resourceGroupName, ruleName, incidentName, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets a list of incidents associated to an alert rule.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The cancellation token to use.
+ /// or is null.
+ public virtual AsyncPageable ListByAlertRuleAsync(string resourceGroupName, string ruleName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (ruleName == null)
+ {
+ throw new ArgumentNullException(nameof(ruleName));
+ }
+
+ async Task> FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AlertRuleIncidentsOperations.ListByAlertRule");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListByAlertRuleAsync(resourceGroupName, ruleName, cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null);
+ }
+
+ /// Gets a list of incidents associated to an alert rule.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The cancellation token to use.
+ /// or is null.
+ public virtual Pageable ListByAlertRule(string resourceGroupName, string ruleName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (ruleName == null)
+ {
+ throw new ArgumentNullException(nameof(ruleName));
+ }
+
+ Page FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AlertRuleIncidentsOperations.ListByAlertRule");
+ scope.Start();
+ try
+ {
+ var response = RestClient.ListByAlertRule(resourceGroupName, ruleName, cancellationToken);
+ return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateEnumerable(FirstPageFunc, null);
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/AlertRuleIncidentsRestOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/AlertRuleIncidentsRestOperations.cs
new file mode 100644
index 000000000000..ed11738836b0
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/AlertRuleIncidentsRestOperations.cs
@@ -0,0 +1,223 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ internal partial class AlertRuleIncidentsRestOperations
+ {
+ private string subscriptionId;
+ private Uri endpoint;
+ private ClientDiagnostics _clientDiagnostics;
+ private HttpPipeline _pipeline;
+
+ /// Initializes a new instance of AlertRuleIncidentsRestOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The Azure subscription Id.
+ /// server parameter.
+ /// is null.
+ public AlertRuleIncidentsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ if (subscriptionId == null)
+ {
+ throw new ArgumentNullException(nameof(subscriptionId));
+ }
+ endpoint ??= new Uri("https://management.azure.com");
+
+ this.subscriptionId = subscriptionId;
+ this.endpoint = endpoint;
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ internal HttpMessage CreateGetRequest(string resourceGroupName, string ruleName, string incidentName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourcegroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/microsoft.insights/alertrules/", false);
+ uri.AppendPath(ruleName, true);
+ uri.AppendPath("/incidents/", false);
+ uri.AppendPath(incidentName, true);
+ uri.AppendQuery("api-version", "2016-03-01", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Gets an incident associated to an alert rule.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The name of the incident to retrieve.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public async Task> GetAsync(string resourceGroupName, string ruleName, string incidentName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (ruleName == null)
+ {
+ throw new ArgumentNullException(nameof(ruleName));
+ }
+ if (incidentName == null)
+ {
+ throw new ArgumentNullException(nameof(incidentName));
+ }
+
+ using var message = CreateGetRequest(resourceGroupName, ruleName, incidentName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ Incident value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = Incident.DeserializeIncident(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Gets an incident associated to an alert rule.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The name of the incident to retrieve.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public Response Get(string resourceGroupName, string ruleName, string incidentName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (ruleName == null)
+ {
+ throw new ArgumentNullException(nameof(ruleName));
+ }
+ if (incidentName == null)
+ {
+ throw new ArgumentNullException(nameof(incidentName));
+ }
+
+ using var message = CreateGetRequest(resourceGroupName, ruleName, incidentName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ Incident value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = Incident.DeserializeIncident(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateListByAlertRuleRequest(string resourceGroupName, string ruleName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourcegroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/microsoft.insights/alertrules/", false);
+ uri.AppendPath(ruleName, true);
+ uri.AppendPath("/incidents", false);
+ uri.AppendQuery("api-version", "2016-03-01", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Gets a list of incidents associated to an alert rule.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The cancellation token to use.
+ /// or is null.
+ public async Task> ListByAlertRuleAsync(string resourceGroupName, string ruleName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (ruleName == null)
+ {
+ throw new ArgumentNullException(nameof(ruleName));
+ }
+
+ using var message = CreateListByAlertRuleRequest(resourceGroupName, ruleName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ IncidentListResult value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = IncidentListResult.DeserializeIncidentListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Gets a list of incidents associated to an alert rule.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The cancellation token to use.
+ /// or is null.
+ public Response ListByAlertRule(string resourceGroupName, string ruleName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (ruleName == null)
+ {
+ throw new ArgumentNullException(nameof(ruleName));
+ }
+
+ using var message = CreateListByAlertRuleRequest(resourceGroupName, ruleName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ IncidentListResult value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = IncidentListResult.DeserializeIncidentListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/AlertRulesOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/AlertRulesOperations.cs
new file mode 100644
index 000000000000..3e45a0ed2778
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/AlertRulesOperations.cs
@@ -0,0 +1,298 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ /// The AlertRules service client.
+ public partial class AlertRulesOperations
+ {
+ private readonly ClientDiagnostics _clientDiagnostics;
+ private readonly HttpPipeline _pipeline;
+ internal AlertRulesRestOperations RestClient { get; }
+ /// Initializes a new instance of AlertRulesOperations for mocking.
+ protected AlertRulesOperations()
+ {
+ }
+ /// Initializes a new instance of AlertRulesOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The Azure subscription Id.
+ /// server parameter.
+ internal AlertRulesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ RestClient = new AlertRulesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ /// Creates or updates a classic metric alert rule.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The parameters of the rule to create or update.
+ /// The cancellation token to use.
+ public virtual async Task> CreateOrUpdateAsync(string resourceGroupName, string ruleName, AlertRuleResource parameters, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AlertRulesOperations.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ return await RestClient.CreateOrUpdateAsync(resourceGroupName, ruleName, parameters, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Creates or updates a classic metric alert rule.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The parameters of the rule to create or update.
+ /// The cancellation token to use.
+ public virtual Response CreateOrUpdate(string resourceGroupName, string ruleName, AlertRuleResource parameters, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AlertRulesOperations.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ return RestClient.CreateOrUpdate(resourceGroupName, ruleName, parameters, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Deletes a classic metric alert rule.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The cancellation token to use.
+ public virtual async Task DeleteAsync(string resourceGroupName, string ruleName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AlertRulesOperations.Delete");
+ scope.Start();
+ try
+ {
+ return await RestClient.DeleteAsync(resourceGroupName, ruleName, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Deletes a classic metric alert rule.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The cancellation token to use.
+ public virtual Response Delete(string resourceGroupName, string ruleName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AlertRulesOperations.Delete");
+ scope.Start();
+ try
+ {
+ return RestClient.Delete(resourceGroupName, ruleName, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets a classic metric alert rule.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The cancellation token to use.
+ public virtual async Task> GetAsync(string resourceGroupName, string ruleName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AlertRulesOperations.Get");
+ scope.Start();
+ try
+ {
+ return await RestClient.GetAsync(resourceGroupName, ruleName, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets a classic metric alert rule.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The cancellation token to use.
+ public virtual Response Get(string resourceGroupName, string ruleName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AlertRulesOperations.Get");
+ scope.Start();
+ try
+ {
+ return RestClient.Get(resourceGroupName, ruleName, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Updates an existing classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ public virtual async Task> UpdateAsync(string resourceGroupName, string ruleName, AlertRuleResourcePatch alertRulesResource, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AlertRulesOperations.Update");
+ scope.Start();
+ try
+ {
+ return await RestClient.UpdateAsync(resourceGroupName, ruleName, alertRulesResource, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Updates an existing classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ public virtual Response Update(string resourceGroupName, string ruleName, AlertRuleResourcePatch alertRulesResource, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AlertRulesOperations.Update");
+ scope.Start();
+ try
+ {
+ return RestClient.Update(resourceGroupName, ruleName, alertRulesResource, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// List the classic metric alert rules within a resource group.
+ /// The name of the resource group.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual AsyncPageable ListByResourceGroupAsync(string resourceGroupName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+
+ async Task> FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AlertRulesOperations.ListByResourceGroup");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null);
+ }
+
+ /// List the classic metric alert rules within a resource group.
+ /// The name of the resource group.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual Pageable ListByResourceGroup(string resourceGroupName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+
+ Page FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AlertRulesOperations.ListByResourceGroup");
+ scope.Start();
+ try
+ {
+ var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken);
+ return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateEnumerable(FirstPageFunc, null);
+ }
+
+ /// List the classic metric alert rules within a subscription.
+ /// The cancellation token to use.
+ public virtual AsyncPageable ListBySubscriptionAsync(CancellationToken cancellationToken = default)
+ {
+ async Task> FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AlertRulesOperations.ListBySubscription");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListBySubscriptionAsync(cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null);
+ }
+
+ /// List the classic metric alert rules within a subscription.
+ /// The cancellation token to use.
+ public virtual Pageable ListBySubscription(CancellationToken cancellationToken = default)
+ {
+ Page FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AlertRulesOperations.ListBySubscription");
+ scope.Start();
+ try
+ {
+ var response = RestClient.ListBySubscription(cancellationToken);
+ return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateEnumerable(FirstPageFunc, null);
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/AlertRulesRestOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/AlertRulesRestOperations.cs
new file mode 100644
index 000000000000..475cad72a626
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/AlertRulesRestOperations.cs
@@ -0,0 +1,524 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ internal partial class AlertRulesRestOperations
+ {
+ private string subscriptionId;
+ private Uri endpoint;
+ private ClientDiagnostics _clientDiagnostics;
+ private HttpPipeline _pipeline;
+
+ /// Initializes a new instance of AlertRulesRestOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The Azure subscription Id.
+ /// server parameter.
+ /// is null.
+ public AlertRulesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ if (subscriptionId == null)
+ {
+ throw new ArgumentNullException(nameof(subscriptionId));
+ }
+ endpoint ??= new Uri("https://management.azure.com");
+
+ this.subscriptionId = subscriptionId;
+ this.endpoint = endpoint;
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string ruleName, AlertRuleResource parameters)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Put;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourcegroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/microsoft.insights/alertrules/", false);
+ uri.AppendPath(ruleName, true);
+ uri.AppendQuery("api-version", "2016-03-01", true);
+ request.Uri = uri;
+ request.Headers.Add("Content-Type", "application/json");
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(parameters);
+ request.Content = content;
+ return message;
+ }
+
+ /// Creates or updates a classic metric alert rule.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The parameters of the rule to create or update.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public async Task> CreateOrUpdateAsync(string resourceGroupName, string ruleName, AlertRuleResource parameters, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (ruleName == null)
+ {
+ throw new ArgumentNullException(nameof(ruleName));
+ }
+ if (parameters == null)
+ {
+ throw new ArgumentNullException(nameof(parameters));
+ }
+
+ using var message = CreateCreateOrUpdateRequest(resourceGroupName, ruleName, parameters);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 201:
+ {
+ AlertRuleResource value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = AlertRuleResource.DeserializeAlertRuleResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Creates or updates a classic metric alert rule.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The parameters of the rule to create or update.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public Response CreateOrUpdate(string resourceGroupName, string ruleName, AlertRuleResource parameters, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (ruleName == null)
+ {
+ throw new ArgumentNullException(nameof(ruleName));
+ }
+ if (parameters == null)
+ {
+ throw new ArgumentNullException(nameof(parameters));
+ }
+
+ using var message = CreateCreateOrUpdateRequest(resourceGroupName, ruleName, parameters);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 201:
+ {
+ AlertRuleResource value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = AlertRuleResource.DeserializeAlertRuleResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string ruleName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Delete;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourcegroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/microsoft.insights/alertrules/", false);
+ uri.AppendPath(ruleName, true);
+ uri.AppendQuery("api-version", "2016-03-01", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Deletes a classic metric alert rule.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The cancellation token to use.
+ /// or is null.
+ public async Task DeleteAsync(string resourceGroupName, string ruleName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (ruleName == null)
+ {
+ throw new ArgumentNullException(nameof(ruleName));
+ }
+
+ using var message = CreateDeleteRequest(resourceGroupName, ruleName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 204:
+ return message.Response;
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Deletes a classic metric alert rule.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The cancellation token to use.
+ /// or is null.
+ public Response Delete(string resourceGroupName, string ruleName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (ruleName == null)
+ {
+ throw new ArgumentNullException(nameof(ruleName));
+ }
+
+ using var message = CreateDeleteRequest(resourceGroupName, ruleName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 204:
+ return message.Response;
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateGetRequest(string resourceGroupName, string ruleName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourcegroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/microsoft.insights/alertrules/", false);
+ uri.AppendPath(ruleName, true);
+ uri.AppendQuery("api-version", "2016-03-01", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Gets a classic metric alert rule.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The cancellation token to use.
+ /// or is null.
+ public async Task> GetAsync(string resourceGroupName, string ruleName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (ruleName == null)
+ {
+ throw new ArgumentNullException(nameof(ruleName));
+ }
+
+ using var message = CreateGetRequest(resourceGroupName, ruleName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ AlertRuleResource value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = AlertRuleResource.DeserializeAlertRuleResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Gets a classic metric alert rule.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The cancellation token to use.
+ /// or is null.
+ public Response Get(string resourceGroupName, string ruleName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (ruleName == null)
+ {
+ throw new ArgumentNullException(nameof(ruleName));
+ }
+
+ using var message = CreateGetRequest(resourceGroupName, ruleName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ AlertRuleResource value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = AlertRuleResource.DeserializeAlertRuleResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string ruleName, AlertRuleResourcePatch alertRulesResource)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Patch;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourcegroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/microsoft.insights/alertrules/", false);
+ uri.AppendPath(ruleName, true);
+ uri.AppendQuery("api-version", "2016-03-01", true);
+ request.Uri = uri;
+ request.Headers.Add("Content-Type", "application/json");
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(alertRulesResource);
+ request.Content = content;
+ return message;
+ }
+
+ /// Updates an existing classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public async Task> UpdateAsync(string resourceGroupName, string ruleName, AlertRuleResourcePatch alertRulesResource, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (ruleName == null)
+ {
+ throw new ArgumentNullException(nameof(ruleName));
+ }
+ if (alertRulesResource == null)
+ {
+ throw new ArgumentNullException(nameof(alertRulesResource));
+ }
+
+ using var message = CreateUpdateRequest(resourceGroupName, ruleName, alertRulesResource);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 201:
+ {
+ AlertRuleResource value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = AlertRuleResource.DeserializeAlertRuleResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Updates an existing classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public Response Update(string resourceGroupName, string ruleName, AlertRuleResourcePatch alertRulesResource, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (ruleName == null)
+ {
+ throw new ArgumentNullException(nameof(ruleName));
+ }
+ if (alertRulesResource == null)
+ {
+ throw new ArgumentNullException(nameof(alertRulesResource));
+ }
+
+ using var message = CreateUpdateRequest(resourceGroupName, ruleName, alertRulesResource);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 201:
+ {
+ AlertRuleResource value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = AlertRuleResource.DeserializeAlertRuleResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourcegroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/microsoft.insights/alertrules", false);
+ uri.AppendQuery("api-version", "2016-03-01", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// List the classic metric alert rules within a resource group.
+ /// The name of the resource group.
+ /// The cancellation token to use.
+ /// is null.
+ public async Task> ListByResourceGroupAsync(string resourceGroupName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+
+ using var message = CreateListByResourceGroupRequest(resourceGroupName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ AlertRuleResourceCollection value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = AlertRuleResourceCollection.DeserializeAlertRuleResourceCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// List the classic metric alert rules within a resource group.
+ /// The name of the resource group.
+ /// The cancellation token to use.
+ /// is null.
+ public Response ListByResourceGroup(string resourceGroupName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+
+ using var message = CreateListByResourceGroupRequest(resourceGroupName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ AlertRuleResourceCollection value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = AlertRuleResourceCollection.DeserializeAlertRuleResourceCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateListBySubscriptionRequest()
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/providers/microsoft.insights/alertrules", false);
+ uri.AppendQuery("api-version", "2016-03-01", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// List the classic metric alert rules within a subscription.
+ /// The cancellation token to use.
+ public async Task> ListBySubscriptionAsync(CancellationToken cancellationToken = default)
+ {
+ using var message = CreateListBySubscriptionRequest();
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ AlertRuleResourceCollection value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = AlertRuleResourceCollection.DeserializeAlertRuleResourceCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// List the classic metric alert rules within a subscription.
+ /// The cancellation token to use.
+ public Response ListBySubscription(CancellationToken cancellationToken = default)
+ {
+ using var message = CreateListBySubscriptionRequest();
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ AlertRuleResourceCollection value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = AlertRuleResourceCollection.DeserializeAlertRuleResourceCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/AutoscaleSettingsOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/AutoscaleSettingsOperations.cs
new file mode 100644
index 000000000000..93f2fc8c8abc
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/AutoscaleSettingsOperations.cs
@@ -0,0 +1,358 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ /// The AutoscaleSettings service client.
+ public partial class AutoscaleSettingsOperations
+ {
+ private readonly ClientDiagnostics _clientDiagnostics;
+ private readonly HttpPipeline _pipeline;
+ internal AutoscaleSettingsRestOperations RestClient { get; }
+ /// Initializes a new instance of AutoscaleSettingsOperations for mocking.
+ protected AutoscaleSettingsOperations()
+ {
+ }
+ /// Initializes a new instance of AutoscaleSettingsOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The Azure subscription Id.
+ /// server parameter.
+ internal AutoscaleSettingsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ RestClient = new AutoscaleSettingsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ /// Creates or updates an autoscale setting.
+ /// The name of the resource group.
+ /// The autoscale setting name.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ public virtual async Task> CreateOrUpdateAsync(string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResource parameters, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AutoscaleSettingsOperations.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ return await RestClient.CreateOrUpdateAsync(resourceGroupName, autoscaleSettingName, parameters, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Creates or updates an autoscale setting.
+ /// The name of the resource group.
+ /// The autoscale setting name.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ public virtual Response CreateOrUpdate(string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResource parameters, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AutoscaleSettingsOperations.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ return RestClient.CreateOrUpdate(resourceGroupName, autoscaleSettingName, parameters, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Deletes and autoscale setting.
+ /// The name of the resource group.
+ /// The autoscale setting name.
+ /// The cancellation token to use.
+ public virtual async Task DeleteAsync(string resourceGroupName, string autoscaleSettingName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AutoscaleSettingsOperations.Delete");
+ scope.Start();
+ try
+ {
+ return await RestClient.DeleteAsync(resourceGroupName, autoscaleSettingName, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Deletes and autoscale setting.
+ /// The name of the resource group.
+ /// The autoscale setting name.
+ /// The cancellation token to use.
+ public virtual Response Delete(string resourceGroupName, string autoscaleSettingName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AutoscaleSettingsOperations.Delete");
+ scope.Start();
+ try
+ {
+ return RestClient.Delete(resourceGroupName, autoscaleSettingName, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets an autoscale setting.
+ /// The name of the resource group.
+ /// The autoscale setting name.
+ /// The cancellation token to use.
+ public virtual async Task> GetAsync(string resourceGroupName, string autoscaleSettingName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AutoscaleSettingsOperations.Get");
+ scope.Start();
+ try
+ {
+ return await RestClient.GetAsync(resourceGroupName, autoscaleSettingName, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets an autoscale setting.
+ /// The name of the resource group.
+ /// The autoscale setting name.
+ /// The cancellation token to use.
+ public virtual Response Get(string resourceGroupName, string autoscaleSettingName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AutoscaleSettingsOperations.Get");
+ scope.Start();
+ try
+ {
+ return RestClient.Get(resourceGroupName, autoscaleSettingName, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method.
+ /// The name of the resource group.
+ /// The autoscale setting name.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ public virtual async Task> UpdateAsync(string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AutoscaleSettingsOperations.Update");
+ scope.Start();
+ try
+ {
+ return await RestClient.UpdateAsync(resourceGroupName, autoscaleSettingName, autoscaleSettingResource, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method.
+ /// The name of the resource group.
+ /// The autoscale setting name.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ public virtual Response Update(string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AutoscaleSettingsOperations.Update");
+ scope.Start();
+ try
+ {
+ return RestClient.Update(resourceGroupName, autoscaleSettingName, autoscaleSettingResource, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Lists the autoscale settings for a resource group.
+ /// The name of the resource group.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual AsyncPageable ListByResourceGroupAsync(string resourceGroupName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+
+ async Task> FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AutoscaleSettingsOperations.ListByResourceGroup");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ async Task> NextPageFunc(string nextLink, int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AutoscaleSettingsOperations.ListByResourceGroup");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
+ }
+
+ /// Lists the autoscale settings for a resource group.
+ /// The name of the resource group.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual Pageable ListByResourceGroup(string resourceGroupName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+
+ Page FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AutoscaleSettingsOperations.ListByResourceGroup");
+ scope.Start();
+ try
+ {
+ var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ Page NextPageFunc(string nextLink, int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AutoscaleSettingsOperations.ListByResourceGroup");
+ scope.Start();
+ try
+ {
+ var response = RestClient.ListByResourceGroupNextPage(nextLink, resourceGroupName, cancellationToken);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
+ }
+
+ /// Lists the autoscale settings for a subscription.
+ /// The cancellation token to use.
+ public virtual AsyncPageable ListBySubscriptionAsync(CancellationToken cancellationToken = default)
+ {
+ async Task> FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AutoscaleSettingsOperations.ListBySubscription");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListBySubscriptionAsync(cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ async Task> NextPageFunc(string nextLink, int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AutoscaleSettingsOperations.ListBySubscription");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListBySubscriptionNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
+ }
+
+ /// Lists the autoscale settings for a subscription.
+ /// The cancellation token to use.
+ public virtual Pageable ListBySubscription(CancellationToken cancellationToken = default)
+ {
+ Page FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AutoscaleSettingsOperations.ListBySubscription");
+ scope.Start();
+ try
+ {
+ var response = RestClient.ListBySubscription(cancellationToken);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ Page NextPageFunc(string nextLink, int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("AutoscaleSettingsOperations.ListBySubscription");
+ scope.Start();
+ try
+ {
+ var response = RestClient.ListBySubscriptionNextPage(nextLink, cancellationToken);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/AutoscaleSettingsRestOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/AutoscaleSettingsRestOperations.cs
new file mode 100644
index 000000000000..40f4c2ae1b0f
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/AutoscaleSettingsRestOperations.cs
@@ -0,0 +1,664 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ internal partial class AutoscaleSettingsRestOperations
+ {
+ private string subscriptionId;
+ private Uri endpoint;
+ private ClientDiagnostics _clientDiagnostics;
+ private HttpPipeline _pipeline;
+
+ /// Initializes a new instance of AutoscaleSettingsRestOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The Azure subscription Id.
+ /// server parameter.
+ /// is null.
+ public AutoscaleSettingsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ if (subscriptionId == null)
+ {
+ throw new ArgumentNullException(nameof(subscriptionId));
+ }
+ endpoint ??= new Uri("https://management.azure.com");
+
+ this.subscriptionId = subscriptionId;
+ this.endpoint = endpoint;
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourcegroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/microsoft.insights/autoscalesettings", false);
+ uri.AppendQuery("api-version", "2015-04-01", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Lists the autoscale settings for a resource group.
+ /// The name of the resource group.
+ /// The cancellation token to use.
+ /// is null.
+ public async Task> ListByResourceGroupAsync(string resourceGroupName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+
+ using var message = CreateListByResourceGroupRequest(resourceGroupName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ AutoscaleSettingResourceCollection value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = AutoscaleSettingResourceCollection.DeserializeAutoscaleSettingResourceCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Lists the autoscale settings for a resource group.
+ /// The name of the resource group.
+ /// The cancellation token to use.
+ /// is null.
+ public Response ListByResourceGroup(string resourceGroupName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+
+ using var message = CreateListByResourceGroupRequest(resourceGroupName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ AutoscaleSettingResourceCollection value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = AutoscaleSettingResourceCollection.DeserializeAutoscaleSettingResourceCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResource parameters)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Put;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourcegroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/microsoft.insights/autoscalesettings/", false);
+ uri.AppendPath(autoscaleSettingName, true);
+ uri.AppendQuery("api-version", "2015-04-01", true);
+ request.Uri = uri;
+ request.Headers.Add("Content-Type", "application/json");
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(parameters);
+ request.Content = content;
+ return message;
+ }
+
+ /// Creates or updates an autoscale setting.
+ /// The name of the resource group.
+ /// The autoscale setting name.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public async Task> CreateOrUpdateAsync(string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResource parameters, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (autoscaleSettingName == null)
+ {
+ throw new ArgumentNullException(nameof(autoscaleSettingName));
+ }
+ if (parameters == null)
+ {
+ throw new ArgumentNullException(nameof(parameters));
+ }
+
+ using var message = CreateCreateOrUpdateRequest(resourceGroupName, autoscaleSettingName, parameters);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 201:
+ {
+ AutoscaleSettingResource value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = AutoscaleSettingResource.DeserializeAutoscaleSettingResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Creates or updates an autoscale setting.
+ /// The name of the resource group.
+ /// The autoscale setting name.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public Response CreateOrUpdate(string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResource parameters, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (autoscaleSettingName == null)
+ {
+ throw new ArgumentNullException(nameof(autoscaleSettingName));
+ }
+ if (parameters == null)
+ {
+ throw new ArgumentNullException(nameof(parameters));
+ }
+
+ using var message = CreateCreateOrUpdateRequest(resourceGroupName, autoscaleSettingName, parameters);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 201:
+ {
+ AutoscaleSettingResource value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = AutoscaleSettingResource.DeserializeAutoscaleSettingResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string autoscaleSettingName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Delete;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourcegroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/microsoft.insights/autoscalesettings/", false);
+ uri.AppendPath(autoscaleSettingName, true);
+ uri.AppendQuery("api-version", "2015-04-01", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Deletes and autoscale setting.
+ /// The name of the resource group.
+ /// The autoscale setting name.
+ /// The cancellation token to use.
+ /// or is null.
+ public async Task DeleteAsync(string resourceGroupName, string autoscaleSettingName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (autoscaleSettingName == null)
+ {
+ throw new ArgumentNullException(nameof(autoscaleSettingName));
+ }
+
+ using var message = CreateDeleteRequest(resourceGroupName, autoscaleSettingName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 204:
+ return message.Response;
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Deletes and autoscale setting.
+ /// The name of the resource group.
+ /// The autoscale setting name.
+ /// The cancellation token to use.
+ /// or is null.
+ public Response Delete(string resourceGroupName, string autoscaleSettingName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (autoscaleSettingName == null)
+ {
+ throw new ArgumentNullException(nameof(autoscaleSettingName));
+ }
+
+ using var message = CreateDeleteRequest(resourceGroupName, autoscaleSettingName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 204:
+ return message.Response;
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateGetRequest(string resourceGroupName, string autoscaleSettingName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourcegroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/microsoft.insights/autoscalesettings/", false);
+ uri.AppendPath(autoscaleSettingName, true);
+ uri.AppendQuery("api-version", "2015-04-01", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Gets an autoscale setting.
+ /// The name of the resource group.
+ /// The autoscale setting name.
+ /// The cancellation token to use.
+ /// or is null.
+ public async Task> GetAsync(string resourceGroupName, string autoscaleSettingName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (autoscaleSettingName == null)
+ {
+ throw new ArgumentNullException(nameof(autoscaleSettingName));
+ }
+
+ using var message = CreateGetRequest(resourceGroupName, autoscaleSettingName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ AutoscaleSettingResource value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = AutoscaleSettingResource.DeserializeAutoscaleSettingResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Gets an autoscale setting.
+ /// The name of the resource group.
+ /// The autoscale setting name.
+ /// The cancellation token to use.
+ /// or is null.
+ public Response Get(string resourceGroupName, string autoscaleSettingName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (autoscaleSettingName == null)
+ {
+ throw new ArgumentNullException(nameof(autoscaleSettingName));
+ }
+
+ using var message = CreateGetRequest(resourceGroupName, autoscaleSettingName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ AutoscaleSettingResource value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = AutoscaleSettingResource.DeserializeAutoscaleSettingResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Patch;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourcegroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/microsoft.insights/autoscalesettings/", false);
+ uri.AppendPath(autoscaleSettingName, true);
+ uri.AppendQuery("api-version", "2015-04-01", true);
+ request.Uri = uri;
+ request.Headers.Add("Content-Type", "application/json");
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(autoscaleSettingResource);
+ request.Content = content;
+ return message;
+ }
+
+ /// Updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method.
+ /// The name of the resource group.
+ /// The autoscale setting name.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public async Task> UpdateAsync(string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (autoscaleSettingName == null)
+ {
+ throw new ArgumentNullException(nameof(autoscaleSettingName));
+ }
+ if (autoscaleSettingResource == null)
+ {
+ throw new ArgumentNullException(nameof(autoscaleSettingResource));
+ }
+
+ using var message = CreateUpdateRequest(resourceGroupName, autoscaleSettingName, autoscaleSettingResource);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ AutoscaleSettingResource value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = AutoscaleSettingResource.DeserializeAutoscaleSettingResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method.
+ /// The name of the resource group.
+ /// The autoscale setting name.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public Response Update(string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (autoscaleSettingName == null)
+ {
+ throw new ArgumentNullException(nameof(autoscaleSettingName));
+ }
+ if (autoscaleSettingResource == null)
+ {
+ throw new ArgumentNullException(nameof(autoscaleSettingResource));
+ }
+
+ using var message = CreateUpdateRequest(resourceGroupName, autoscaleSettingName, autoscaleSettingResource);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ AutoscaleSettingResource value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = AutoscaleSettingResource.DeserializeAutoscaleSettingResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateListBySubscriptionRequest()
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/providers/microsoft.insights/autoscalesettings", false);
+ uri.AppendQuery("api-version", "2015-04-01", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Lists the autoscale settings for a subscription.
+ /// The cancellation token to use.
+ public async Task> ListBySubscriptionAsync(CancellationToken cancellationToken = default)
+ {
+ using var message = CreateListBySubscriptionRequest();
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ AutoscaleSettingResourceCollection value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = AutoscaleSettingResourceCollection.DeserializeAutoscaleSettingResourceCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Lists the autoscale settings for a subscription.
+ /// The cancellation token to use.
+ public Response ListBySubscription(CancellationToken cancellationToken = default)
+ {
+ using var message = CreateListBySubscriptionRequest();
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ AutoscaleSettingResourceCollection value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = AutoscaleSettingResourceCollection.DeserializeAutoscaleSettingResourceCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendRawNextLink(nextLink, false);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Lists the autoscale settings for a resource group.
+ /// The URL to the next page of results.
+ /// The name of the resource group.
+ /// The cancellation token to use.
+ /// or is null.
+ public async Task> ListByResourceGroupNextPageAsync(string nextLink, string resourceGroupName, CancellationToken cancellationToken = default)
+ {
+ if (nextLink == null)
+ {
+ throw new ArgumentNullException(nameof(nextLink));
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+
+ using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ AutoscaleSettingResourceCollection value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = AutoscaleSettingResourceCollection.DeserializeAutoscaleSettingResourceCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Lists the autoscale settings for a resource group.
+ /// The URL to the next page of results.
+ /// The name of the resource group.
+ /// The cancellation token to use.
+ /// or is null.
+ public Response ListByResourceGroupNextPage(string nextLink, string resourceGroupName, CancellationToken cancellationToken = default)
+ {
+ if (nextLink == null)
+ {
+ throw new ArgumentNullException(nameof(nextLink));
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+
+ using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ AutoscaleSettingResourceCollection value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = AutoscaleSettingResourceCollection.DeserializeAutoscaleSettingResourceCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendRawNextLink(nextLink, false);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Lists the autoscale settings for a subscription.
+ /// The URL to the next page of results.
+ /// The cancellation token to use.
+ /// is null.
+ public async Task> ListBySubscriptionNextPageAsync(string nextLink, CancellationToken cancellationToken = default)
+ {
+ if (nextLink == null)
+ {
+ throw new ArgumentNullException(nameof(nextLink));
+ }
+
+ using var message = CreateListBySubscriptionNextPageRequest(nextLink);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ AutoscaleSettingResourceCollection value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = AutoscaleSettingResourceCollection.DeserializeAutoscaleSettingResourceCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Lists the autoscale settings for a subscription.
+ /// The URL to the next page of results.
+ /// The cancellation token to use.
+ /// is null.
+ public Response ListBySubscriptionNextPage(string nextLink, CancellationToken cancellationToken = default)
+ {
+ if (nextLink == null)
+ {
+ throw new ArgumentNullException(nameof(nextLink));
+ }
+
+ using var message = CreateListBySubscriptionNextPageRequest(nextLink);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ AutoscaleSettingResourceCollection value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = AutoscaleSettingResourceCollection.DeserializeAutoscaleSettingResourceCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/BaselinesOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/BaselinesOperations.cs
new file mode 100644
index 000000000000..80f3630f4184
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/BaselinesOperations.cs
@@ -0,0 +1,113 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ /// The Baselines service client.
+ public partial class BaselinesOperations
+ {
+ private readonly ClientDiagnostics _clientDiagnostics;
+ private readonly HttpPipeline _pipeline;
+ internal BaselinesRestOperations RestClient { get; }
+ /// Initializes a new instance of BaselinesOperations for mocking.
+ protected BaselinesOperations()
+ {
+ }
+ /// Initializes a new instance of BaselinesOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// server parameter.
+ internal BaselinesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null)
+ {
+ RestClient = new BaselinesRestOperations(clientDiagnostics, pipeline, endpoint);
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ /// **Lists the metric baseline values for a resource**.
+ /// The identifier of the resource.
+ /// The names of the metrics (comma separated) to retrieve.
+ /// Metric namespace to query metric definitions for.
+ /// The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'.
+ /// The interval (i.e. timegrain) of the query.
+ /// The list of aggregation types (comma separated) to retrieve.
+ /// The list of sensitivities (comma separated) to retrieve.
+ /// The **$filter** is used to reduce the set of metric data returned.<br>Example:<br>Metric contains metadata A, B and C.<br>- Return all time series of C where A = a1 and B = b1 or b2<br>**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**<br>- Invalid variant:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**<br>This is invalid because the logical or operator cannot separate two different metadata names.<br>- Return all time series where A = a1, B = b1 and C = c1:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**<br>- Return all time series where A = a1<br>**$filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**.
+ /// Allows retrieving only metadata of the baseline. On data request all information is retrieved.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual AsyncPageable ListAsync(string resourceUri, string metricnames = null, string metricnamespace = null, string timespan = null, TimeSpan? interval = null, string aggregation = null, string sensitivities = null, string filter = null, ResultType? resultType = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+
+ async Task> FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("BaselinesOperations.List");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListAsync(resourceUri, metricnames, metricnamespace, timespan, interval, aggregation, sensitivities, filter, resultType, cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null);
+ }
+
+ /// **Lists the metric baseline values for a resource**.
+ /// The identifier of the resource.
+ /// The names of the metrics (comma separated) to retrieve.
+ /// Metric namespace to query metric definitions for.
+ /// The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'.
+ /// The interval (i.e. timegrain) of the query.
+ /// The list of aggregation types (comma separated) to retrieve.
+ /// The list of sensitivities (comma separated) to retrieve.
+ /// The **$filter** is used to reduce the set of metric data returned.<br>Example:<br>Metric contains metadata A, B and C.<br>- Return all time series of C where A = a1 and B = b1 or b2<br>**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**<br>- Invalid variant:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**<br>This is invalid because the logical or operator cannot separate two different metadata names.<br>- Return all time series where A = a1, B = b1 and C = c1:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**<br>- Return all time series where A = a1<br>**$filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**.
+ /// Allows retrieving only metadata of the baseline. On data request all information is retrieved.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual Pageable List(string resourceUri, string metricnames = null, string metricnamespace = null, string timespan = null, TimeSpan? interval = null, string aggregation = null, string sensitivities = null, string filter = null, ResultType? resultType = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+
+ Page FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("BaselinesOperations.List");
+ scope.Start();
+ try
+ {
+ var response = RestClient.List(resourceUri, metricnames, metricnamespace, timespan, interval, aggregation, sensitivities, filter, resultType, cancellationToken);
+ return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateEnumerable(FirstPageFunc, null);
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/BaselinesRestOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/BaselinesRestOperations.cs
new file mode 100644
index 000000000000..12999d5beed4
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/BaselinesRestOperations.cs
@@ -0,0 +1,155 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ internal partial class BaselinesRestOperations
+ {
+ private Uri endpoint;
+ private ClientDiagnostics _clientDiagnostics;
+ private HttpPipeline _pipeline;
+
+ /// Initializes a new instance of BaselinesRestOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// server parameter.
+ public BaselinesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null)
+ {
+ endpoint ??= new Uri("https://management.azure.com");
+
+ this.endpoint = endpoint;
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ internal HttpMessage CreateListRequest(string resourceUri, string metricnames, string metricnamespace, string timespan, TimeSpan? interval, string aggregation, string sensitivities, string filter, ResultType? resultType)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/", false);
+ uri.AppendPath(resourceUri, false);
+ uri.AppendPath("/providers/microsoft.insights/metricBaselines", false);
+ if (metricnames != null)
+ {
+ uri.AppendQuery("metricnames", metricnames, true);
+ }
+ if (metricnamespace != null)
+ {
+ uri.AppendQuery("metricnamespace", metricnamespace, true);
+ }
+ if (timespan != null)
+ {
+ uri.AppendQuery("timespan", timespan, true);
+ }
+ if (interval != null)
+ {
+ uri.AppendQuery("interval", interval.Value, "P", true);
+ }
+ if (aggregation != null)
+ {
+ uri.AppendQuery("aggregation", aggregation, true);
+ }
+ if (sensitivities != null)
+ {
+ uri.AppendQuery("sensitivities", sensitivities, true);
+ }
+ if (filter != null)
+ {
+ uri.AppendQuery("$filter", filter, true);
+ }
+ if (resultType != null)
+ {
+ uri.AppendQuery("resultType", resultType.Value.ToSerialString(), true);
+ }
+ uri.AppendQuery("api-version", "2019-03-01", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// **Lists the metric baseline values for a resource**.
+ /// The identifier of the resource.
+ /// The names of the metrics (comma separated) to retrieve.
+ /// Metric namespace to query metric definitions for.
+ /// The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'.
+ /// The interval (i.e. timegrain) of the query.
+ /// The list of aggregation types (comma separated) to retrieve.
+ /// The list of sensitivities (comma separated) to retrieve.
+ /// The **$filter** is used to reduce the set of metric data returned.<br>Example:<br>Metric contains metadata A, B and C.<br>- Return all time series of C where A = a1 and B = b1 or b2<br>**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**<br>- Invalid variant:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**<br>This is invalid because the logical or operator cannot separate two different metadata names.<br>- Return all time series where A = a1, B = b1 and C = c1:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**<br>- Return all time series where A = a1<br>**$filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**.
+ /// Allows retrieving only metadata of the baseline. On data request all information is retrieved.
+ /// The cancellation token to use.
+ /// is null.
+ public async Task> ListAsync(string resourceUri, string metricnames = null, string metricnamespace = null, string timespan = null, TimeSpan? interval = null, string aggregation = null, string sensitivities = null, string filter = null, ResultType? resultType = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+
+ using var message = CreateListRequest(resourceUri, metricnames, metricnamespace, timespan, interval, aggregation, sensitivities, filter, resultType);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ MetricBaselinesResponse value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = MetricBaselinesResponse.DeserializeMetricBaselinesResponse(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// **Lists the metric baseline values for a resource**.
+ /// The identifier of the resource.
+ /// The names of the metrics (comma separated) to retrieve.
+ /// Metric namespace to query metric definitions for.
+ /// The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'.
+ /// The interval (i.e. timegrain) of the query.
+ /// The list of aggregation types (comma separated) to retrieve.
+ /// The list of sensitivities (comma separated) to retrieve.
+ /// The **$filter** is used to reduce the set of metric data returned.<br>Example:<br>Metric contains metadata A, B and C.<br>- Return all time series of C where A = a1 and B = b1 or b2<br>**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**<br>- Invalid variant:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**<br>This is invalid because the logical or operator cannot separate two different metadata names.<br>- Return all time series where A = a1, B = b1 and C = c1:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**<br>- Return all time series where A = a1<br>**$filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**.
+ /// Allows retrieving only metadata of the baseline. On data request all information is retrieved.
+ /// The cancellation token to use.
+ /// is null.
+ public Response List(string resourceUri, string metricnames = null, string metricnamespace = null, string timespan = null, TimeSpan? interval = null, string aggregation = null, string sensitivities = null, string filter = null, ResultType? resultType = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+
+ using var message = CreateListRequest(resourceUri, metricnames, metricnamespace, timespan, interval, aggregation, sensitivities, filter, resultType);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ MetricBaselinesResponse value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = MetricBaselinesResponse.DeserializeMetricBaselinesResponse(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/DiagnosticSettingsCategoryOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/DiagnosticSettingsCategoryOperations.cs
new file mode 100644
index 000000000000..95eb2a800c7e
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/DiagnosticSettingsCategoryOperations.cs
@@ -0,0 +1,112 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ /// The DiagnosticSettingsCategory service client.
+ public partial class DiagnosticSettingsCategoryOperations
+ {
+ private readonly ClientDiagnostics _clientDiagnostics;
+ private readonly HttpPipeline _pipeline;
+ internal DiagnosticSettingsCategoryRestOperations RestClient { get; }
+ /// Initializes a new instance of DiagnosticSettingsCategoryOperations for mocking.
+ protected DiagnosticSettingsCategoryOperations()
+ {
+ }
+ /// Initializes a new instance of DiagnosticSettingsCategoryOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// server parameter.
+ internal DiagnosticSettingsCategoryOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null)
+ {
+ RestClient = new DiagnosticSettingsCategoryRestOperations(clientDiagnostics, pipeline, endpoint);
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ /// Gets the diagnostic settings category for the specified resource.
+ /// The identifier of the resource.
+ /// The name of the diagnostic setting.
+ /// The cancellation token to use.
+ public virtual async Task> GetAsync(string resourceUri, string name, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DiagnosticSettingsCategoryOperations.Get");
+ scope.Start();
+ try
+ {
+ return await RestClient.GetAsync(resourceUri, name, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets the diagnostic settings category for the specified resource.
+ /// The identifier of the resource.
+ /// The name of the diagnostic setting.
+ /// The cancellation token to use.
+ public virtual Response Get(string resourceUri, string name, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DiagnosticSettingsCategoryOperations.Get");
+ scope.Start();
+ try
+ {
+ return RestClient.Get(resourceUri, name, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Lists the diagnostic settings categories for the specified resource.
+ /// The identifier of the resource.
+ /// The cancellation token to use.
+ public virtual async Task> ListAsync(string resourceUri, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DiagnosticSettingsCategoryOperations.List");
+ scope.Start();
+ try
+ {
+ return await RestClient.ListAsync(resourceUri, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Lists the diagnostic settings categories for the specified resource.
+ /// The identifier of the resource.
+ /// The cancellation token to use.
+ public virtual Response List(string resourceUri, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DiagnosticSettingsCategoryOperations.List");
+ scope.Start();
+ try
+ {
+ return RestClient.List(resourceUri, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/DiagnosticSettingsCategoryRestOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/DiagnosticSettingsCategoryRestOperations.cs
new file mode 100644
index 000000000000..1dfa3e62038f
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/DiagnosticSettingsCategoryRestOperations.cs
@@ -0,0 +1,187 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ internal partial class DiagnosticSettingsCategoryRestOperations
+ {
+ private Uri endpoint;
+ private ClientDiagnostics _clientDiagnostics;
+ private HttpPipeline _pipeline;
+
+ /// Initializes a new instance of DiagnosticSettingsCategoryRestOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// server parameter.
+ public DiagnosticSettingsCategoryRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null)
+ {
+ endpoint ??= new Uri("https://management.azure.com");
+
+ this.endpoint = endpoint;
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ internal HttpMessage CreateGetRequest(string resourceUri, string name)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/", false);
+ uri.AppendPath(resourceUri, false);
+ uri.AppendPath("/providers/microsoft.insights/diagnosticSettingsCategories/", false);
+ uri.AppendPath(name, true);
+ uri.AppendQuery("api-version", "2017-05-01-preview", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Gets the diagnostic settings category for the specified resource.
+ /// The identifier of the resource.
+ /// The name of the diagnostic setting.
+ /// The cancellation token to use.
+ /// or is null.
+ public async Task> GetAsync(string resourceUri, string name, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+ if (name == null)
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+
+ using var message = CreateGetRequest(resourceUri, name);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DiagnosticSettingsCategoryResource value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = DiagnosticSettingsCategoryResource.DeserializeDiagnosticSettingsCategoryResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Gets the diagnostic settings category for the specified resource.
+ /// The identifier of the resource.
+ /// The name of the diagnostic setting.
+ /// The cancellation token to use.
+ /// or is null.
+ public Response Get(string resourceUri, string name, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+ if (name == null)
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+
+ using var message = CreateGetRequest(resourceUri, name);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DiagnosticSettingsCategoryResource value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = DiagnosticSettingsCategoryResource.DeserializeDiagnosticSettingsCategoryResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateListRequest(string resourceUri)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/", false);
+ uri.AppendPath(resourceUri, false);
+ uri.AppendPath("/providers/microsoft.insights/diagnosticSettingsCategories", false);
+ uri.AppendQuery("api-version", "2017-05-01-preview", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Lists the diagnostic settings categories for the specified resource.
+ /// The identifier of the resource.
+ /// The cancellation token to use.
+ /// is null.
+ public async Task> ListAsync(string resourceUri, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+
+ using var message = CreateListRequest(resourceUri);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DiagnosticSettingsCategoryResourceCollection value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = DiagnosticSettingsCategoryResourceCollection.DeserializeDiagnosticSettingsCategoryResourceCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Lists the diagnostic settings categories for the specified resource.
+ /// The identifier of the resource.
+ /// The cancellation token to use.
+ /// is null.
+ public Response List(string resourceUri, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+
+ using var message = CreateListRequest(resourceUri);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DiagnosticSettingsCategoryResourceCollection value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = DiagnosticSettingsCategoryResourceCollection.DeserializeDiagnosticSettingsCategoryResourceCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/DiagnosticSettingsOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/DiagnosticSettingsOperations.cs
new file mode 100644
index 000000000000..0eb1ae10f0df
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/DiagnosticSettingsOperations.cs
@@ -0,0 +1,190 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ /// The DiagnosticSettings service client.
+ public partial class DiagnosticSettingsOperations
+ {
+ private readonly ClientDiagnostics _clientDiagnostics;
+ private readonly HttpPipeline _pipeline;
+ internal DiagnosticSettingsRestOperations RestClient { get; }
+ /// Initializes a new instance of DiagnosticSettingsOperations for mocking.
+ protected DiagnosticSettingsOperations()
+ {
+ }
+ /// Initializes a new instance of DiagnosticSettingsOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// server parameter.
+ internal DiagnosticSettingsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null)
+ {
+ RestClient = new DiagnosticSettingsRestOperations(clientDiagnostics, pipeline, endpoint);
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ /// Gets the active diagnostic settings for the specified resource.
+ /// The identifier of the resource.
+ /// The name of the diagnostic setting.
+ /// The cancellation token to use.
+ public virtual async Task> GetAsync(string resourceUri, string name, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DiagnosticSettingsOperations.Get");
+ scope.Start();
+ try
+ {
+ return await RestClient.GetAsync(resourceUri, name, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets the active diagnostic settings for the specified resource.
+ /// The identifier of the resource.
+ /// The name of the diagnostic setting.
+ /// The cancellation token to use.
+ public virtual Response Get(string resourceUri, string name, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DiagnosticSettingsOperations.Get");
+ scope.Start();
+ try
+ {
+ return RestClient.Get(resourceUri, name, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Creates or updates diagnostic settings for the specified resource.
+ /// The identifier of the resource.
+ /// The name of the diagnostic setting.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ public virtual async Task> CreateOrUpdateAsync(string resourceUri, string name, DiagnosticSettingsResource parameters, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DiagnosticSettingsOperations.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ return await RestClient.CreateOrUpdateAsync(resourceUri, name, parameters, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Creates or updates diagnostic settings for the specified resource.
+ /// The identifier of the resource.
+ /// The name of the diagnostic setting.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ public virtual Response CreateOrUpdate(string resourceUri, string name, DiagnosticSettingsResource parameters, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DiagnosticSettingsOperations.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ return RestClient.CreateOrUpdate(resourceUri, name, parameters, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Deletes existing diagnostic settings for the specified resource.
+ /// The identifier of the resource.
+ /// The name of the diagnostic setting.
+ /// The cancellation token to use.
+ public virtual async Task DeleteAsync(string resourceUri, string name, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DiagnosticSettingsOperations.Delete");
+ scope.Start();
+ try
+ {
+ return await RestClient.DeleteAsync(resourceUri, name, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Deletes existing diagnostic settings for the specified resource.
+ /// The identifier of the resource.
+ /// The name of the diagnostic setting.
+ /// The cancellation token to use.
+ public virtual Response Delete(string resourceUri, string name, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DiagnosticSettingsOperations.Delete");
+ scope.Start();
+ try
+ {
+ return RestClient.Delete(resourceUri, name, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets the active diagnostic settings list for the specified resource.
+ /// The identifier of the resource.
+ /// The cancellation token to use.
+ public virtual async Task> ListAsync(string resourceUri, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DiagnosticSettingsOperations.List");
+ scope.Start();
+ try
+ {
+ return await RestClient.ListAsync(resourceUri, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets the active diagnostic settings list for the specified resource.
+ /// The identifier of the resource.
+ /// The cancellation token to use.
+ public virtual Response List(string resourceUri, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DiagnosticSettingsOperations.List");
+ scope.Start();
+ try
+ {
+ return RestClient.List(resourceUri, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/DiagnosticSettingsRestOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/DiagnosticSettingsRestOperations.cs
new file mode 100644
index 000000000000..dfc7563e6d91
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/DiagnosticSettingsRestOperations.cs
@@ -0,0 +1,353 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ internal partial class DiagnosticSettingsRestOperations
+ {
+ private Uri endpoint;
+ private ClientDiagnostics _clientDiagnostics;
+ private HttpPipeline _pipeline;
+
+ /// Initializes a new instance of DiagnosticSettingsRestOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// server parameter.
+ public DiagnosticSettingsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null)
+ {
+ endpoint ??= new Uri("https://management.azure.com");
+
+ this.endpoint = endpoint;
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ internal HttpMessage CreateGetRequest(string resourceUri, string name)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/", false);
+ uri.AppendPath(resourceUri, false);
+ uri.AppendPath("/providers/microsoft.insights/diagnosticSettings/", false);
+ uri.AppendPath(name, true);
+ uri.AppendQuery("api-version", "2017-05-01-preview", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Gets the active diagnostic settings for the specified resource.
+ /// The identifier of the resource.
+ /// The name of the diagnostic setting.
+ /// The cancellation token to use.
+ /// or is null.
+ public async Task> GetAsync(string resourceUri, string name, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+ if (name == null)
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+
+ using var message = CreateGetRequest(resourceUri, name);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DiagnosticSettingsResource value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = DiagnosticSettingsResource.DeserializeDiagnosticSettingsResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Gets the active diagnostic settings for the specified resource.
+ /// The identifier of the resource.
+ /// The name of the diagnostic setting.
+ /// The cancellation token to use.
+ /// or is null.
+ public Response Get(string resourceUri, string name, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+ if (name == null)
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+
+ using var message = CreateGetRequest(resourceUri, name);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DiagnosticSettingsResource value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = DiagnosticSettingsResource.DeserializeDiagnosticSettingsResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateCreateOrUpdateRequest(string resourceUri, string name, DiagnosticSettingsResource parameters)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Put;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/", false);
+ uri.AppendPath(resourceUri, false);
+ uri.AppendPath("/providers/microsoft.insights/diagnosticSettings/", false);
+ uri.AppendPath(name, true);
+ uri.AppendQuery("api-version", "2017-05-01-preview", true);
+ request.Uri = uri;
+ request.Headers.Add("Content-Type", "application/json");
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(parameters);
+ request.Content = content;
+ return message;
+ }
+
+ /// Creates or updates diagnostic settings for the specified resource.
+ /// The identifier of the resource.
+ /// The name of the diagnostic setting.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public async Task> CreateOrUpdateAsync(string resourceUri, string name, DiagnosticSettingsResource parameters, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+ if (name == null)
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+ if (parameters == null)
+ {
+ throw new ArgumentNullException(nameof(parameters));
+ }
+
+ using var message = CreateCreateOrUpdateRequest(resourceUri, name, parameters);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DiagnosticSettingsResource value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = DiagnosticSettingsResource.DeserializeDiagnosticSettingsResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Creates or updates diagnostic settings for the specified resource.
+ /// The identifier of the resource.
+ /// The name of the diagnostic setting.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public Response CreateOrUpdate(string resourceUri, string name, DiagnosticSettingsResource parameters, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+ if (name == null)
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+ if (parameters == null)
+ {
+ throw new ArgumentNullException(nameof(parameters));
+ }
+
+ using var message = CreateCreateOrUpdateRequest(resourceUri, name, parameters);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DiagnosticSettingsResource value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = DiagnosticSettingsResource.DeserializeDiagnosticSettingsResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateDeleteRequest(string resourceUri, string name)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Delete;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/", false);
+ uri.AppendPath(resourceUri, false);
+ uri.AppendPath("/providers/microsoft.insights/diagnosticSettings/", false);
+ uri.AppendPath(name, true);
+ uri.AppendQuery("api-version", "2017-05-01-preview", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Deletes existing diagnostic settings for the specified resource.
+ /// The identifier of the resource.
+ /// The name of the diagnostic setting.
+ /// The cancellation token to use.
+ /// or is null.
+ public async Task DeleteAsync(string resourceUri, string name, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+ if (name == null)
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+
+ using var message = CreateDeleteRequest(resourceUri, name);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 204:
+ return message.Response;
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Deletes existing diagnostic settings for the specified resource.
+ /// The identifier of the resource.
+ /// The name of the diagnostic setting.
+ /// The cancellation token to use.
+ /// or is null.
+ public Response Delete(string resourceUri, string name, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+ if (name == null)
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+
+ using var message = CreateDeleteRequest(resourceUri, name);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 204:
+ return message.Response;
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateListRequest(string resourceUri)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/", false);
+ uri.AppendPath(resourceUri, false);
+ uri.AppendPath("/providers/microsoft.insights/diagnosticSettings", false);
+ uri.AppendQuery("api-version", "2017-05-01-preview", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Gets the active diagnostic settings list for the specified resource.
+ /// The identifier of the resource.
+ /// The cancellation token to use.
+ /// is null.
+ public async Task> ListAsync(string resourceUri, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+
+ using var message = CreateListRequest(resourceUri);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DiagnosticSettingsResourceCollection value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = DiagnosticSettingsResourceCollection.DeserializeDiagnosticSettingsResourceCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Gets the active diagnostic settings list for the specified resource.
+ /// The identifier of the resource.
+ /// The cancellation token to use.
+ /// is null.
+ public Response List(string resourceUri, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+
+ using var message = CreateListRequest(resourceUri);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DiagnosticSettingsResourceCollection value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = DiagnosticSettingsResourceCollection.DeserializeDiagnosticSettingsResourceCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/EventCategoriesOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/EventCategoriesOperations.cs
new file mode 100644
index 000000000000..854b87b1dee2
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/EventCategoriesOperations.cs
@@ -0,0 +1,83 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ /// The EventCategories service client.
+ public partial class EventCategoriesOperations
+ {
+ private readonly ClientDiagnostics _clientDiagnostics;
+ private readonly HttpPipeline _pipeline;
+ internal EventCategoriesRestOperations RestClient { get; }
+ /// Initializes a new instance of EventCategoriesOperations for mocking.
+ protected EventCategoriesOperations()
+ {
+ }
+ /// Initializes a new instance of EventCategoriesOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// server parameter.
+ internal EventCategoriesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null)
+ {
+ RestClient = new EventCategoriesRestOperations(clientDiagnostics, pipeline, endpoint);
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ /// Get the list of available event categories supported in the Activity Logs Service.<br>The current list includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy.
+ /// The cancellation token to use.
+ public virtual AsyncPageable ListAsync(CancellationToken cancellationToken = default)
+ {
+ async Task> FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("EventCategoriesOperations.List");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null);
+ }
+
+ /// Get the list of available event categories supported in the Activity Logs Service.<br>The current list includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy.
+ /// The cancellation token to use.
+ public virtual Pageable List(CancellationToken cancellationToken = default)
+ {
+ Page FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("EventCategoriesOperations.List");
+ scope.Start();
+ try
+ {
+ var response = RestClient.List(cancellationToken);
+ return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateEnumerable(FirstPageFunc, null);
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/EventCategoriesRestOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/EventCategoriesRestOperations.cs
new file mode 100644
index 000000000000..e42c74543871
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/EventCategoriesRestOperations.cs
@@ -0,0 +1,91 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ internal partial class EventCategoriesRestOperations
+ {
+ private Uri endpoint;
+ private ClientDiagnostics _clientDiagnostics;
+ private HttpPipeline _pipeline;
+
+ /// Initializes a new instance of EventCategoriesRestOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// server parameter.
+ public EventCategoriesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null)
+ {
+ endpoint ??= new Uri("https://management.azure.com");
+
+ this.endpoint = endpoint;
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ internal HttpMessage CreateListRequest()
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/providers/microsoft.insights/eventcategories", false);
+ uri.AppendQuery("api-version", "2015-04-01", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Get the list of available event categories supported in the Activity Logs Service.<br>The current list includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy.
+ /// The cancellation token to use.
+ public async Task> ListAsync(CancellationToken cancellationToken = default)
+ {
+ using var message = CreateListRequest();
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ EventCategoryCollection value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = EventCategoryCollection.DeserializeEventCategoryCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Get the list of available event categories supported in the Activity Logs Service.<br>The current list includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy.
+ /// The cancellation token to use.
+ public Response List(CancellationToken cancellationToken = default)
+ {
+ using var message = CreateListRequest();
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ EventCategoryCollection value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = EventCategoryCollection.DeserializeEventCategoryCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/InsightsManagementClient.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/InsightsManagementClient.cs
new file mode 100644
index 000000000000..2f580feeef47
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/InsightsManagementClient.cs
@@ -0,0 +1,119 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights;
+
+namespace Azure.ResourceManager.Insights
+{
+ /// Insights service management client.
+ public class InsightsManagementClient
+ {
+ private readonly ClientDiagnostics _clientDiagnostics;
+ private readonly HttpPipeline _pipeline;
+ private readonly string _subscriptionId;
+ private readonly Uri _endpoint;
+
+ /// Initializes a new instance of InsightsManagementClient for mocking.
+ protected InsightsManagementClient()
+ {
+ }
+
+ /// Initializes a new instance of InsightsManagementClient.
+ /// The Azure subscription Id.
+ /// The OAuth token for making client requests.
+ /// The options for configuring the client.
+ public InsightsManagementClient(string subscriptionId, TokenCredential tokenCredential, InsightsManagementClientOptions options = null) : this(subscriptionId, null, tokenCredential, options)
+ {
+ }
+ /// Initializes a new instance of InsightsManagementClient.
+ /// The Azure subscription Id.
+ /// server parameter.
+ /// The OAuth token for making client requests.
+ /// The options for configuring the client.
+ /// is null.
+ public InsightsManagementClient(string subscriptionId, Uri endpoint, TokenCredential tokenCredential, InsightsManagementClientOptions options = null)
+ {
+ if (subscriptionId == null)
+ {
+ throw new ArgumentNullException(nameof(subscriptionId));
+ }
+ endpoint ??= new Uri("https://management.azure.com");
+
+ options ??= new InsightsManagementClientOptions();
+ _clientDiagnostics = new ClientDiagnostics(options);
+ _pipeline = ManagementPipelineBuilder.Build(tokenCredential, endpoint, options);
+ _subscriptionId = subscriptionId;
+ _endpoint = endpoint;
+ }
+
+ /// Returns an instance of AutoscaleSettingsOperations.
+ public virtual AutoscaleSettingsOperations AutoscaleSettings => new AutoscaleSettingsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint);
+
+ /// Returns an instance of Operations.
+ public virtual Operations Operations => new Operations(_clientDiagnostics, _pipeline, _endpoint);
+
+ /// Returns an instance of AlertRuleIncidentsOperations.
+ public virtual AlertRuleIncidentsOperations AlertRuleIncidents => new AlertRuleIncidentsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint);
+
+ /// Returns an instance of AlertRulesOperations.
+ public virtual AlertRulesOperations AlertRules => new AlertRulesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint);
+
+ /// Returns an instance of LogProfilesOperations.
+ public virtual LogProfilesOperations LogProfiles => new LogProfilesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint);
+
+ /// Returns an instance of DiagnosticSettingsOperations.
+ public virtual DiagnosticSettingsOperations DiagnosticSettings => new DiagnosticSettingsOperations(_clientDiagnostics, _pipeline, _endpoint);
+
+ /// Returns an instance of DiagnosticSettingsCategoryOperations.
+ public virtual DiagnosticSettingsCategoryOperations DiagnosticSettingsCategory => new DiagnosticSettingsCategoryOperations(_clientDiagnostics, _pipeline, _endpoint);
+
+ /// Returns an instance of ActionGroupsOperations.
+ public virtual ActionGroupsOperations ActionGroups => new ActionGroupsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint);
+
+ /// Returns an instance of ActivityLogAlertsOperations.
+ public virtual ActivityLogAlertsOperations ActivityLogAlerts => new ActivityLogAlertsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint);
+
+ /// Returns an instance of ActivityLogsOperations.
+ public virtual ActivityLogsOperations ActivityLogs => new ActivityLogsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint);
+
+ /// Returns an instance of EventCategoriesOperations.
+ public virtual EventCategoriesOperations EventCategories => new EventCategoriesOperations(_clientDiagnostics, _pipeline, _endpoint);
+
+ /// Returns an instance of TenantActivityLogsOperations.
+ public virtual TenantActivityLogsOperations TenantActivityLogs => new TenantActivityLogsOperations(_clientDiagnostics, _pipeline, _endpoint);
+
+ /// Returns an instance of MetricDefinitionsOperations.
+ public virtual MetricDefinitionsOperations MetricDefinitions => new MetricDefinitionsOperations(_clientDiagnostics, _pipeline, _endpoint);
+
+ /// Returns an instance of MetricsOperations.
+ public virtual MetricsOperations Metrics => new MetricsOperations(_clientDiagnostics, _pipeline, _endpoint);
+
+ /// Returns an instance of MetricBaselineOperations.
+ public virtual MetricBaselineOperations MetricBaseline => new MetricBaselineOperations(_clientDiagnostics, _pipeline, _endpoint);
+
+ /// Returns an instance of BaselinesOperations.
+ public virtual BaselinesOperations Baselines => new BaselinesOperations(_clientDiagnostics, _pipeline, _endpoint);
+
+ /// Returns an instance of MetricAlertsOperations.
+ public virtual MetricAlertsOperations MetricAlerts => new MetricAlertsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint);
+
+ /// Returns an instance of MetricAlertsStatusOperations.
+ public virtual MetricAlertsStatusOperations MetricAlertsStatus => new MetricAlertsStatusOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint);
+
+ /// Returns an instance of ScheduledQueryRulesOperations.
+ public virtual ScheduledQueryRulesOperations ScheduledQueryRules => new ScheduledQueryRulesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint);
+
+ /// Returns an instance of MetricNamespacesOperations.
+ public virtual MetricNamespacesOperations MetricNamespaces => new MetricNamespacesOperations(_clientDiagnostics, _pipeline, _endpoint);
+
+ /// Returns an instance of VMInsightsOperations.
+ public virtual VMInsightsOperations VMInsights => new VMInsightsOperations(_clientDiagnostics, _pipeline, _endpoint);
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/InsightsManagementClientOptions.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/InsightsManagementClientOptions.cs
new file mode 100644
index 000000000000..e48f6dc32589
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/InsightsManagementClientOptions.cs
@@ -0,0 +1,16 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using Azure.Core;
+
+namespace Azure.ResourceManager.Insights
+{
+ /// Client options for Insights.
+ public class InsightsManagementClientOptions : ClientOptions
+ {
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/LogProfilesOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/LogProfilesOperations.cs
new file mode 100644
index 000000000000..cf9468efb5b6
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/LogProfilesOperations.cs
@@ -0,0 +1,232 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ /// The LogProfiles service client.
+ public partial class LogProfilesOperations
+ {
+ private readonly ClientDiagnostics _clientDiagnostics;
+ private readonly HttpPipeline _pipeline;
+ internal LogProfilesRestOperations RestClient { get; }
+ /// Initializes a new instance of LogProfilesOperations for mocking.
+ protected LogProfilesOperations()
+ {
+ }
+ /// Initializes a new instance of LogProfilesOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The Azure subscription Id.
+ /// server parameter.
+ internal LogProfilesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ RestClient = new LogProfilesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ /// Deletes the log profile.
+ /// The name of the log profile.
+ /// The cancellation token to use.
+ public virtual async Task DeleteAsync(string logProfileName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("LogProfilesOperations.Delete");
+ scope.Start();
+ try
+ {
+ return await RestClient.DeleteAsync(logProfileName, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Deletes the log profile.
+ /// The name of the log profile.
+ /// The cancellation token to use.
+ public virtual Response Delete(string logProfileName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("LogProfilesOperations.Delete");
+ scope.Start();
+ try
+ {
+ return RestClient.Delete(logProfileName, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets the log profile.
+ /// The name of the log profile.
+ /// The cancellation token to use.
+ public virtual async Task> GetAsync(string logProfileName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("LogProfilesOperations.Get");
+ scope.Start();
+ try
+ {
+ return await RestClient.GetAsync(logProfileName, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets the log profile.
+ /// The name of the log profile.
+ /// The cancellation token to use.
+ public virtual Response Get(string logProfileName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("LogProfilesOperations.Get");
+ scope.Start();
+ try
+ {
+ return RestClient.Get(logProfileName, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Create or update a log profile in Azure Monitoring REST API.
+ /// The name of the log profile.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ public virtual async Task> CreateOrUpdateAsync(string logProfileName, LogProfileResource parameters, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("LogProfilesOperations.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ return await RestClient.CreateOrUpdateAsync(logProfileName, parameters, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Create or update a log profile in Azure Monitoring REST API.
+ /// The name of the log profile.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ public virtual Response CreateOrUpdate(string logProfileName, LogProfileResource parameters, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("LogProfilesOperations.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ return RestClient.CreateOrUpdate(logProfileName, parameters, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method.
+ /// The name of the log profile.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ public virtual async Task> UpdateAsync(string logProfileName, LogProfileResourcePatch logProfilesResource, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("LogProfilesOperations.Update");
+ scope.Start();
+ try
+ {
+ return await RestClient.UpdateAsync(logProfileName, logProfilesResource, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method.
+ /// The name of the log profile.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ public virtual Response Update(string logProfileName, LogProfileResourcePatch logProfilesResource, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("LogProfilesOperations.Update");
+ scope.Start();
+ try
+ {
+ return RestClient.Update(logProfileName, logProfilesResource, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// List the log profiles.
+ /// The cancellation token to use.
+ public virtual AsyncPageable ListAsync(CancellationToken cancellationToken = default)
+ {
+ async Task> FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("LogProfilesOperations.List");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null);
+ }
+
+ /// List the log profiles.
+ /// The cancellation token to use.
+ public virtual Pageable List(CancellationToken cancellationToken = default)
+ {
+ Page FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("LogProfilesOperations.List");
+ scope.Start();
+ try
+ {
+ var response = RestClient.List(cancellationToken);
+ return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateEnumerable(FirstPageFunc, null);
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/LogProfilesRestOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/LogProfilesRestOperations.cs
new file mode 100644
index 000000000000..6ae1dc83d17f
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/LogProfilesRestOperations.cs
@@ -0,0 +1,399 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ internal partial class LogProfilesRestOperations
+ {
+ private string subscriptionId;
+ private Uri endpoint;
+ private ClientDiagnostics _clientDiagnostics;
+ private HttpPipeline _pipeline;
+
+ /// Initializes a new instance of LogProfilesRestOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The Azure subscription Id.
+ /// server parameter.
+ /// is null.
+ public LogProfilesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ if (subscriptionId == null)
+ {
+ throw new ArgumentNullException(nameof(subscriptionId));
+ }
+ endpoint ??= new Uri("https://management.azure.com");
+
+ this.subscriptionId = subscriptionId;
+ this.endpoint = endpoint;
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ internal HttpMessage CreateDeleteRequest(string logProfileName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Delete;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/providers/microsoft.insights/logprofiles/", false);
+ uri.AppendPath(logProfileName, true);
+ uri.AppendQuery("api-version", "2016-03-01", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Deletes the log profile.
+ /// The name of the log profile.
+ /// The cancellation token to use.
+ /// is null.
+ public async Task DeleteAsync(string logProfileName, CancellationToken cancellationToken = default)
+ {
+ if (logProfileName == null)
+ {
+ throw new ArgumentNullException(nameof(logProfileName));
+ }
+
+ using var message = CreateDeleteRequest(logProfileName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ return message.Response;
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Deletes the log profile.
+ /// The name of the log profile.
+ /// The cancellation token to use.
+ /// is null.
+ public Response Delete(string logProfileName, CancellationToken cancellationToken = default)
+ {
+ if (logProfileName == null)
+ {
+ throw new ArgumentNullException(nameof(logProfileName));
+ }
+
+ using var message = CreateDeleteRequest(logProfileName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ return message.Response;
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateGetRequest(string logProfileName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/providers/microsoft.insights/logprofiles/", false);
+ uri.AppendPath(logProfileName, true);
+ uri.AppendQuery("api-version", "2016-03-01", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Gets the log profile.
+ /// The name of the log profile.
+ /// The cancellation token to use.
+ /// is null.
+ public async Task> GetAsync(string logProfileName, CancellationToken cancellationToken = default)
+ {
+ if (logProfileName == null)
+ {
+ throw new ArgumentNullException(nameof(logProfileName));
+ }
+
+ using var message = CreateGetRequest(logProfileName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ LogProfileResource value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = LogProfileResource.DeserializeLogProfileResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Gets the log profile.
+ /// The name of the log profile.
+ /// The cancellation token to use.
+ /// is null.
+ public Response Get(string logProfileName, CancellationToken cancellationToken = default)
+ {
+ if (logProfileName == null)
+ {
+ throw new ArgumentNullException(nameof(logProfileName));
+ }
+
+ using var message = CreateGetRequest(logProfileName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ LogProfileResource value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = LogProfileResource.DeserializeLogProfileResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateCreateOrUpdateRequest(string logProfileName, LogProfileResource parameters)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Put;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/providers/microsoft.insights/logprofiles/", false);
+ uri.AppendPath(logProfileName, true);
+ uri.AppendQuery("api-version", "2016-03-01", true);
+ request.Uri = uri;
+ request.Headers.Add("Content-Type", "application/json");
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(parameters);
+ request.Content = content;
+ return message;
+ }
+
+ /// Create or update a log profile in Azure Monitoring REST API.
+ /// The name of the log profile.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ /// or is null.
+ public async Task> CreateOrUpdateAsync(string logProfileName, LogProfileResource parameters, CancellationToken cancellationToken = default)
+ {
+ if (logProfileName == null)
+ {
+ throw new ArgumentNullException(nameof(logProfileName));
+ }
+ if (parameters == null)
+ {
+ throw new ArgumentNullException(nameof(parameters));
+ }
+
+ using var message = CreateCreateOrUpdateRequest(logProfileName, parameters);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ LogProfileResource value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = LogProfileResource.DeserializeLogProfileResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Create or update a log profile in Azure Monitoring REST API.
+ /// The name of the log profile.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ /// or is null.
+ public Response CreateOrUpdate(string logProfileName, LogProfileResource parameters, CancellationToken cancellationToken = default)
+ {
+ if (logProfileName == null)
+ {
+ throw new ArgumentNullException(nameof(logProfileName));
+ }
+ if (parameters == null)
+ {
+ throw new ArgumentNullException(nameof(parameters));
+ }
+
+ using var message = CreateCreateOrUpdateRequest(logProfileName, parameters);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ LogProfileResource value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = LogProfileResource.DeserializeLogProfileResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateUpdateRequest(string logProfileName, LogProfileResourcePatch logProfilesResource)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Patch;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/providers/microsoft.insights/logprofiles/", false);
+ uri.AppendPath(logProfileName, true);
+ uri.AppendQuery("api-version", "2016-03-01", true);
+ request.Uri = uri;
+ request.Headers.Add("Content-Type", "application/json");
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(logProfilesResource);
+ request.Content = content;
+ return message;
+ }
+
+ /// Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method.
+ /// The name of the log profile.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ /// or is null.
+ public async Task> UpdateAsync(string logProfileName, LogProfileResourcePatch logProfilesResource, CancellationToken cancellationToken = default)
+ {
+ if (logProfileName == null)
+ {
+ throw new ArgumentNullException(nameof(logProfileName));
+ }
+ if (logProfilesResource == null)
+ {
+ throw new ArgumentNullException(nameof(logProfilesResource));
+ }
+
+ using var message = CreateUpdateRequest(logProfileName, logProfilesResource);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ LogProfileResource value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = LogProfileResource.DeserializeLogProfileResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method.
+ /// The name of the log profile.
+ /// Parameters supplied to the operation.
+ /// The cancellation token to use.
+ /// or is null.
+ public Response Update(string logProfileName, LogProfileResourcePatch logProfilesResource, CancellationToken cancellationToken = default)
+ {
+ if (logProfileName == null)
+ {
+ throw new ArgumentNullException(nameof(logProfileName));
+ }
+ if (logProfilesResource == null)
+ {
+ throw new ArgumentNullException(nameof(logProfilesResource));
+ }
+
+ using var message = CreateUpdateRequest(logProfileName, logProfilesResource);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ LogProfileResource value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = LogProfileResource.DeserializeLogProfileResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateListRequest()
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/providers/microsoft.insights/logprofiles", false);
+ uri.AppendQuery("api-version", "2016-03-01", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// List the log profiles.
+ /// The cancellation token to use.
+ public async Task> ListAsync(CancellationToken cancellationToken = default)
+ {
+ using var message = CreateListRequest();
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ LogProfileCollection value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = LogProfileCollection.DeserializeLogProfileCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// List the log profiles.
+ /// The cancellation token to use.
+ public Response List(CancellationToken cancellationToken = default)
+ {
+ using var message = CreateListRequest();
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ LogProfileCollection value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = LogProfileCollection.DeserializeLogProfileCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricAlertsOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricAlertsOperations.cs
new file mode 100644
index 000000000000..ae3ffd67aaf6
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricAlertsOperations.cs
@@ -0,0 +1,298 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ /// The MetricAlerts service client.
+ public partial class MetricAlertsOperations
+ {
+ private readonly ClientDiagnostics _clientDiagnostics;
+ private readonly HttpPipeline _pipeline;
+ internal MetricAlertsRestOperations RestClient { get; }
+ /// Initializes a new instance of MetricAlertsOperations for mocking.
+ protected MetricAlertsOperations()
+ {
+ }
+ /// Initializes a new instance of MetricAlertsOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The Azure subscription Id.
+ /// server parameter.
+ internal MetricAlertsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ RestClient = new MetricAlertsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ /// Retrieve an alert rule definition.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The cancellation token to use.
+ public virtual async Task> GetAsync(string resourceGroupName, string ruleName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("MetricAlertsOperations.Get");
+ scope.Start();
+ try
+ {
+ return await RestClient.GetAsync(resourceGroupName, ruleName, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Retrieve an alert rule definition.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The cancellation token to use.
+ public virtual Response Get(string resourceGroupName, string ruleName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("MetricAlertsOperations.Get");
+ scope.Start();
+ try
+ {
+ return RestClient.Get(resourceGroupName, ruleName, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Create or update an metric alert definition.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The parameters of the rule to create or update.
+ /// The cancellation token to use.
+ public virtual async Task> CreateOrUpdateAsync(string resourceGroupName, string ruleName, MetricAlertResource parameters, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("MetricAlertsOperations.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ return await RestClient.CreateOrUpdateAsync(resourceGroupName, ruleName, parameters, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Create or update an metric alert definition.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The parameters of the rule to create or update.
+ /// The cancellation token to use.
+ public virtual Response CreateOrUpdate(string resourceGroupName, string ruleName, MetricAlertResource parameters, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("MetricAlertsOperations.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ return RestClient.CreateOrUpdate(resourceGroupName, ruleName, parameters, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Update an metric alert definition.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The parameters of the rule to update.
+ /// The cancellation token to use.
+ public virtual async Task> UpdateAsync(string resourceGroupName, string ruleName, MetricAlertResourcePatch parameters, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("MetricAlertsOperations.Update");
+ scope.Start();
+ try
+ {
+ return await RestClient.UpdateAsync(resourceGroupName, ruleName, parameters, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Update an metric alert definition.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The parameters of the rule to update.
+ /// The cancellation token to use.
+ public virtual Response Update(string resourceGroupName, string ruleName, MetricAlertResourcePatch parameters, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("MetricAlertsOperations.Update");
+ scope.Start();
+ try
+ {
+ return RestClient.Update(resourceGroupName, ruleName, parameters, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Delete an alert rule definition.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The cancellation token to use.
+ public virtual async Task DeleteAsync(string resourceGroupName, string ruleName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("MetricAlertsOperations.Delete");
+ scope.Start();
+ try
+ {
+ return await RestClient.DeleteAsync(resourceGroupName, ruleName, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Delete an alert rule definition.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The cancellation token to use.
+ public virtual Response Delete(string resourceGroupName, string ruleName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("MetricAlertsOperations.Delete");
+ scope.Start();
+ try
+ {
+ return RestClient.Delete(resourceGroupName, ruleName, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Retrieve alert rule definitions in a subscription.
+ /// The cancellation token to use.
+ public virtual AsyncPageable ListBySubscriptionAsync(CancellationToken cancellationToken = default)
+ {
+ async Task> FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("MetricAlertsOperations.ListBySubscription");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListBySubscriptionAsync(cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null);
+ }
+
+ /// Retrieve alert rule definitions in a subscription.
+ /// The cancellation token to use.
+ public virtual Pageable ListBySubscription(CancellationToken cancellationToken = default)
+ {
+ Page FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("MetricAlertsOperations.ListBySubscription");
+ scope.Start();
+ try
+ {
+ var response = RestClient.ListBySubscription(cancellationToken);
+ return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateEnumerable(FirstPageFunc, null);
+ }
+
+ /// Retrieve alert rule definitions in a resource group.
+ /// The name of the resource group.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual AsyncPageable ListByResourceGroupAsync(string resourceGroupName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+
+ async Task> FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("MetricAlertsOperations.ListByResourceGroup");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null);
+ }
+
+ /// Retrieve alert rule definitions in a resource group.
+ /// The name of the resource group.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual Pageable ListByResourceGroup(string resourceGroupName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+
+ Page FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("MetricAlertsOperations.ListByResourceGroup");
+ scope.Start();
+ try
+ {
+ var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken);
+ return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateEnumerable(FirstPageFunc, null);
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricAlertsRestOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricAlertsRestOperations.cs
new file mode 100644
index 000000000000..9c9b619de552
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricAlertsRestOperations.cs
@@ -0,0 +1,520 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ internal partial class MetricAlertsRestOperations
+ {
+ private string subscriptionId;
+ private Uri endpoint;
+ private ClientDiagnostics _clientDiagnostics;
+ private HttpPipeline _pipeline;
+
+ /// Initializes a new instance of MetricAlertsRestOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The Azure subscription Id.
+ /// server parameter.
+ /// is null.
+ public MetricAlertsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ if (subscriptionId == null)
+ {
+ throw new ArgumentNullException(nameof(subscriptionId));
+ }
+ endpoint ??= new Uri("https://management.azure.com");
+
+ this.subscriptionId = subscriptionId;
+ this.endpoint = endpoint;
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ internal HttpMessage CreateListBySubscriptionRequest()
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/providers/Microsoft.Insights/metricAlerts", false);
+ uri.AppendQuery("api-version", "2018-03-01", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Retrieve alert rule definitions in a subscription.
+ /// The cancellation token to use.
+ public async Task> ListBySubscriptionAsync(CancellationToken cancellationToken = default)
+ {
+ using var message = CreateListBySubscriptionRequest();
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ MetricAlertResourceCollection value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = MetricAlertResourceCollection.DeserializeMetricAlertResourceCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Retrieve alert rule definitions in a subscription.
+ /// The cancellation token to use.
+ public Response ListBySubscription(CancellationToken cancellationToken = default)
+ {
+ using var message = CreateListBySubscriptionRequest();
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ MetricAlertResourceCollection value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = MetricAlertResourceCollection.DeserializeMetricAlertResourceCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/Microsoft.Insights/metricAlerts", false);
+ uri.AppendQuery("api-version", "2018-03-01", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Retrieve alert rule definitions in a resource group.
+ /// The name of the resource group.
+ /// The cancellation token to use.
+ /// is null.
+ public async Task> ListByResourceGroupAsync(string resourceGroupName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+
+ using var message = CreateListByResourceGroupRequest(resourceGroupName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ MetricAlertResourceCollection value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = MetricAlertResourceCollection.DeserializeMetricAlertResourceCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Retrieve alert rule definitions in a resource group.
+ /// The name of the resource group.
+ /// The cancellation token to use.
+ /// is null.
+ public Response ListByResourceGroup(string resourceGroupName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+
+ using var message = CreateListByResourceGroupRequest(resourceGroupName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ MetricAlertResourceCollection value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = MetricAlertResourceCollection.DeserializeMetricAlertResourceCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateGetRequest(string resourceGroupName, string ruleName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/Microsoft.Insights/metricAlerts/", false);
+ uri.AppendPath(ruleName, true);
+ uri.AppendQuery("api-version", "2018-03-01", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Retrieve an alert rule definition.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The cancellation token to use.
+ /// or is null.
+ public async Task> GetAsync(string resourceGroupName, string ruleName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (ruleName == null)
+ {
+ throw new ArgumentNullException(nameof(ruleName));
+ }
+
+ using var message = CreateGetRequest(resourceGroupName, ruleName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ MetricAlertResource value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = MetricAlertResource.DeserializeMetricAlertResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Retrieve an alert rule definition.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The cancellation token to use.
+ /// or is null.
+ public Response Get(string resourceGroupName, string ruleName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (ruleName == null)
+ {
+ throw new ArgumentNullException(nameof(ruleName));
+ }
+
+ using var message = CreateGetRequest(resourceGroupName, ruleName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ MetricAlertResource value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = MetricAlertResource.DeserializeMetricAlertResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string ruleName, MetricAlertResource parameters)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Put;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/Microsoft.Insights/metricAlerts/", false);
+ uri.AppendPath(ruleName, true);
+ uri.AppendQuery("api-version", "2018-03-01", true);
+ request.Uri = uri;
+ request.Headers.Add("Content-Type", "application/json");
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(parameters);
+ request.Content = content;
+ return message;
+ }
+
+ /// Create or update an metric alert definition.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The parameters of the rule to create or update.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public async Task> CreateOrUpdateAsync(string resourceGroupName, string ruleName, MetricAlertResource parameters, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (ruleName == null)
+ {
+ throw new ArgumentNullException(nameof(ruleName));
+ }
+ if (parameters == null)
+ {
+ throw new ArgumentNullException(nameof(parameters));
+ }
+
+ using var message = CreateCreateOrUpdateRequest(resourceGroupName, ruleName, parameters);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ MetricAlertResource value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = MetricAlertResource.DeserializeMetricAlertResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Create or update an metric alert definition.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The parameters of the rule to create or update.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public Response CreateOrUpdate(string resourceGroupName, string ruleName, MetricAlertResource parameters, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (ruleName == null)
+ {
+ throw new ArgumentNullException(nameof(ruleName));
+ }
+ if (parameters == null)
+ {
+ throw new ArgumentNullException(nameof(parameters));
+ }
+
+ using var message = CreateCreateOrUpdateRequest(resourceGroupName, ruleName, parameters);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ MetricAlertResource value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = MetricAlertResource.DeserializeMetricAlertResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string ruleName, MetricAlertResourcePatch parameters)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Patch;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/Microsoft.Insights/metricAlerts/", false);
+ uri.AppendPath(ruleName, true);
+ uri.AppendQuery("api-version", "2018-03-01", true);
+ request.Uri = uri;
+ request.Headers.Add("Content-Type", "application/json");
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(parameters);
+ request.Content = content;
+ return message;
+ }
+
+ /// Update an metric alert definition.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The parameters of the rule to update.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public async Task> UpdateAsync(string resourceGroupName, string ruleName, MetricAlertResourcePatch parameters, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (ruleName == null)
+ {
+ throw new ArgumentNullException(nameof(ruleName));
+ }
+ if (parameters == null)
+ {
+ throw new ArgumentNullException(nameof(parameters));
+ }
+
+ using var message = CreateUpdateRequest(resourceGroupName, ruleName, parameters);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ MetricAlertResource value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = MetricAlertResource.DeserializeMetricAlertResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Update an metric alert definition.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The parameters of the rule to update.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public Response Update(string resourceGroupName, string ruleName, MetricAlertResourcePatch parameters, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (ruleName == null)
+ {
+ throw new ArgumentNullException(nameof(ruleName));
+ }
+ if (parameters == null)
+ {
+ throw new ArgumentNullException(nameof(parameters));
+ }
+
+ using var message = CreateUpdateRequest(resourceGroupName, ruleName, parameters);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ MetricAlertResource value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = MetricAlertResource.DeserializeMetricAlertResource(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string ruleName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Delete;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/Microsoft.Insights/metricAlerts/", false);
+ uri.AppendPath(ruleName, true);
+ uri.AppendQuery("api-version", "2018-03-01", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Delete an alert rule definition.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The cancellation token to use.
+ /// or is null.
+ public async Task DeleteAsync(string resourceGroupName, string ruleName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (ruleName == null)
+ {
+ throw new ArgumentNullException(nameof(ruleName));
+ }
+
+ using var message = CreateDeleteRequest(resourceGroupName, ruleName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 204:
+ return message.Response;
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Delete an alert rule definition.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The cancellation token to use.
+ /// or is null.
+ public Response Delete(string resourceGroupName, string ruleName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (ruleName == null)
+ {
+ throw new ArgumentNullException(nameof(ruleName));
+ }
+
+ using var message = CreateDeleteRequest(resourceGroupName, ruleName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 204:
+ return message.Response;
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricAlertsStatusOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricAlertsStatusOperations.cs
new file mode 100644
index 000000000000..ec68874879be
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricAlertsStatusOperations.cs
@@ -0,0 +1,117 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ /// The MetricAlertsStatus service client.
+ public partial class MetricAlertsStatusOperations
+ {
+ private readonly ClientDiagnostics _clientDiagnostics;
+ private readonly HttpPipeline _pipeline;
+ internal MetricAlertsStatusRestOperations RestClient { get; }
+ /// Initializes a new instance of MetricAlertsStatusOperations for mocking.
+ protected MetricAlertsStatusOperations()
+ {
+ }
+ /// Initializes a new instance of MetricAlertsStatusOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The Azure subscription Id.
+ /// server parameter.
+ internal MetricAlertsStatusOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ RestClient = new MetricAlertsStatusRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ /// Retrieve an alert rule status.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The cancellation token to use.
+ public virtual async Task> ListAsync(string resourceGroupName, string ruleName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("MetricAlertsStatusOperations.List");
+ scope.Start();
+ try
+ {
+ return await RestClient.ListAsync(resourceGroupName, ruleName, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Retrieve an alert rule status.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The cancellation token to use.
+ public virtual Response List(string resourceGroupName, string ruleName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("MetricAlertsStatusOperations.List");
+ scope.Start();
+ try
+ {
+ return RestClient.List(resourceGroupName, ruleName, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Retrieve an alert rule status.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The name of the status.
+ /// The cancellation token to use.
+ public virtual async Task> ListByNameAsync(string resourceGroupName, string ruleName, string statusName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("MetricAlertsStatusOperations.ListByName");
+ scope.Start();
+ try
+ {
+ return await RestClient.ListByNameAsync(resourceGroupName, ruleName, statusName, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Retrieve an alert rule status.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The name of the status.
+ /// The cancellation token to use.
+ public virtual Response ListByName(string resourceGroupName, string ruleName, string statusName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("MetricAlertsStatusOperations.ListByName");
+ scope.Start();
+ try
+ {
+ return RestClient.ListByName(resourceGroupName, ruleName, statusName, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricAlertsStatusRestOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricAlertsStatusRestOperations.cs
new file mode 100644
index 000000000000..1c79a9da19f9
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricAlertsStatusRestOperations.cs
@@ -0,0 +1,223 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ internal partial class MetricAlertsStatusRestOperations
+ {
+ private string subscriptionId;
+ private Uri endpoint;
+ private ClientDiagnostics _clientDiagnostics;
+ private HttpPipeline _pipeline;
+
+ /// Initializes a new instance of MetricAlertsStatusRestOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The Azure subscription Id.
+ /// server parameter.
+ /// is null.
+ public MetricAlertsStatusRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ if (subscriptionId == null)
+ {
+ throw new ArgumentNullException(nameof(subscriptionId));
+ }
+ endpoint ??= new Uri("https://management.azure.com");
+
+ this.subscriptionId = subscriptionId;
+ this.endpoint = endpoint;
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ internal HttpMessage CreateListRequest(string resourceGroupName, string ruleName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/Microsoft.Insights/metricAlerts/", false);
+ uri.AppendPath(ruleName, true);
+ uri.AppendPath("/status", false);
+ uri.AppendQuery("api-version", "2018-03-01", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Retrieve an alert rule status.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The cancellation token to use.
+ /// or is null.
+ public async Task> ListAsync(string resourceGroupName, string ruleName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (ruleName == null)
+ {
+ throw new ArgumentNullException(nameof(ruleName));
+ }
+
+ using var message = CreateListRequest(resourceGroupName, ruleName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ MetricAlertStatusCollection value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = MetricAlertStatusCollection.DeserializeMetricAlertStatusCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Retrieve an alert rule status.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The cancellation token to use.
+ /// or is null.
+ public Response List(string resourceGroupName, string ruleName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (ruleName == null)
+ {
+ throw new ArgumentNullException(nameof(ruleName));
+ }
+
+ using var message = CreateListRequest(resourceGroupName, ruleName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ MetricAlertStatusCollection value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = MetricAlertStatusCollection.DeserializeMetricAlertStatusCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateListByNameRequest(string resourceGroupName, string ruleName, string statusName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/Microsoft.Insights/metricAlerts/", false);
+ uri.AppendPath(ruleName, true);
+ uri.AppendPath("/status/", false);
+ uri.AppendPath(statusName, true);
+ uri.AppendQuery("api-version", "2018-03-01", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Retrieve an alert rule status.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The name of the status.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public async Task> ListByNameAsync(string resourceGroupName, string ruleName, string statusName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (ruleName == null)
+ {
+ throw new ArgumentNullException(nameof(ruleName));
+ }
+ if (statusName == null)
+ {
+ throw new ArgumentNullException(nameof(statusName));
+ }
+
+ using var message = CreateListByNameRequest(resourceGroupName, ruleName, statusName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ MetricAlertStatusCollection value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = MetricAlertStatusCollection.DeserializeMetricAlertStatusCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Retrieve an alert rule status.
+ /// The name of the resource group.
+ /// The name of the rule.
+ /// The name of the status.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public Response ListByName(string resourceGroupName, string ruleName, string statusName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (ruleName == null)
+ {
+ throw new ArgumentNullException(nameof(ruleName));
+ }
+ if (statusName == null)
+ {
+ throw new ArgumentNullException(nameof(statusName));
+ }
+
+ using var message = CreateListByNameRequest(resourceGroupName, ruleName, statusName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ MetricAlertStatusCollection value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = MetricAlertStatusCollection.DeserializeMetricAlertStatusCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricBaselineOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricBaselineOperations.cs
new file mode 100644
index 000000000000..73d6c538c333
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricBaselineOperations.cs
@@ -0,0 +1,124 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ /// The MetricBaseline service client.
+ public partial class MetricBaselineOperations
+ {
+ private readonly ClientDiagnostics _clientDiagnostics;
+ private readonly HttpPipeline _pipeline;
+ internal MetricBaselineRestOperations RestClient { get; }
+ /// Initializes a new instance of MetricBaselineOperations for mocking.
+ protected MetricBaselineOperations()
+ {
+ }
+ /// Initializes a new instance of MetricBaselineOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// server parameter.
+ internal MetricBaselineOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null)
+ {
+ RestClient = new MetricBaselineRestOperations(clientDiagnostics, pipeline, endpoint);
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ /// **Gets the baseline values for a specific metric**.
+ /// The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1.
+ /// The name of the metric to retrieve the baseline for.
+ /// The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'.
+ /// The interval (i.e. timegrain) of the query.
+ /// The aggregation type of the metric to retrieve the baseline for.
+ /// The list of sensitivities (comma separated) to retrieve.
+ /// Allows retrieving only metadata of the baseline. On data request all information is retrieved.
+ /// The cancellation token to use.
+ public virtual async Task> GetAsync(string resourceUri, string metricName, string timespan = null, TimeSpan? interval = null, string aggregation = null, string sensitivities = null, ResultType? resultType = null, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("MetricBaselineOperations.Get");
+ scope.Start();
+ try
+ {
+ return await RestClient.GetAsync(resourceUri, metricName, timespan, interval, aggregation, sensitivities, resultType, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// **Gets the baseline values for a specific metric**.
+ /// The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1.
+ /// The name of the metric to retrieve the baseline for.
+ /// The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'.
+ /// The interval (i.e. timegrain) of the query.
+ /// The aggregation type of the metric to retrieve the baseline for.
+ /// The list of sensitivities (comma separated) to retrieve.
+ /// Allows retrieving only metadata of the baseline. On data request all information is retrieved.
+ /// The cancellation token to use.
+ public virtual Response Get(string resourceUri, string metricName, string timespan = null, TimeSpan? interval = null, string aggregation = null, string sensitivities = null, ResultType? resultType = null, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("MetricBaselineOperations.Get");
+ scope.Start();
+ try
+ {
+ return RestClient.Get(resourceUri, metricName, timespan, interval, aggregation, sensitivities, resultType, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// **Lists the baseline values for a resource**.
+ /// The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1.
+ /// Information that need to be specified to calculate a baseline on a time series.
+ /// The cancellation token to use.
+ public virtual async Task> CalculateBaselineAsync(string resourceUri, TimeSeriesInformation timeSeriesInformation, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("MetricBaselineOperations.CalculateBaseline");
+ scope.Start();
+ try
+ {
+ return await RestClient.CalculateBaselineAsync(resourceUri, timeSeriesInformation, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// **Lists the baseline values for a resource**.
+ /// The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1.
+ /// Information that need to be specified to calculate a baseline on a time series.
+ /// The cancellation token to use.
+ public virtual Response CalculateBaseline(string resourceUri, TimeSeriesInformation timeSeriesInformation, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("MetricBaselineOperations.CalculateBaseline");
+ scope.Start();
+ try
+ {
+ return RestClient.CalculateBaseline(resourceUri, timeSeriesInformation, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricBaselineRestOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricBaselineRestOperations.cs
new file mode 100644
index 000000000000..75c59b9ab82a
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricBaselineRestOperations.cs
@@ -0,0 +1,231 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ internal partial class MetricBaselineRestOperations
+ {
+ private Uri endpoint;
+ private ClientDiagnostics _clientDiagnostics;
+ private HttpPipeline _pipeline;
+
+ /// Initializes a new instance of MetricBaselineRestOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// server parameter.
+ public MetricBaselineRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null)
+ {
+ endpoint ??= new Uri("https://management.azure.com");
+
+ this.endpoint = endpoint;
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ internal HttpMessage CreateGetRequest(string resourceUri, string metricName, string timespan, TimeSpan? interval, string aggregation, string sensitivities, ResultType? resultType)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/", false);
+ uri.AppendPath(resourceUri, false);
+ uri.AppendPath("/providers/microsoft.insights/baseline/", false);
+ uri.AppendPath(metricName, true);
+ if (timespan != null)
+ {
+ uri.AppendQuery("timespan", timespan, true);
+ }
+ if (interval != null)
+ {
+ uri.AppendQuery("interval", interval.Value, "P", true);
+ }
+ if (aggregation != null)
+ {
+ uri.AppendQuery("aggregation", aggregation, true);
+ }
+ if (sensitivities != null)
+ {
+ uri.AppendQuery("sensitivities", sensitivities, true);
+ }
+ if (resultType != null)
+ {
+ uri.AppendQuery("resultType", resultType.Value.ToSerialString(), true);
+ }
+ uri.AppendQuery("api-version", "2017-11-01-preview", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// **Gets the baseline values for a specific metric**.
+ /// The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1.
+ /// The name of the metric to retrieve the baseline for.
+ /// The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'.
+ /// The interval (i.e. timegrain) of the query.
+ /// The aggregation type of the metric to retrieve the baseline for.
+ /// The list of sensitivities (comma separated) to retrieve.
+ /// Allows retrieving only metadata of the baseline. On data request all information is retrieved.
+ /// The cancellation token to use.
+ /// or is null.
+ public async Task> GetAsync(string resourceUri, string metricName, string timespan = null, TimeSpan? interval = null, string aggregation = null, string sensitivities = null, ResultType? resultType = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+ if (metricName == null)
+ {
+ throw new ArgumentNullException(nameof(metricName));
+ }
+
+ using var message = CreateGetRequest(resourceUri, metricName, timespan, interval, aggregation, sensitivities, resultType);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ BaselineResponse value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = BaselineResponse.DeserializeBaselineResponse(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// **Gets the baseline values for a specific metric**.
+ /// The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1.
+ /// The name of the metric to retrieve the baseline for.
+ /// The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'.
+ /// The interval (i.e. timegrain) of the query.
+ /// The aggregation type of the metric to retrieve the baseline for.
+ /// The list of sensitivities (comma separated) to retrieve.
+ /// Allows retrieving only metadata of the baseline. On data request all information is retrieved.
+ /// The cancellation token to use.
+ /// or is null.
+ public Response Get(string resourceUri, string metricName, string timespan = null, TimeSpan? interval = null, string aggregation = null, string sensitivities = null, ResultType? resultType = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+ if (metricName == null)
+ {
+ throw new ArgumentNullException(nameof(metricName));
+ }
+
+ using var message = CreateGetRequest(resourceUri, metricName, timespan, interval, aggregation, sensitivities, resultType);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ BaselineResponse value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = BaselineResponse.DeserializeBaselineResponse(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateCalculateBaselineRequest(string resourceUri, TimeSeriesInformation timeSeriesInformation)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Post;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/", false);
+ uri.AppendPath(resourceUri, false);
+ uri.AppendPath("/providers/microsoft.insights/calculatebaseline", false);
+ uri.AppendQuery("api-version", "2017-11-01-preview", true);
+ request.Uri = uri;
+ request.Headers.Add("Content-Type", "application/json");
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(timeSeriesInformation);
+ request.Content = content;
+ return message;
+ }
+
+ /// **Lists the baseline values for a resource**.
+ /// The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1.
+ /// Information that need to be specified to calculate a baseline on a time series.
+ /// The cancellation token to use.
+ /// or is null.
+ public async Task> CalculateBaselineAsync(string resourceUri, TimeSeriesInformation timeSeriesInformation, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+ if (timeSeriesInformation == null)
+ {
+ throw new ArgumentNullException(nameof(timeSeriesInformation));
+ }
+
+ using var message = CreateCalculateBaselineRequest(resourceUri, timeSeriesInformation);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ CalculateBaselineResponse value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = CalculateBaselineResponse.DeserializeCalculateBaselineResponse(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// **Lists the baseline values for a resource**.
+ /// The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1.
+ /// Information that need to be specified to calculate a baseline on a time series.
+ /// The cancellation token to use.
+ /// or is null.
+ public Response CalculateBaseline(string resourceUri, TimeSeriesInformation timeSeriesInformation, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+ if (timeSeriesInformation == null)
+ {
+ throw new ArgumentNullException(nameof(timeSeriesInformation));
+ }
+
+ using var message = CreateCalculateBaselineRequest(resourceUri, timeSeriesInformation);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ CalculateBaselineResponse value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = CalculateBaselineResponse.DeserializeCalculateBaselineResponse(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricDefinitionsOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricDefinitionsOperations.cs
new file mode 100644
index 000000000000..a9990c252c35
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricDefinitionsOperations.cs
@@ -0,0 +1,99 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ /// The MetricDefinitions service client.
+ public partial class MetricDefinitionsOperations
+ {
+ private readonly ClientDiagnostics _clientDiagnostics;
+ private readonly HttpPipeline _pipeline;
+ internal MetricDefinitionsRestOperations RestClient { get; }
+ /// Initializes a new instance of MetricDefinitionsOperations for mocking.
+ protected MetricDefinitionsOperations()
+ {
+ }
+ /// Initializes a new instance of MetricDefinitionsOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// server parameter.
+ internal MetricDefinitionsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null)
+ {
+ RestClient = new MetricDefinitionsRestOperations(clientDiagnostics, pipeline, endpoint);
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ /// Lists the metric definitions for the resource.
+ /// The identifier of the resource.
+ /// Metric namespace to query metric definitions for.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual AsyncPageable ListAsync(string resourceUri, string metricnamespace = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+
+ async Task> FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("MetricDefinitionsOperations.List");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListAsync(resourceUri, metricnamespace, cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null);
+ }
+
+ /// Lists the metric definitions for the resource.
+ /// The identifier of the resource.
+ /// Metric namespace to query metric definitions for.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual Pageable List(string resourceUri, string metricnamespace = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+
+ Page FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("MetricDefinitionsOperations.List");
+ scope.Start();
+ try
+ {
+ var response = RestClient.List(resourceUri, metricnamespace, cancellationToken);
+ return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateEnumerable(FirstPageFunc, null);
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricDefinitionsRestOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricDefinitionsRestOperations.cs
new file mode 100644
index 000000000000..d3e36d026d91
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricDefinitionsRestOperations.cs
@@ -0,0 +1,113 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ internal partial class MetricDefinitionsRestOperations
+ {
+ private Uri endpoint;
+ private ClientDiagnostics _clientDiagnostics;
+ private HttpPipeline _pipeline;
+
+ /// Initializes a new instance of MetricDefinitionsRestOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// server parameter.
+ public MetricDefinitionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null)
+ {
+ endpoint ??= new Uri("https://management.azure.com");
+
+ this.endpoint = endpoint;
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ internal HttpMessage CreateListRequest(string resourceUri, string metricnamespace)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/", false);
+ uri.AppendPath(resourceUri, false);
+ uri.AppendPath("/providers/microsoft.insights/metricDefinitions", false);
+ uri.AppendQuery("api-version", "2018-01-01", true);
+ if (metricnamespace != null)
+ {
+ uri.AppendQuery("metricnamespace", metricnamespace, true);
+ }
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Lists the metric definitions for the resource.
+ /// The identifier of the resource.
+ /// Metric namespace to query metric definitions for.
+ /// The cancellation token to use.
+ /// is null.
+ public async Task> ListAsync(string resourceUri, string metricnamespace = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+
+ using var message = CreateListRequest(resourceUri, metricnamespace);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ MetricDefinitionCollection value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = MetricDefinitionCollection.DeserializeMetricDefinitionCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Lists the metric definitions for the resource.
+ /// The identifier of the resource.
+ /// Metric namespace to query metric definitions for.
+ /// The cancellation token to use.
+ /// is null.
+ public Response List(string resourceUri, string metricnamespace = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+
+ using var message = CreateListRequest(resourceUri, metricnamespace);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ MetricDefinitionCollection value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = MetricDefinitionCollection.DeserializeMetricDefinitionCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricNamespacesOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricNamespacesOperations.cs
new file mode 100644
index 000000000000..9814500c513e
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricNamespacesOperations.cs
@@ -0,0 +1,99 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ /// The MetricNamespaces service client.
+ public partial class MetricNamespacesOperations
+ {
+ private readonly ClientDiagnostics _clientDiagnostics;
+ private readonly HttpPipeline _pipeline;
+ internal MetricNamespacesRestOperations RestClient { get; }
+ /// Initializes a new instance of MetricNamespacesOperations for mocking.
+ protected MetricNamespacesOperations()
+ {
+ }
+ /// Initializes a new instance of MetricNamespacesOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// server parameter.
+ internal MetricNamespacesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null)
+ {
+ RestClient = new MetricNamespacesRestOperations(clientDiagnostics, pipeline, endpoint);
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ /// Lists the metric namespaces for the resource.
+ /// The identifier of the resource.
+ /// The ISO 8601 conform Date start time from which to query for metric namespaces.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual AsyncPageable ListAsync(string resourceUri, string startTime = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+
+ async Task> FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("MetricNamespacesOperations.List");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListAsync(resourceUri, startTime, cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null);
+ }
+
+ /// Lists the metric namespaces for the resource.
+ /// The identifier of the resource.
+ /// The ISO 8601 conform Date start time from which to query for metric namespaces.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual Pageable List(string resourceUri, string startTime = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+
+ Page FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("MetricNamespacesOperations.List");
+ scope.Start();
+ try
+ {
+ var response = RestClient.List(resourceUri, startTime, cancellationToken);
+ return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateEnumerable(FirstPageFunc, null);
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricNamespacesRestOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricNamespacesRestOperations.cs
new file mode 100644
index 000000000000..8fd7a8425dbb
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricNamespacesRestOperations.cs
@@ -0,0 +1,113 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ internal partial class MetricNamespacesRestOperations
+ {
+ private Uri endpoint;
+ private ClientDiagnostics _clientDiagnostics;
+ private HttpPipeline _pipeline;
+
+ /// Initializes a new instance of MetricNamespacesRestOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// server parameter.
+ public MetricNamespacesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null)
+ {
+ endpoint ??= new Uri("https://management.azure.com");
+
+ this.endpoint = endpoint;
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ internal HttpMessage CreateListRequest(string resourceUri, string startTime)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/", false);
+ uri.AppendPath(resourceUri, false);
+ uri.AppendPath("/providers/microsoft.insights/metricNamespaces", false);
+ uri.AppendQuery("api-version", "2017-12-01-preview", true);
+ if (startTime != null)
+ {
+ uri.AppendQuery("startTime", startTime, true);
+ }
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Lists the metric namespaces for the resource.
+ /// The identifier of the resource.
+ /// The ISO 8601 conform Date start time from which to query for metric namespaces.
+ /// The cancellation token to use.
+ /// is null.
+ public async Task> ListAsync(string resourceUri, string startTime = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+
+ using var message = CreateListRequest(resourceUri, startTime);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ MetricNamespaceCollection value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = MetricNamespaceCollection.DeserializeMetricNamespaceCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Lists the metric namespaces for the resource.
+ /// The identifier of the resource.
+ /// The ISO 8601 conform Date start time from which to query for metric namespaces.
+ /// The cancellation token to use.
+ /// is null.
+ public Response List(string resourceUri, string startTime = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+
+ using var message = CreateListRequest(resourceUri, startTime);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ MetricNamespaceCollection value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = MetricNamespaceCollection.DeserializeMetricNamespaceCollection(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricsOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricsOperations.cs
new file mode 100644
index 000000000000..02d7ff23180b
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricsOperations.cs
@@ -0,0 +1,108 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ /// The Metrics service client.
+ public partial class MetricsOperations
+ {
+ private readonly ClientDiagnostics _clientDiagnostics;
+ private readonly HttpPipeline _pipeline;
+ internal MetricsRestOperations RestClient { get; }
+ /// Initializes a new instance of MetricsOperations for mocking.
+ protected MetricsOperations()
+ {
+ }
+ /// Initializes a new instance of MetricsOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// server parameter.
+ internal MetricsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null)
+ {
+ RestClient = new MetricsRestOperations(clientDiagnostics, pipeline, endpoint);
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ /// **Lists the metric values for a resource**.
+ /// The identifier of the resource.
+ /// The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'.
+ /// The interval (i.e. timegrain) of the query.
+ /// The names of the metrics (comma separated) to retrieve.
+ /// The list of aggregation types (comma separated) to retrieve.
+ ///
+ /// The maximum number of records to retrieve.
+ /// Valid only if $filter is specified.
+ /// Defaults to 10.
+ ///
+ ///
+ /// The aggregation to use for sorting results and the direction of the sort.
+ /// Only one order can be specified.
+ /// Examples: sum asc.
+ ///
+ /// The **$filter** is used to reduce the set of metric data returned.<br>Example:<br>Metric contains metadata A, B and C.<br>- Return all time series of C where A = a1 and B = b1 or b2<br>**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**<br>- Invalid variant:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**<br>This is invalid because the logical or operator cannot separate two different metadata names.<br>- Return all time series where A = a1, B = b1 and C = c1:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**<br>- Return all time series where A = a1<br>**$filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**.
+ /// Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details.
+ /// Metric namespace to query metric definitions for.
+ /// The cancellation token to use.
+ public virtual async Task> ListAsync(string resourceUri, string timespan = null, TimeSpan? interval = null, string metricnames = null, string aggregation = null, int? top = null, string orderby = null, string filter = null, ResultType? resultType = null, string metricnamespace = null, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("MetricsOperations.List");
+ scope.Start();
+ try
+ {
+ return await RestClient.ListAsync(resourceUri, timespan, interval, metricnames, aggregation, top, orderby, filter, resultType, metricnamespace, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// **Lists the metric values for a resource**.
+ /// The identifier of the resource.
+ /// The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'.
+ /// The interval (i.e. timegrain) of the query.
+ /// The names of the metrics (comma separated) to retrieve.
+ /// The list of aggregation types (comma separated) to retrieve.
+ ///
+ /// The maximum number of records to retrieve.
+ /// Valid only if $filter is specified.
+ /// Defaults to 10.
+ ///
+ ///
+ /// The aggregation to use for sorting results and the direction of the sort.
+ /// Only one order can be specified.
+ /// Examples: sum asc.
+ ///
+ /// The **$filter** is used to reduce the set of metric data returned.<br>Example:<br>Metric contains metadata A, B and C.<br>- Return all time series of C where A = a1 and B = b1 or b2<br>**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**<br>- Invalid variant:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**<br>This is invalid because the logical or operator cannot separate two different metadata names.<br>- Return all time series where A = a1, B = b1 and C = c1:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**<br>- Return all time series where A = a1<br>**$filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**.
+ /// Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details.
+ /// Metric namespace to query metric definitions for.
+ /// The cancellation token to use.
+ public virtual Response List(string resourceUri, string timespan = null, TimeSpan? interval = null, string metricnames = null, string aggregation = null, int? top = null, string orderby = null, string filter = null, ResultType? resultType = null, string metricnamespace = null, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("MetricsOperations.List");
+ scope.Start();
+ try
+ {
+ return RestClient.List(resourceUri, timespan, interval, metricnames, aggregation, top, orderby, filter, resultType, metricnamespace, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricsRestOperations.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricsRestOperations.cs
new file mode 100644
index 000000000000..8cab4801d88f
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/MetricsRestOperations.cs
@@ -0,0 +1,177 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Insights.Models;
+
+namespace Azure.ResourceManager.Insights
+{
+ internal partial class MetricsRestOperations
+ {
+ private Uri endpoint;
+ private ClientDiagnostics _clientDiagnostics;
+ private HttpPipeline _pipeline;
+
+ /// Initializes a new instance of MetricsRestOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// server parameter.
+ public MetricsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null)
+ {
+ endpoint ??= new Uri("https://management.azure.com");
+
+ this.endpoint = endpoint;
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ internal HttpMessage CreateListRequest(string resourceUri, string timespan, TimeSpan? interval, string metricnames, string aggregation, int? top, string orderby, string filter, ResultType? resultType, string metricnamespace)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/", false);
+ uri.AppendPath(resourceUri, false);
+ uri.AppendPath("/providers/microsoft.insights/metrics", false);
+ if (timespan != null)
+ {
+ uri.AppendQuery("timespan", timespan, true);
+ }
+ if (interval != null)
+ {
+ uri.AppendQuery("interval", interval.Value, "P", true);
+ }
+ if (metricnames != null)
+ {
+ uri.AppendQuery("metricnames", metricnames, true);
+ }
+ if (aggregation != null)
+ {
+ uri.AppendQuery("aggregation", aggregation, true);
+ }
+ if (top != null)
+ {
+ uri.AppendQuery("top", top.Value, true);
+ }
+ if (orderby != null)
+ {
+ uri.AppendQuery("orderby", orderby, true);
+ }
+ if (filter != null)
+ {
+ uri.AppendQuery("$filter", filter, true);
+ }
+ if (resultType != null)
+ {
+ uri.AppendQuery("resultType", resultType.Value.ToSerialString(), true);
+ }
+ uri.AppendQuery("api-version", "2018-01-01", true);
+ if (metricnamespace != null)
+ {
+ uri.AppendQuery("metricnamespace", metricnamespace, true);
+ }
+ request.Uri = uri;
+ return message;
+ }
+
+ /// **Lists the metric values for a resource**.
+ /// The identifier of the resource.
+ /// The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'.
+ /// The interval (i.e. timegrain) of the query.
+ /// The names of the metrics (comma separated) to retrieve.
+ /// The list of aggregation types (comma separated) to retrieve.
+ ///
+ /// The maximum number of records to retrieve.
+ /// Valid only if $filter is specified.
+ /// Defaults to 10.
+ ///
+ ///
+ /// The aggregation to use for sorting results and the direction of the sort.
+ /// Only one order can be specified.
+ /// Examples: sum asc.
+ ///
+ /// The **$filter** is used to reduce the set of metric data returned.<br>Example:<br>Metric contains metadata A, B and C.<br>- Return all time series of C where A = a1 and B = b1 or b2<br>**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**<br>- Invalid variant:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**<br>This is invalid because the logical or operator cannot separate two different metadata names.<br>- Return all time series where A = a1, B = b1 and C = c1:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**<br>- Return all time series where A = a1<br>**$filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**.
+ /// Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details.
+ /// Metric namespace to query metric definitions for.
+ /// The cancellation token to use.
+ /// is null.
+ public async Task> ListAsync(string resourceUri, string timespan = null, TimeSpan? interval = null, string metricnames = null, string aggregation = null, int? top = null, string orderby = null, string filter = null, ResultType? resultType = null, string metricnamespace = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+
+ using var message = CreateListRequest(resourceUri, timespan, interval, metricnames, aggregation, top, orderby, filter, resultType, metricnamespace);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ Models.Response value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = Models.Response.DeserializeResponse(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// **Lists the metric values for a resource**.
+ /// The identifier of the resource.
+ /// The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'.
+ /// The interval (i.e. timegrain) of the query.
+ /// The names of the metrics (comma separated) to retrieve.
+ /// The list of aggregation types (comma separated) to retrieve.
+ ///
+ /// The maximum number of records to retrieve.
+ /// Valid only if $filter is specified.
+ /// Defaults to 10.
+ ///
+ ///
+ /// The aggregation to use for sorting results and the direction of the sort.
+ /// Only one order can be specified.
+ /// Examples: sum asc.
+ ///
+ /// The **$filter** is used to reduce the set of metric data returned.<br>Example:<br>Metric contains metadata A, B and C.<br>- Return all time series of C where A = a1 and B = b1 or b2<br>**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**<br>- Invalid variant:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**<br>This is invalid because the logical or operator cannot separate two different metadata names.<br>- Return all time series where A = a1, B = b1 and C = c1:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**<br>- Return all time series where A = a1<br>**$filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**.
+ /// Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details.
+ /// Metric namespace to query metric definitions for.
+ /// The cancellation token to use.
+ /// is null.
+ public Response List(string resourceUri, string timespan = null, TimeSpan? interval = null, string metricnames = null, string aggregation = null, int? top = null, string orderby = null, string filter = null, ResultType? resultType = null, string metricnamespace = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceUri == null)
+ {
+ throw new ArgumentNullException(nameof(resourceUri));
+ }
+
+ using var message = CreateListRequest(resourceUri, timespan, interval, metricnames, aggregation, top, orderby, filter, resultType, metricnamespace);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ Models.Response value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = Models.Response.DeserializeResponse(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/Models/Action.Serialization.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/Models/Action.Serialization.cs
new file mode 100644
index 000000000000..6bfbec477cd1
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/Models/Action.Serialization.cs
@@ -0,0 +1,45 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.ResourceManager.Insights.Models
+{
+ public partial class Action : IUtf8JsonSerializable
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
+ {
+ writer.WriteStartObject();
+ writer.WritePropertyName("odata.type");
+ writer.WriteStringValue(OdataType);
+ writer.WriteEndObject();
+ }
+
+ internal static Action DeserializeAction(JsonElement element)
+ {
+ if (element.TryGetProperty("odata.type", out JsonElement discriminator))
+ {
+ switch (discriminator.GetString())
+ {
+ case "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction": return AlertingAction.DeserializeAlertingAction(element);
+ case "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction": return LogToMetricAction.DeserializeLogToMetricAction(element);
+ }
+ }
+ string odataType = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("odata.type"))
+ {
+ odataType = property.Value.GetString();
+ continue;
+ }
+ }
+ return new Action(odataType);
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/Models/Action.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/Models/Action.cs
new file mode 100644
index 000000000000..4a67d85a13fe
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/Models/Action.cs
@@ -0,0 +1,28 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+namespace Azure.ResourceManager.Insights.Models
+{
+ /// Action descriptor.
+ public partial class Action
+ {
+ /// Initializes a new instance of Action.
+ public Action()
+ {
+ }
+
+ /// Initializes a new instance of Action.
+ /// Specifies the action. Supported values - AlertingAction, LogToMetricAction.
+ internal Action(string odataType)
+ {
+ OdataType = odataType;
+ }
+
+ /// Specifies the action. Supported values - AlertingAction, LogToMetricAction.
+ internal string OdataType { get; set; }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/Models/ActionGroupList.Serialization.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/Models/ActionGroupList.Serialization.cs
new file mode 100644
index 000000000000..d83337d54fc7
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/Models/ActionGroupList.Serialization.cs
@@ -0,0 +1,41 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.ResourceManager.Insights.Models
+{
+ public partial class ActionGroupList
+ {
+ internal static ActionGroupList DeserializeActionGroupList(JsonElement element)
+ {
+ Optional> value = default;
+ Optional nextLink = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("value"))
+ {
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(ActionGroupResource.DeserializeActionGroupResource(item));
+ }
+ value = array;
+ continue;
+ }
+ if (property.NameEquals("nextLink"))
+ {
+ nextLink = property.Value.GetString();
+ continue;
+ }
+ }
+ return new ActionGroupList(Optional.ToList(value), nextLink.Value);
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/Models/ActionGroupList.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/Models/ActionGroupList.cs
new file mode 100644
index 000000000000..3f8fd2063399
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/Models/ActionGroupList.cs
@@ -0,0 +1,36 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Collections.Generic;
+using Azure.Core;
+
+namespace Azure.ResourceManager.Insights.Models
+{
+ /// A list of action groups.
+ public partial class ActionGroupList
+ {
+ /// Initializes a new instance of ActionGroupList.
+ internal ActionGroupList()
+ {
+ Value = new ChangeTrackingList();
+ }
+
+ /// Initializes a new instance of ActionGroupList.
+ /// The list of action groups.
+ /// Provides the link to retrieve the next set of elements.
+ internal ActionGroupList(IReadOnlyList value, string nextLink)
+ {
+ Value = value;
+ NextLink = nextLink;
+ }
+
+ /// The list of action groups.
+ public IReadOnlyList Value { get; }
+ /// Provides the link to retrieve the next set of elements.
+ public string NextLink { get; }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/Models/ActionGroupPatchBody.Serialization.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/Models/ActionGroupPatchBody.Serialization.cs
new file mode 100644
index 000000000000..2e4c2a217eaf
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/Models/ActionGroupPatchBody.Serialization.cs
@@ -0,0 +1,40 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.ResourceManager.Insights.Models
+{
+ public partial class ActionGroupPatchBody : IUtf8JsonSerializable
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
+ {
+ writer.WriteStartObject();
+ if (Optional.IsCollectionDefined(Tags))
+ {
+ writer.WritePropertyName("tags");
+ writer.WriteStartObject();
+ foreach (var item in Tags)
+ {
+ writer.WritePropertyName(item.Key);
+ writer.WriteStringValue(item.Value);
+ }
+ writer.WriteEndObject();
+ }
+ writer.WritePropertyName("properties");
+ writer.WriteStartObject();
+ if (Optional.IsDefined(Enabled))
+ {
+ writer.WritePropertyName("enabled");
+ writer.WriteBooleanValue(Enabled.Value);
+ }
+ writer.WriteEndObject();
+ writer.WriteEndObject();
+ }
+ }
+}
diff --git a/sdk/insights/Azure.ResourceManager.Insights/src/Generated/Models/ActionGroupPatchBody.cs b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/Models/ActionGroupPatchBody.cs
new file mode 100644
index 000000000000..05021d4ebfa4
--- /dev/null
+++ b/sdk/insights/Azure.ResourceManager.Insights/src/Generated/Models/ActionGroupPatchBody.cs
@@ -0,0 +1,27 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Collections.Generic;
+using Azure.Core;
+
+namespace Azure.ResourceManager.Insights.Models
+{
+ /// An action group object for the body of patch operations.
+ public partial class ActionGroupPatchBody
+ {
+ /// Initializes a new instance of ActionGroupPatchBody.
+ public ActionGroupPatchBody()
+ {
+ Tags = new ChangeTrackingDictionary();
+ }
+
+ ///