diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/Azure.ResourceManager.Cognitivesearch.sln b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/Azure.ResourceManager.Cognitivesearch.sln
new file mode 100644
index 000000000000..df61e6f2435c
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/Azure.ResourceManager.Cognitivesearch.sln
@@ -0,0 +1,65 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30309.148
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{59E4C8A8-917D-4917-8395-E3EF44C70939}") = "Azure.ResourceManager.Cognitivesearch", "src\Azure.ResourceManager.Cognitivesearch.csproj", "{CB205D4D-4197-4ED8-A1FB-04918609A4F8}"
+EndProject
+Project("{59E4C8A8-917D-4917-8395-E3EF44C70939}") = "Azure.ResourceManager.Cognitivesearch.Tests", "tests\Azure.ResourceManager.Cognitivesearch.Tests.csproj", "{0381D9D4-14D0-43A1-A2EA-7251B89E0D5F}"
+EndProject
+Project("{59E4C8A8-917D-4917-8395-E3EF44C70939}") = "Azure.ResourceManager.Cognitivesearch.Samples", "samples\Azure.ResourceManager.Cognitivesearch.Samples.csproj", "{37B0DEA0-ABBF-4B9B-A383-840D7D9E481D}"
+EndProject
+Global
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {3DBEC221-36E0-40D2-BAA1-C1C8A0A0EB5E}
+ EndGlobalSection
+ 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(ProjectConfigurationPlatforms) = postSolution
+ {CB205D4D-4197-4ED8-A1FB-04918609A4F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {CB205D4D-4197-4ED8-A1FB-04918609A4F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {CB205D4D-4197-4ED8-A1FB-04918609A4F8}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {CB205D4D-4197-4ED8-A1FB-04918609A4F8}.Debug|x64.Build.0 = Debug|Any CPU
+ {CB205D4D-4197-4ED8-A1FB-04918609A4F8}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {CB205D4D-4197-4ED8-A1FB-04918609A4F8}.Debug|x86.Build.0 = Debug|Any CPU
+ {CB205D4D-4197-4ED8-A1FB-04918609A4F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {CB205D4D-4197-4ED8-A1FB-04918609A4F8}.Release|Any CPU.Build.0 = Release|Any CPU
+ {CB205D4D-4197-4ED8-A1FB-04918609A4F8}.Release|x64.ActiveCfg = Release|Any CPU
+ {CB205D4D-4197-4ED8-A1FB-04918609A4F8}.Release|x64.Build.0 = Release|Any CPU
+ {CB205D4D-4197-4ED8-A1FB-04918609A4F8}.Release|x86.ActiveCfg = Release|Any CPU
+ {CB205D4D-4197-4ED8-A1FB-04918609A4F8}.Release|x86.Build.0 = Release|Any CPU
+ {0381D9D4-14D0-43A1-A2EA-7251B89E0D5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0381D9D4-14D0-43A1-A2EA-7251B89E0D5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0381D9D4-14D0-43A1-A2EA-7251B89E0D5F}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {0381D9D4-14D0-43A1-A2EA-7251B89E0D5F}.Debug|x64.Build.0 = Debug|Any CPU
+ {0381D9D4-14D0-43A1-A2EA-7251B89E0D5F}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {0381D9D4-14D0-43A1-A2EA-7251B89E0D5F}.Debug|x86.Build.0 = Debug|Any CPU
+ {0381D9D4-14D0-43A1-A2EA-7251B89E0D5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0381D9D4-14D0-43A1-A2EA-7251B89E0D5F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {0381D9D4-14D0-43A1-A2EA-7251B89E0D5F}.Release|x64.ActiveCfg = Release|Any CPU
+ {0381D9D4-14D0-43A1-A2EA-7251B89E0D5F}.Release|x64.Build.0 = Release|Any CPU
+ {0381D9D4-14D0-43A1-A2EA-7251B89E0D5F}.Release|x86.ActiveCfg = Release|Any CPU
+ {0381D9D4-14D0-43A1-A2EA-7251B89E0D5F}.Release|x86.Build.0 = Release|Any CPU
+ {37B0DEA0-ABBF-4B9B-A383-840D7D9E481D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {37B0DEA0-ABBF-4B9B-A383-840D7D9E481D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {37B0DEA0-ABBF-4B9B-A383-840D7D9E481D}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {37B0DEA0-ABBF-4B9B-A383-840D7D9E481D}.Debug|x64.Build.0 = Debug|Any CPU
+ {37B0DEA0-ABBF-4B9B-A383-840D7D9E481D}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {37B0DEA0-ABBF-4B9B-A383-840D7D9E481D}.Debug|x86.Build.0 = Debug|Any CPU
+ {37B0DEA0-ABBF-4B9B-A383-840D7D9E481D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {37B0DEA0-ABBF-4B9B-A383-840D7D9E481D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {37B0DEA0-ABBF-4B9B-A383-840D7D9E481D}.Release|x64.ActiveCfg = Release|Any CPU
+ {37B0DEA0-ABBF-4B9B-A383-840D7D9E481D}.Release|x64.Build.0 = Release|Any CPU
+ {37B0DEA0-ABBF-4B9B-A383-840D7D9E481D}.Release|x86.ActiveCfg = Release|Any CPU
+ {37B0DEA0-ABBF-4B9B-A383-840D7D9E481D}.Release|x86.Build.0 = Release|Any CPU
+ EndGlobalSection
+EndGlobal
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/CHANGELOG.md b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/CHANGELOG.md
new file mode 100644
index 000000000000..23f86d1e896e
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/CHANGELOG.md
@@ -0,0 +1,17 @@
+# Release History
+
+## 1.0.0-beta.1 (Unreleased)
+
+### General New Features
+
+This package follows the [new Azure SDK guidelines](https://azure.github.io/azure-sdk/general_introduction.html), and provides many core capabilities:
+
+ - Support MSAL.NET, Azure.Identity is out of box for supporting MSAL.NET.
+ - Support [OpenTelemetry](https://opentelemetry.io/) for distributed tracing.
+ - HTTP pipeline with custom policies.
+ - Better error-handling.
+ - Support uniform telemetry across all languages.
+
+This package is a Public Preview version, so expect incompatible changes in subsequent releases as we improve the product. To provide feedback, submit an issue in our [Azure SDK for .NET GitHub repo](https://github.com/Azure/azure-sdk-for-net/issues).
+
+> NOTE: For more information about unified authentication, please refer to [Microsoft Azure Identity documentation for .NET](https://docs.microsoft.com//dotnet/api/overview/azure/identity-readme?view=azure-dotnet).
\ No newline at end of file
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/Directory.Build.props b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/Directory.Build.props
new file mode 100644
index 000000000000..1a9611bd4924
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/Directory.Build.props
@@ -0,0 +1,6 @@
+
+
+
+
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/README.md b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/README.md
new file mode 100644
index 000000000000..79491687cfa9
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/README.md
@@ -0,0 +1,80 @@
+# Microsoft Azure cognitivesearch management client library for .NET
+
+**[Describe the service briefly first.]**
+
+This library follows the [new Azure SDK guidelines](https://azure.github.io/azure-sdk/general_introduction.html), and provides many core capabilities:
+
+ - Support MSAL.NET, Azure.Identity is out of box for supporting MSAL.NET.
+ - Support [OpenTelemetry](https://opentelemetry.io/) for distributed tracing.
+ - HTTP pipeline with custom policies.
+ - Better error-handling.
+ - Support uniform telemetry across all languages.
+
+## Getting started
+
+### Install the package
+
+Install the Microsoft Azure cognitivesearch management library for .NET with [NuGet](https://www.nuget.org/):
+
+```dotnetcli
+dotnet add package Azure.ResourceManager.Cognitivesearch --prerelease
+```
+
+### Prerequisites
+
+* You must have an [Microsoft Azure subscription](https://azure.microsoft.com/free/dotnet/).
+
+### Authenticate the Client
+
+To create an authenticated client and start interacting with Microsoft Azure resources, see the [quickstart guide here](https://github.com/Azure/azure-sdk-for-net/blob/main/doc/dev/mgmt_quickstart.md).
+
+## Key concepts
+
+Key concepts of the Microsoft Azure SDK for .NET can be found [here](https://azure.github.io/azure-sdk/dotnet_introduction.html)
+
+## Documentation
+
+Documentation is available to help you learn how to use this package:
+
+- [Quickstart](https://github.com/Azure/azure-sdk-for-net/blob/main/doc/dev/mgmt_quickstart.md).
+- [API References](https://docs.microsoft.com/dotnet/api/?view=azure-dotnet).
+- [Authentication](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/README.md).
+
+## Examples
+
+Code samples for using the management library for .NET can be found in the following locations
+- [.NET Management Library Code Samples](https://aka.ms/azuresdk-net-mgmt-samples)
+
+## Troubleshooting
+
+- File an issue via [GitHub Issues](https://github.com/Azure/azure-sdk-for-net/issues).
+- Check [previous questions](https://stackoverflow.com/questions/tagged/azure+.net) or ask new ones on Stack Overflow using Azure and .NET tags.
+
+## Next steps
+
+For more information about Microsoft Azure SDK, see [this website](https://azure.github.io/azure-sdk/).
+
+## Contributing
+
+For details on contributing to this repository, see the [contributing
+guide][cg].
+
+This project welcomes contributions and suggestions. Most contributions
+require you to agree to a Contributor License Agreement (CLA) declaring
+that you have the right to, and actually do, grant us the rights to use
+your contribution. For details, visit .
+
+When you submit a pull request, a CLA-bot will automatically determine
+whether you need to provide a CLA and decorate the PR appropriately
+(for example, label, comment). Follow the instructions provided by the
+bot. You'll only need to do this action once across all repositories
+using our CLA.
+
+This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For
+more information, see the [Code of Conduct FAQ][coc_faq] or contact
+ with any other questions or comments.
+
+
+[cg]: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/resourcemanager/Azure.ResourceManager/docs/CONTRIBUTING.md
+[coc]: https://opensource.microsoft.com/codeofconduct/
+[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
\ No newline at end of file
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/api/Azure.ResourceManager.Cognitivesearch.netstandard2.0.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/api/Azure.ResourceManager.Cognitivesearch.netstandard2.0.cs
new file mode 100644
index 000000000000..83558eff8acc
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/api/Azure.ResourceManager.Cognitivesearch.netstandard2.0.cs
@@ -0,0 +1,118 @@
+namespace Azure.ResourceManager.Cognitivesearch
+{
+ public static partial class CognitivesearchExtensions
+ {
+ public static Azure.Response GetIndex(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public static System.Threading.Tasks.Task> GetIndexAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public static Azure.ResourceManager.Cognitivesearch.IndexResource GetIndexResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; }
+ public static Azure.ResourceManager.Cognitivesearch.IndexCollection GetIndices(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; }
+ public static Azure.Pageable GetIndices(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public static Azure.AsyncPageable GetIndicesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ }
+ public partial class IndexCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable
+ {
+ protected IndexCollection() { }
+ public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string name, Azure.ResourceManager.Cognitivesearch.IndexData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string name, Azure.ResourceManager.Cognitivesearch.IndexData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.Response Exists(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual System.Threading.Tasks.Task> ExistsAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.Response Get(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual System.Threading.Tasks.Task> GetAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; }
+ System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; }
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
+ }
+ public partial class IndexData : Azure.ResourceManager.Models.TrackedResourceData
+ {
+ public IndexData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { }
+ public string Endpoint { get { throw null; } }
+ public Azure.ResourceManager.Cognitivesearch.Models.Capacity IndexingCapacity { get { throw null; } set { } }
+ public Azure.ResourceManager.Cognitivesearch.Models.ProvisioningState? ProvisioningState { get { throw null; } }
+ public Azure.ResourceManager.Cognitivesearch.Models.Capacity QueryCapacity { get { throw null; } set { } }
+ }
+ public partial class IndexResource : Azure.ResourceManager.ArmResource
+ {
+ public static readonly Azure.Core.ResourceType ResourceType;
+ protected IndexResource() { }
+ public virtual Azure.ResourceManager.Cognitivesearch.IndexData Data { get { throw null; } }
+ public virtual bool HasData { get { throw null; } }
+ public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { throw null; }
+ public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.Cognitivesearch.Models.IndexPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Cognitivesearch.Models.IndexPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ }
+}
+namespace Azure.ResourceManager.Cognitivesearch.Models
+{
+ public static partial class ArmCognitivesearchModelFactory
+ {
+ public static Azure.ResourceManager.Cognitivesearch.IndexData IndexData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.Cognitivesearch.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.Cognitivesearch.Models.ProvisioningState?), string endpoint = null, Azure.ResourceManager.Cognitivesearch.Models.Capacity queryCapacity = null, Azure.ResourceManager.Cognitivesearch.Models.Capacity indexingCapacity = null) { throw null; }
+ }
+ public partial class Capacity
+ {
+ public Capacity(float minVCores, float maxVCores, Azure.ResourceManager.Cognitivesearch.Models.Pause autoPause) { }
+ public Azure.ResourceManager.Cognitivesearch.Models.Pause AutoPause { get { throw null; } set { } }
+ public float MaxVCores { get { throw null; } set { } }
+ public float MinVCores { get { throw null; } set { } }
+ }
+ public partial class CapacityUpdate
+ {
+ public CapacityUpdate() { }
+ public Azure.ResourceManager.Cognitivesearch.Models.Pause AutoPause { get { throw null; } set { } }
+ public float? MaxVCores { get { throw null; } set { } }
+ public float? MinVCores { get { throw null; } set { } }
+ }
+ public partial class DelayPause : Azure.ResourceManager.Cognitivesearch.Models.Pause
+ {
+ public DelayPause(System.TimeSpan duration) { }
+ public System.TimeSpan Duration { get { throw null; } set { } }
+ }
+ public partial class IndexPatch
+ {
+ public IndexPatch() { }
+ public Azure.ResourceManager.Cognitivesearch.Models.CapacityUpdate IndexingCapacity { get { throw null; } set { } }
+ public Azure.ResourceManager.Cognitivesearch.Models.CapacityUpdate QueryCapacity { get { throw null; } set { } }
+ public System.Collections.Generic.IDictionary Tags { get { throw null; } }
+ }
+ public partial class NonePause : Azure.ResourceManager.Cognitivesearch.Models.Pause
+ {
+ public NonePause() { }
+ }
+ public abstract partial class Pause
+ {
+ protected Pause() { }
+ }
+ [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
+ public readonly partial struct ProvisioningState : System.IEquatable
+ {
+ private readonly object _dummy;
+ private readonly int _dummyPrimitive;
+ public ProvisioningState(string value) { throw null; }
+ public static Azure.ResourceManager.Cognitivesearch.Models.ProvisioningState Accepted { get { throw null; } }
+ public static Azure.ResourceManager.Cognitivesearch.Models.ProvisioningState Canceled { get { throw null; } }
+ public static Azure.ResourceManager.Cognitivesearch.Models.ProvisioningState Deleting { get { throw null; } }
+ public static Azure.ResourceManager.Cognitivesearch.Models.ProvisioningState Failed { get { throw null; } }
+ public static Azure.ResourceManager.Cognitivesearch.Models.ProvisioningState Provisioning { get { throw null; } }
+ public static Azure.ResourceManager.Cognitivesearch.Models.ProvisioningState Succeeded { get { throw null; } }
+ public bool Equals(Azure.ResourceManager.Cognitivesearch.Models.ProvisioningState other) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override bool Equals(object obj) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override int GetHashCode() { throw null; }
+ public static bool operator ==(Azure.ResourceManager.Cognitivesearch.Models.ProvisioningState left, Azure.ResourceManager.Cognitivesearch.Models.ProvisioningState right) { throw null; }
+ public static implicit operator Azure.ResourceManager.Cognitivesearch.Models.ProvisioningState (string value) { throw null; }
+ public static bool operator !=(Azure.ResourceManager.Cognitivesearch.Models.ProvisioningState left, Azure.ResourceManager.Cognitivesearch.Models.ProvisioningState right) { throw null; }
+ public override string ToString() { throw null; }
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/samples/Azure.ResourceManager.Cognitivesearch.Samples.csproj b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/samples/Azure.ResourceManager.Cognitivesearch.Samples.csproj
new file mode 100644
index 000000000000..82a53abf3652
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/samples/Azure.ResourceManager.Cognitivesearch.Samples.csproj
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/samples/autorest.tests.md b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/samples/autorest.tests.md
new file mode 100644
index 000000000000..262fa8673096
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/samples/autorest.tests.md
@@ -0,0 +1,13 @@
+# Generated code configuration
+
+Run `dotnet build /t:GenerateTests` to generate code.
+
+# Azure.ResourceManager.cognitivesearch.Tests
+
+> see https://aka.ms/autorest
+``` yaml
+require: ../src/autorest.md
+include-x-ms-examples-original-file: true
+testgen:
+ sample: true
+```
\ No newline at end of file
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Azure.ResourceManager.Cognitivesearch.csproj b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Azure.ResourceManager.Cognitivesearch.csproj
new file mode 100644
index 000000000000..8a7291b04681
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Azure.ResourceManager.Cognitivesearch.csproj
@@ -0,0 +1,8 @@
+
+
+ 1.0.0-beta.1
+ Azure.ResourceManager.Cognitivesearch
+ Azure Resource Manager client SDK for Azure resource provider cognitivesearch.
+ azure;management;arm;resource manager;cognitivesearch
+
+
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/ArmCognitivesearchModelFactory.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/ArmCognitivesearchModelFactory.cs
new file mode 100644
index 000000000000..578aae080348
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/ArmCognitivesearchModelFactory.cs
@@ -0,0 +1,38 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using Azure.Core;
+using Azure.ResourceManager.Cognitivesearch;
+using Azure.ResourceManager.Models;
+
+namespace Azure.ResourceManager.Cognitivesearch.Models
+{
+ /// Model factory for models.
+ public static partial class ArmCognitivesearchModelFactory
+ {
+ /// Initializes a new instance of IndexData.
+ /// The id.
+ /// The name.
+ /// The resourceType.
+ /// The systemData.
+ /// The tags.
+ /// The location.
+ /// The current provisioning state of the index.
+ /// The endpoint at which the index can be accessed.
+ /// The capacity allocated to the index for querying.
+ /// The capacity allocated to the index for indexing documents.
+ /// A new instance for mocking.
+ public static IndexData IndexData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ProvisioningState? provisioningState = null, string endpoint = null, Capacity queryCapacity = null, Capacity indexingCapacity = null)
+ {
+ tags ??= new Dictionary();
+
+ return new IndexData(id, name, resourceType, systemData, tags, location, provisioningState, endpoint, queryCapacity, indexingCapacity);
+ }
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Extensions/CognitivesearchExtensions.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Extensions/CognitivesearchExtensions.cs
new file mode 100644
index 000000000000..f67dfe7d9111
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Extensions/CognitivesearchExtensions.cs
@@ -0,0 +1,169 @@
+// 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.ResourceManager;
+using Azure.ResourceManager.Resources;
+
+namespace Azure.ResourceManager.Cognitivesearch
+{
+ /// A class to add extension methods to Azure.ResourceManager.Cognitivesearch.
+ public static partial class CognitivesearchExtensions
+ {
+ private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource)
+ {
+ return resource.GetCachedClient(client =>
+ {
+ return new ResourceGroupResourceExtensionClient(client, resource.Id);
+ });
+ }
+
+ private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope)
+ {
+ return client.GetResourceClient(() =>
+ {
+ return new ResourceGroupResourceExtensionClient(client, scope);
+ });
+ }
+
+ private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource)
+ {
+ return resource.GetCachedClient(client =>
+ {
+ return new SubscriptionResourceExtensionClient(client, resource.Id);
+ });
+ }
+
+ private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope)
+ {
+ return client.GetResourceClient(() =>
+ {
+ return new SubscriptionResourceExtensionClient(client, scope);
+ });
+ }
+ #region IndexResource
+ ///
+ /// Gets an object representing an along with the instance operations that can be performed on it but with no data.
+ /// You can use to create an from its components.
+ ///
+ /// The instance the method will execute against.
+ /// The resource ID of the resource to get.
+ /// Returns a object.
+ public static IndexResource GetIndexResource(this ArmClient client, ResourceIdentifier id)
+ {
+ return client.GetResourceClient(() =>
+ {
+ IndexResource.ValidateResourceId(id);
+ return new IndexResource(client, id);
+ }
+ );
+ }
+ #endregion
+
+ /// Gets a collection of IndexResources in the ResourceGroupResource.
+ /// The instance the method will execute against.
+ /// An object representing collection of IndexResources and their operations over a IndexResource.
+ public static IndexCollection GetIndices(this ResourceGroupResource resourceGroupResource)
+ {
+ return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetIndices();
+ }
+
+ ///
+ /// Get a Index
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveSearch/indexes/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// IndexOperations_Get
+ ///
+ ///
+ ///
+ /// The instance the method will execute against.
+ /// The name of the index resource.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ [ForwardsClientCalls]
+ public static async Task> GetIndexAsync(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default)
+ {
+ return await resourceGroupResource.GetIndices().GetAsync(name, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Get a Index
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveSearch/indexes/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// IndexOperations_Get
+ ///
+ ///
+ ///
+ /// The instance the method will execute against.
+ /// The name of the index resource.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ [ForwardsClientCalls]
+ public static Response GetIndex(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default)
+ {
+ return resourceGroupResource.GetIndices().Get(name, cancellationToken);
+ }
+
+ ///
+ /// List Index resources by subscription ID
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveSearch/indexes
+ ///
+ /// -
+ /// Operation Id
+ /// IndexOperations_ListBySubscription
+ ///
+ ///
+ ///
+ /// The instance the method will execute against.
+ /// The cancellation token to use.
+ /// An async collection of that may take multiple service requests to iterate over.
+ public static AsyncPageable GetIndicesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default)
+ {
+ return GetSubscriptionResourceExtensionClient(subscriptionResource).GetIndicesAsync(cancellationToken);
+ }
+
+ ///
+ /// List Index resources by subscription ID
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveSearch/indexes
+ ///
+ /// -
+ /// Operation Id
+ /// IndexOperations_ListBySubscription
+ ///
+ ///
+ ///
+ /// The instance the method will execute against.
+ /// The cancellation token to use.
+ /// A collection of that may take multiple service requests to iterate over.
+ public static Pageable GetIndices(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default)
+ {
+ return GetSubscriptionResourceExtensionClient(subscriptionResource).GetIndices(cancellationToken);
+ }
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs
new file mode 100644
index 000000000000..7aa00b3b7fea
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs
@@ -0,0 +1,41 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using Azure.Core;
+using Azure.ResourceManager;
+
+namespace Azure.ResourceManager.Cognitivesearch
+{
+ /// A class to add extension methods to ResourceGroupResource.
+ internal partial class ResourceGroupResourceExtensionClient : ArmResource
+ {
+ /// Initializes a new instance of the class for mocking.
+ protected ResourceGroupResourceExtensionClient()
+ {
+ }
+
+ /// Initializes a new instance of the class.
+ /// The client parameters to use in these operations.
+ /// The identifier of the resource that is the target of operations.
+ internal ResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id)
+ {
+ }
+
+ private string GetApiVersionOrNull(ResourceType resourceType)
+ {
+ TryGetApiVersion(resourceType, out string apiVersion);
+ return apiVersion;
+ }
+
+ /// Gets a collection of IndexResources in the ResourceGroupResource.
+ /// An object representing collection of IndexResources and their operations over a IndexResource.
+ public virtual IndexCollection GetIndices()
+ {
+ return GetCachedClient(Client => new IndexCollection(Client, Id));
+ }
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs
new file mode 100644
index 000000000000..daa5c57f4d23
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs
@@ -0,0 +1,87 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Threading;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager;
+
+namespace Azure.ResourceManager.Cognitivesearch
+{
+ /// A class to add extension methods to SubscriptionResource.
+ internal partial class SubscriptionResourceExtensionClient : ArmResource
+ {
+ private ClientDiagnostics _indexIndexOperationsClientDiagnostics;
+ private IndexRestOperations _indexIndexOperationsRestClient;
+
+ /// Initializes a new instance of the class for mocking.
+ protected SubscriptionResourceExtensionClient()
+ {
+ }
+
+ /// Initializes a new instance of the class.
+ /// The client parameters to use in these operations.
+ /// The identifier of the resource that is the target of operations.
+ internal SubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id)
+ {
+ }
+
+ private ClientDiagnostics IndexIndexOperationsClientDiagnostics => _indexIndexOperationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Cognitivesearch", IndexResource.ResourceType.Namespace, Diagnostics);
+ private IndexRestOperations IndexIndexOperationsRestClient => _indexIndexOperationsRestClient ??= new IndexRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(IndexResource.ResourceType));
+
+ private string GetApiVersionOrNull(ResourceType resourceType)
+ {
+ TryGetApiVersion(resourceType, out string apiVersion);
+ return apiVersion;
+ }
+
+ ///
+ /// List Index resources by subscription ID
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveSearch/indexes
+ ///
+ /// -
+ /// Operation Id
+ /// IndexOperations_ListBySubscription
+ ///
+ ///
+ ///
+ /// The cancellation token to use.
+ /// An async collection of that may take multiple service requests to iterate over.
+ public virtual AsyncPageable GetIndicesAsync(CancellationToken cancellationToken = default)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => IndexIndexOperationsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IndexIndexOperationsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId);
+ return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new IndexResource(Client, IndexData.DeserializeIndexData(e)), IndexIndexOperationsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetIndices", "value", "nextLink", cancellationToken);
+ }
+
+ ///
+ /// List Index resources by subscription ID
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveSearch/indexes
+ ///
+ /// -
+ /// Operation Id
+ /// IndexOperations_ListBySubscription
+ ///
+ ///
+ ///
+ /// The cancellation token to use.
+ /// A collection of that may take multiple service requests to iterate over.
+ public virtual Pageable GetIndices(CancellationToken cancellationToken = default)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => IndexIndexOperationsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IndexIndexOperationsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId);
+ return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new IndexResource(Client, IndexData.DeserializeIndexData(e)), IndexIndexOperationsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetIndices", "value", "nextLink", cancellationToken);
+ }
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/IndexCollection.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/IndexCollection.cs
new file mode 100644
index 000000000000..aa62d9954da0
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/IndexCollection.cs
@@ -0,0 +1,341 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager;
+using Azure.ResourceManager.Resources;
+
+namespace Azure.ResourceManager.Cognitivesearch
+{
+ ///
+ /// A class representing a collection of and their operations.
+ /// Each in the collection will belong to the same instance of .
+ /// To get an instance call the GetIndices method from an instance of .
+ ///
+ public partial class IndexCollection : ArmCollection, IEnumerable, IAsyncEnumerable
+ {
+ private readonly ClientDiagnostics _indexIndexOperationsClientDiagnostics;
+ private readonly IndexRestOperations _indexIndexOperationsRestClient;
+
+ /// Initializes a new instance of the class for mocking.
+ protected IndexCollection()
+ {
+ }
+
+ /// Initializes a new instance of the class.
+ /// The client parameters to use in these operations.
+ /// The identifier of the parent resource that is the target of operations.
+ internal IndexCollection(ArmClient client, ResourceIdentifier id) : base(client, id)
+ {
+ _indexIndexOperationsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Cognitivesearch", IndexResource.ResourceType.Namespace, Diagnostics);
+ TryGetApiVersion(IndexResource.ResourceType, out string indexIndexOperationsApiVersion);
+ _indexIndexOperationsRestClient = new IndexRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, indexIndexOperationsApiVersion);
+#if DEBUG
+ ValidateResourceId(Id);
+#endif
+ }
+
+ internal static void ValidateResourceId(ResourceIdentifier id)
+ {
+ if (id.ResourceType != ResourceGroupResource.ResourceType)
+ throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id));
+ }
+
+ ///
+ /// Create a Index
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveSearch/indexes/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// IndexOperations_CreateOrUpdate
+ ///
+ ///
+ ///
+ /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
+ /// The name of the index resource.
+ /// Resource create parameters.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// or is null.
+ public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string name, IndexData data, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(name, nameof(name));
+ Argument.AssertNotNull(data, nameof(data));
+
+ using var scope = _indexIndexOperationsClientDiagnostics.CreateScope("IndexCollection.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ var response = await _indexIndexOperationsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, name, data, cancellationToken).ConfigureAwait(false);
+ var operation = new CognitivesearchArmOperation(new IndexOperationSource(Client), _indexIndexOperationsClientDiagnostics, Pipeline, _indexIndexOperationsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation);
+ if (waitUntil == WaitUntil.Completed)
+ await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Create a Index
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveSearch/indexes/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// IndexOperations_CreateOrUpdate
+ ///
+ ///
+ ///
+ /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
+ /// The name of the index resource.
+ /// Resource create parameters.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// or is null.
+ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string name, IndexData data, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(name, nameof(name));
+ Argument.AssertNotNull(data, nameof(data));
+
+ using var scope = _indexIndexOperationsClientDiagnostics.CreateScope("IndexCollection.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ var response = _indexIndexOperationsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, name, data, cancellationToken);
+ var operation = new CognitivesearchArmOperation(new IndexOperationSource(Client), _indexIndexOperationsClientDiagnostics, Pipeline, _indexIndexOperationsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation);
+ if (waitUntil == WaitUntil.Completed)
+ operation.WaitForCompletion(cancellationToken);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Get a Index
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveSearch/indexes/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// IndexOperations_Get
+ ///
+ ///
+ ///
+ /// The name of the index resource.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual async Task> GetAsync(string name, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(name, nameof(name));
+
+ using var scope = _indexIndexOperationsClientDiagnostics.CreateScope("IndexCollection.Get");
+ scope.Start();
+ try
+ {
+ var response = await _indexIndexOperationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken).ConfigureAwait(false);
+ if (response.Value == null)
+ throw new RequestFailedException(response.GetRawResponse());
+ return Response.FromValue(new IndexResource(Client, response.Value), response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Get a Index
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveSearch/indexes/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// IndexOperations_Get
+ ///
+ ///
+ ///
+ /// The name of the index resource.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual Response Get(string name, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(name, nameof(name));
+
+ using var scope = _indexIndexOperationsClientDiagnostics.CreateScope("IndexCollection.Get");
+ scope.Start();
+ try
+ {
+ var response = _indexIndexOperationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken);
+ if (response.Value == null)
+ throw new RequestFailedException(response.GetRawResponse());
+ return Response.FromValue(new IndexResource(Client, response.Value), response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// List Index resources by resource group
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveSearch/indexes
+ ///
+ /// -
+ /// Operation Id
+ /// IndexOperations_ListByResourceGroup
+ ///
+ ///
+ ///
+ /// The cancellation token to use.
+ /// An async collection of that may take multiple service requests to iterate over.
+ public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => _indexIndexOperationsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _indexIndexOperationsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName);
+ return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new IndexResource(Client, IndexData.DeserializeIndexData(e)), _indexIndexOperationsClientDiagnostics, Pipeline, "IndexCollection.GetAll", "value", "nextLink", cancellationToken);
+ }
+
+ ///
+ /// List Index resources by resource group
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveSearch/indexes
+ ///
+ /// -
+ /// Operation Id
+ /// IndexOperations_ListByResourceGroup
+ ///
+ ///
+ ///
+ /// The cancellation token to use.
+ /// A collection of that may take multiple service requests to iterate over.
+ public virtual Pageable GetAll(CancellationToken cancellationToken = default)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => _indexIndexOperationsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _indexIndexOperationsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName);
+ return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new IndexResource(Client, IndexData.DeserializeIndexData(e)), _indexIndexOperationsClientDiagnostics, Pipeline, "IndexCollection.GetAll", "value", "nextLink", cancellationToken);
+ }
+
+ ///
+ /// Checks to see if the resource exists in azure.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveSearch/indexes/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// IndexOperations_Get
+ ///
+ ///
+ ///
+ /// The name of the index resource.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual async Task> ExistsAsync(string name, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(name, nameof(name));
+
+ using var scope = _indexIndexOperationsClientDiagnostics.CreateScope("IndexCollection.Exists");
+ scope.Start();
+ try
+ {
+ var response = await _indexIndexOperationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken).ConfigureAwait(false);
+ return Response.FromValue(response.Value != null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Checks to see if the resource exists in azure.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveSearch/indexes/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// IndexOperations_Get
+ ///
+ ///
+ ///
+ /// The name of the index resource.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual Response Exists(string name, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(name, nameof(name));
+
+ using var scope = _indexIndexOperationsClientDiagnostics.CreateScope("IndexCollection.Exists");
+ scope.Start();
+ try
+ {
+ var response = _indexIndexOperationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken);
+ return Response.FromValue(response.Value != null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetAll().GetEnumerator();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetAll().GetEnumerator();
+ }
+
+ IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken)
+ {
+ return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken);
+ }
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/IndexData.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/IndexData.cs
new file mode 100644
index 000000000000..5ad64a621499
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/IndexData.cs
@@ -0,0 +1,55 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Collections.Generic;
+using Azure.Core;
+using Azure.ResourceManager.Cognitivesearch.Models;
+using Azure.ResourceManager.Models;
+
+namespace Azure.ResourceManager.Cognitivesearch
+{
+ ///
+ /// A class representing the Index data model.
+ /// An index resource
+ ///
+ public partial class IndexData : TrackedResourceData
+ {
+ /// Initializes a new instance of IndexData.
+ /// The location.
+ public IndexData(AzureLocation location) : base(location)
+ {
+ }
+
+ /// Initializes a new instance of IndexData.
+ /// The id.
+ /// The name.
+ /// The resourceType.
+ /// The systemData.
+ /// The tags.
+ /// The location.
+ /// The current provisioning state of the index.
+ /// The endpoint at which the index can be accessed.
+ /// The capacity allocated to the index for querying.
+ /// The capacity allocated to the index for indexing documents.
+ internal IndexData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ProvisioningState? provisioningState, string endpoint, Capacity queryCapacity, Capacity indexingCapacity) : base(id, name, resourceType, systemData, tags, location)
+ {
+ ProvisioningState = provisioningState;
+ Endpoint = endpoint;
+ QueryCapacity = queryCapacity;
+ IndexingCapacity = indexingCapacity;
+ }
+
+ /// The current provisioning state of the index.
+ public ProvisioningState? ProvisioningState { get; }
+ /// The endpoint at which the index can be accessed.
+ public string Endpoint { get; }
+ /// The capacity allocated to the index for querying.
+ public Capacity QueryCapacity { get; set; }
+ /// The capacity allocated to the index for indexing documents.
+ public Capacity IndexingCapacity { get; set; }
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/IndexResource.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/IndexResource.cs
new file mode 100644
index 000000000000..9bd2e4f8ab22
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/IndexResource.cs
@@ -0,0 +1,610 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager;
+using Azure.ResourceManager.Cognitivesearch.Models;
+using Azure.ResourceManager.Resources;
+
+namespace Azure.ResourceManager.Cognitivesearch
+{
+ ///
+ /// A Class representing an Index along with the instance operations that can be performed on it.
+ /// If you have a you can construct an
+ /// from an instance of using the GetIndexResource method.
+ /// Otherwise you can get one from its parent resource using the GetIndex method.
+ ///
+ public partial class IndexResource : ArmResource
+ {
+ /// Generate the resource identifier of a instance.
+ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name)
+ {
+ var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveSearch/indexes/{name}";
+ return new ResourceIdentifier(resourceId);
+ }
+
+ private readonly ClientDiagnostics _indexIndexOperationsClientDiagnostics;
+ private readonly IndexRestOperations _indexIndexOperationsRestClient;
+ private readonly IndexData _data;
+
+ /// Initializes a new instance of the class for mocking.
+ protected IndexResource()
+ {
+ }
+
+ /// Initializes a new instance of the class.
+ /// The client parameters to use in these operations.
+ /// The resource that is the target of operations.
+ internal IndexResource(ArmClient client, IndexData data) : this(client, data.Id)
+ {
+ HasData = true;
+ _data = data;
+ }
+
+ /// Initializes a new instance of the class.
+ /// The client parameters to use in these operations.
+ /// The identifier of the resource that is the target of operations.
+ internal IndexResource(ArmClient client, ResourceIdentifier id) : base(client, id)
+ {
+ _indexIndexOperationsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Cognitivesearch", ResourceType.Namespace, Diagnostics);
+ TryGetApiVersion(ResourceType, out string indexIndexOperationsApiVersion);
+ _indexIndexOperationsRestClient = new IndexRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, indexIndexOperationsApiVersion);
+#if DEBUG
+ ValidateResourceId(Id);
+#endif
+ }
+
+ /// Gets the resource type for the operations.
+ public static readonly ResourceType ResourceType = "Microsoft.CognitiveSearch/indexes";
+
+ /// Gets whether or not the current instance has data.
+ public virtual bool HasData { get; }
+
+ /// Gets the data representing this Feature.
+ /// Throws if there is no data loaded in the current instance.
+ public virtual IndexData Data
+ {
+ get
+ {
+ if (!HasData)
+ throw new InvalidOperationException("The current instance does not have data, you must call Get first.");
+ return _data;
+ }
+ }
+
+ internal static void ValidateResourceId(ResourceIdentifier id)
+ {
+ if (id.ResourceType != ResourceType)
+ throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id));
+ }
+
+ ///
+ /// Get a Index
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveSearch/indexes/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// IndexOperations_Get
+ ///
+ ///
+ ///
+ /// The cancellation token to use.
+ public virtual async Task> GetAsync(CancellationToken cancellationToken = default)
+ {
+ using var scope = _indexIndexOperationsClientDiagnostics.CreateScope("IndexResource.Get");
+ scope.Start();
+ try
+ {
+ var response = await _indexIndexOperationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false);
+ if (response.Value == null)
+ throw new RequestFailedException(response.GetRawResponse());
+ return Response.FromValue(new IndexResource(Client, response.Value), response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Get a Index
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveSearch/indexes/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// IndexOperations_Get
+ ///
+ ///
+ ///
+ /// The cancellation token to use.
+ public virtual Response Get(CancellationToken cancellationToken = default)
+ {
+ using var scope = _indexIndexOperationsClientDiagnostics.CreateScope("IndexResource.Get");
+ scope.Start();
+ try
+ {
+ var response = _indexIndexOperationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken);
+ if (response.Value == null)
+ throw new RequestFailedException(response.GetRawResponse());
+ return Response.FromValue(new IndexResource(Client, response.Value), response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Delete a Index
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveSearch/indexes/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// IndexOperations_Delete
+ ///
+ ///
+ ///
+ /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
+ /// The cancellation token to use.
+ public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default)
+ {
+ using var scope = _indexIndexOperationsClientDiagnostics.CreateScope("IndexResource.Delete");
+ scope.Start();
+ try
+ {
+ var response = await _indexIndexOperationsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false);
+ var operation = new CognitivesearchArmOperation(_indexIndexOperationsClientDiagnostics, Pipeline, _indexIndexOperationsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location);
+ if (waitUntil == WaitUntil.Completed)
+ await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Delete a Index
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveSearch/indexes/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// IndexOperations_Delete
+ ///
+ ///
+ ///
+ /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
+ /// The cancellation token to use.
+ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default)
+ {
+ using var scope = _indexIndexOperationsClientDiagnostics.CreateScope("IndexResource.Delete");
+ scope.Start();
+ try
+ {
+ var response = _indexIndexOperationsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken);
+ var operation = new CognitivesearchArmOperation(_indexIndexOperationsClientDiagnostics, Pipeline, _indexIndexOperationsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location);
+ if (waitUntil == WaitUntil.Completed)
+ operation.WaitForCompletionResponse(cancellationToken);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Update a Index
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveSearch/indexes/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// IndexOperations_Update
+ ///
+ ///
+ ///
+ /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
+ /// The resource properties to be updated.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual async Task> UpdateAsync(WaitUntil waitUntil, IndexPatch patch, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(patch, nameof(patch));
+
+ using var scope = _indexIndexOperationsClientDiagnostics.CreateScope("IndexResource.Update");
+ scope.Start();
+ try
+ {
+ var response = await _indexIndexOperationsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false);
+ var operation = new CognitivesearchArmOperation(new IndexOperationSource(Client), _indexIndexOperationsClientDiagnostics, Pipeline, _indexIndexOperationsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location);
+ if (waitUntil == WaitUntil.Completed)
+ await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Update a Index
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveSearch/indexes/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// IndexOperations_Update
+ ///
+ ///
+ ///
+ /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
+ /// The resource properties to be updated.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual ArmOperation Update(WaitUntil waitUntil, IndexPatch patch, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(patch, nameof(patch));
+
+ using var scope = _indexIndexOperationsClientDiagnostics.CreateScope("IndexResource.Update");
+ scope.Start();
+ try
+ {
+ var response = _indexIndexOperationsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken);
+ var operation = new CognitivesearchArmOperation(new IndexOperationSource(Client), _indexIndexOperationsClientDiagnostics, Pipeline, _indexIndexOperationsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location);
+ if (waitUntil == WaitUntil.Completed)
+ operation.WaitForCompletion(cancellationToken);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Add a tag to the current resource.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveSearch/indexes/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// IndexOperations_Get
+ ///
+ ///
+ ///
+ /// The key for the tag.
+ /// The value for the tag.
+ /// The cancellation token to use.
+ /// or is null.
+ public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(key, nameof(key));
+ Argument.AssertNotNull(value, nameof(value));
+
+ using var scope = _indexIndexOperationsClientDiagnostics.CreateScope("IndexResource.AddTag");
+ scope.Start();
+ try
+ {
+ if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false))
+ {
+ var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false);
+ originalTags.Value.Data.TagValues[key] = value;
+ await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false);
+ var originalResponse = await _indexIndexOperationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false);
+ return Response.FromValue(new IndexResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
+ }
+ else
+ {
+ var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data;
+ var patch = new IndexPatch();
+ foreach (var tag in current.Tags)
+ {
+ patch.Tags.Add(tag);
+ }
+ patch.Tags[key] = value;
+ var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false);
+ return Response.FromValue(result.Value, result.GetRawResponse());
+ }
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Add a tag to the current resource.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveSearch/indexes/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// IndexOperations_Get
+ ///
+ ///
+ ///
+ /// The key for the tag.
+ /// The value for the tag.
+ /// The cancellation token to use.
+ /// or is null.
+ public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(key, nameof(key));
+ Argument.AssertNotNull(value, nameof(value));
+
+ using var scope = _indexIndexOperationsClientDiagnostics.CreateScope("IndexResource.AddTag");
+ scope.Start();
+ try
+ {
+ if (CanUseTagResource(cancellationToken: cancellationToken))
+ {
+ var originalTags = GetTagResource().Get(cancellationToken);
+ originalTags.Value.Data.TagValues[key] = value;
+ GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken);
+ var originalResponse = _indexIndexOperationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken);
+ return Response.FromValue(new IndexResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
+ }
+ else
+ {
+ var current = Get(cancellationToken: cancellationToken).Value.Data;
+ var patch = new IndexPatch();
+ foreach (var tag in current.Tags)
+ {
+ patch.Tags.Add(tag);
+ }
+ patch.Tags[key] = value;
+ var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken);
+ return Response.FromValue(result.Value, result.GetRawResponse());
+ }
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Replace the tags on the resource with the given set.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveSearch/indexes/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// IndexOperations_Get
+ ///
+ ///
+ ///
+ /// The set of tags to use as replacement.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(tags, nameof(tags));
+
+ using var scope = _indexIndexOperationsClientDiagnostics.CreateScope("IndexResource.SetTags");
+ scope.Start();
+ try
+ {
+ if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false))
+ {
+ await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false);
+ var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false);
+ originalTags.Value.Data.TagValues.ReplaceWith(tags);
+ await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false);
+ var originalResponse = await _indexIndexOperationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false);
+ return Response.FromValue(new IndexResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
+ }
+ else
+ {
+ var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data;
+ var patch = new IndexPatch();
+ patch.Tags.ReplaceWith(tags);
+ var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false);
+ return Response.FromValue(result.Value, result.GetRawResponse());
+ }
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Replace the tags on the resource with the given set.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveSearch/indexes/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// IndexOperations_Get
+ ///
+ ///
+ ///
+ /// The set of tags to use as replacement.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(tags, nameof(tags));
+
+ using var scope = _indexIndexOperationsClientDiagnostics.CreateScope("IndexResource.SetTags");
+ scope.Start();
+ try
+ {
+ if (CanUseTagResource(cancellationToken: cancellationToken))
+ {
+ GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken);
+ var originalTags = GetTagResource().Get(cancellationToken);
+ originalTags.Value.Data.TagValues.ReplaceWith(tags);
+ GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken);
+ var originalResponse = _indexIndexOperationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken);
+ return Response.FromValue(new IndexResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
+ }
+ else
+ {
+ var current = Get(cancellationToken: cancellationToken).Value.Data;
+ var patch = new IndexPatch();
+ patch.Tags.ReplaceWith(tags);
+ var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken);
+ return Response.FromValue(result.Value, result.GetRawResponse());
+ }
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Removes a tag by key from the resource.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveSearch/indexes/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// IndexOperations_Get
+ ///
+ ///
+ ///
+ /// The key for the tag.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(key, nameof(key));
+
+ using var scope = _indexIndexOperationsClientDiagnostics.CreateScope("IndexResource.RemoveTag");
+ scope.Start();
+ try
+ {
+ if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false))
+ {
+ var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false);
+ originalTags.Value.Data.TagValues.Remove(key);
+ await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false);
+ var originalResponse = await _indexIndexOperationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false);
+ return Response.FromValue(new IndexResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
+ }
+ else
+ {
+ var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data;
+ var patch = new IndexPatch();
+ foreach (var tag in current.Tags)
+ {
+ patch.Tags.Add(tag);
+ }
+ patch.Tags.Remove(key);
+ var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false);
+ return Response.FromValue(result.Value, result.GetRawResponse());
+ }
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Removes a tag by key from the resource.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveSearch/indexes/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// IndexOperations_Get
+ ///
+ ///
+ ///
+ /// The key for the tag.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(key, nameof(key));
+
+ using var scope = _indexIndexOperationsClientDiagnostics.CreateScope("IndexResource.RemoveTag");
+ scope.Start();
+ try
+ {
+ if (CanUseTagResource(cancellationToken: cancellationToken))
+ {
+ var originalTags = GetTagResource().Get(cancellationToken);
+ originalTags.Value.Data.TagValues.Remove(key);
+ GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken);
+ var originalResponse = _indexIndexOperationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken);
+ return Response.FromValue(new IndexResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
+ }
+ else
+ {
+ var current = Get(cancellationToken: cancellationToken).Value.Data;
+ var patch = new IndexPatch();
+ foreach (var tag in current.Tags)
+ {
+ patch.Tags.Add(tag);
+ }
+ patch.Tags.Remove(key);
+ var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken);
+ return Response.FromValue(result.Value, result.GetRawResponse());
+ }
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/LongRunningOperation/CognitivesearchArmOperation.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/LongRunningOperation/CognitivesearchArmOperation.cs
new file mode 100644
index 000000000000..afc887870aac
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/LongRunningOperation/CognitivesearchArmOperation.cs
@@ -0,0 +1,70 @@
+// 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;
+
+namespace Azure.ResourceManager.Cognitivesearch
+{
+#pragma warning disable SA1649 // File name should match first type name
+ internal class CognitivesearchArmOperation : ArmOperation
+#pragma warning restore SA1649 // File name should match first type name
+ {
+ private readonly OperationInternal _operation;
+
+ /// Initializes a new instance of CognitivesearchArmOperation for mocking.
+ protected CognitivesearchArmOperation()
+ {
+ }
+
+ internal CognitivesearchArmOperation(Response response)
+ {
+ _operation = OperationInternal.Succeeded(response);
+ }
+
+ internal CognitivesearchArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia)
+ {
+ var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia);
+ _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "CognitivesearchArmOperation", fallbackStrategy: new SequentialDelayStrategy());
+ }
+
+ ///
+#pragma warning disable CA1822
+ [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
+ public override string Id => throw new NotImplementedException();
+#pragma warning restore CA1822
+
+ ///
+ public override bool HasCompleted => _operation.HasCompleted;
+
+ ///
+ public override Response GetRawResponse() => _operation.RawResponse;
+
+ ///
+ public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken);
+
+ ///
+ public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken);
+
+ ///
+ public override Response WaitForCompletionResponse(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(cancellationToken);
+
+ ///
+ public override Response WaitForCompletionResponse(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(pollingInterval, cancellationToken);
+
+ ///
+ public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken);
+
+ ///
+ public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken);
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/LongRunningOperation/CognitivesearchArmOperationOfT.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/LongRunningOperation/CognitivesearchArmOperationOfT.cs
new file mode 100644
index 000000000000..63d861151608
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/LongRunningOperation/CognitivesearchArmOperationOfT.cs
@@ -0,0 +1,76 @@
+// 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;
+
+namespace Azure.ResourceManager.Cognitivesearch
+{
+#pragma warning disable SA1649 // File name should match first type name
+ internal class CognitivesearchArmOperation : ArmOperation
+#pragma warning restore SA1649 // File name should match first type name
+ {
+ private readonly OperationInternal _operation;
+
+ /// Initializes a new instance of CognitivesearchArmOperation for mocking.
+ protected CognitivesearchArmOperation()
+ {
+ }
+
+ internal CognitivesearchArmOperation(Response response)
+ {
+ _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value);
+ }
+
+ internal CognitivesearchArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia)
+ {
+ var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia);
+ _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "CognitivesearchArmOperation", fallbackStrategy: new SequentialDelayStrategy());
+ }
+
+ ///
+#pragma warning disable CA1822
+ [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
+ public override string Id => throw new NotImplementedException();
+#pragma warning restore CA1822
+
+ ///
+ public override T Value => _operation.Value;
+
+ ///
+ public override bool HasValue => _operation.HasValue;
+
+ ///
+ public override bool HasCompleted => _operation.HasCompleted;
+
+ ///
+ public override Response GetRawResponse() => _operation.RawResponse;
+
+ ///
+ public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken);
+
+ ///
+ public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken);
+
+ ///
+ public override Response WaitForCompletion(CancellationToken cancellationToken = default) => _operation.WaitForCompletion(cancellationToken);
+
+ ///
+ public override Response WaitForCompletion(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletion(pollingInterval, cancellationToken);
+
+ ///
+ public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken);
+
+ ///
+ public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken);
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/LongRunningOperation/IndexOperationSource.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/LongRunningOperation/IndexOperationSource.cs
new file mode 100644
index 000000000000..169d0cc9c3d9
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/LongRunningOperation/IndexOperationSource.cs
@@ -0,0 +1,40 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.ResourceManager;
+
+namespace Azure.ResourceManager.Cognitivesearch
+{
+ internal class IndexOperationSource : IOperationSource
+ {
+ private readonly ArmClient _client;
+
+ internal IndexOperationSource(ArmClient client)
+ {
+ _client = client;
+ }
+
+ IndexResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken)
+ {
+ using var document = JsonDocument.Parse(response.ContentStream);
+ var data = IndexData.DeserializeIndexData(document.RootElement);
+ return new IndexResource(_client, data);
+ }
+
+ async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken)
+ {
+ using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ var data = IndexData.DeserializeIndexData(document.RootElement);
+ return new IndexResource(_client, data);
+ }
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/Capacity.Serialization.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/Capacity.Serialization.cs
new file mode 100644
index 000000000000..15b0239bcceb
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/Capacity.Serialization.cs
@@ -0,0 +1,57 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.ResourceManager.Cognitivesearch.Models
+{
+ public partial class Capacity : IUtf8JsonSerializable
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
+ {
+ writer.WriteStartObject();
+ writer.WritePropertyName("minVCores"u8);
+ writer.WriteNumberValue(MinVCores);
+ writer.WritePropertyName("maxVCores"u8);
+ writer.WriteNumberValue(MaxVCores);
+ writer.WritePropertyName("autoPause"u8);
+ writer.WriteObjectValue(AutoPause);
+ writer.WriteEndObject();
+ }
+
+ internal static Capacity DeserializeCapacity(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ float minVCores = default;
+ float maxVCores = default;
+ Pause autoPause = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("minVCores"u8))
+ {
+ minVCores = property.Value.GetSingle();
+ continue;
+ }
+ if (property.NameEquals("maxVCores"u8))
+ {
+ maxVCores = property.Value.GetSingle();
+ continue;
+ }
+ if (property.NameEquals("autoPause"u8))
+ {
+ autoPause = Pause.DeserializePause(property.Value);
+ continue;
+ }
+ }
+ return new Capacity(minVCores, maxVCores, autoPause);
+ }
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/Capacity.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/Capacity.cs
new file mode 100644
index 000000000000..744cf9b7f844
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/Capacity.cs
@@ -0,0 +1,45 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure.Core;
+
+namespace Azure.ResourceManager.Cognitivesearch.Models
+{
+ /// The capacity will autoscale between the minimum and maximum number of vCores based on the usage of your index.
+ public partial class Capacity
+ {
+ /// Initializes a new instance of Capacity.
+ /// The minimum number of vCores that the index will consume. Represented with discrete values: 0.2, 0.5. 1, 2, 3, … to 16.
+ /// The maximum number of vCores that the index can consume. Represented with discrete values: 0.2, 0.5. 1, 2, 3, … to 16.
+ ///
+ /// Pausing strategy for the index
+ /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
+ /// The available derived classes include and .
+ ///
+ /// is null.
+ public Capacity(float minVCores, float maxVCores, Pause autoPause)
+ {
+ Argument.AssertNotNull(autoPause, nameof(autoPause));
+
+ MinVCores = minVCores;
+ MaxVCores = maxVCores;
+ AutoPause = autoPause;
+ }
+
+ /// The minimum number of vCores that the index will consume. Represented with discrete values: 0.2, 0.5. 1, 2, 3, … to 16.
+ public float MinVCores { get; set; }
+ /// The maximum number of vCores that the index can consume. Represented with discrete values: 0.2, 0.5. 1, 2, 3, … to 16.
+ public float MaxVCores { get; set; }
+ ///
+ /// Pausing strategy for the index
+ /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
+ /// The available derived classes include and .
+ ///
+ public Pause AutoPause { get; set; }
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/CapacityUpdate.Serialization.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/CapacityUpdate.Serialization.cs
new file mode 100644
index 000000000000..8cfbbce63368
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/CapacityUpdate.Serialization.cs
@@ -0,0 +1,36 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.ResourceManager.Cognitivesearch.Models
+{
+ public partial class CapacityUpdate : IUtf8JsonSerializable
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
+ {
+ writer.WriteStartObject();
+ if (Optional.IsDefined(MinVCores))
+ {
+ writer.WritePropertyName("minVCores"u8);
+ writer.WriteNumberValue(MinVCores.Value);
+ }
+ if (Optional.IsDefined(MaxVCores))
+ {
+ writer.WritePropertyName("maxVCores"u8);
+ writer.WriteNumberValue(MaxVCores.Value);
+ }
+ if (Optional.IsDefined(AutoPause))
+ {
+ writer.WritePropertyName("autoPause"u8);
+ writer.WriteObjectValue(AutoPause);
+ }
+ writer.WriteEndObject();
+ }
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/CapacityUpdate.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/CapacityUpdate.cs
new file mode 100644
index 000000000000..8a719ae062b1
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/CapacityUpdate.cs
@@ -0,0 +1,29 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+namespace Azure.ResourceManager.Cognitivesearch.Models
+{
+ /// The capacity will autoscale between the minimum and maximum number of vCores based on the usage of your index.
+ public partial class CapacityUpdate
+ {
+ /// Initializes a new instance of CapacityUpdate.
+ public CapacityUpdate()
+ {
+ }
+
+ /// The minimum number of vCores that the index will consume. Represented with discrete values: 0.2, 0.5. 1, 2, 3, … to 16.
+ public float? MinVCores { get; set; }
+ /// The maximum number of vCores that the index can consume. Represented with discrete values: 0.2, 0.5. 1, 2, 3, … to 16.
+ public float? MaxVCores { get; set; }
+ ///
+ /// Pausing strategy for the index
+ /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
+ /// The available derived classes include and .
+ ///
+ public Pause AutoPause { get; set; }
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/DelayPause.Serialization.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/DelayPause.Serialization.cs
new file mode 100644
index 000000000000..f058bc64a8a4
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/DelayPause.Serialization.cs
@@ -0,0 +1,50 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.ResourceManager.Cognitivesearch.Models
+{
+ public partial class DelayPause : IUtf8JsonSerializable
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
+ {
+ writer.WriteStartObject();
+ writer.WritePropertyName("duration"u8);
+ writer.WriteStringValue(Duration, "P");
+ writer.WritePropertyName("type"u8);
+ writer.WriteStringValue(PauseType);
+ writer.WriteEndObject();
+ }
+
+ internal static DelayPause DeserializeDelayPause(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ TimeSpan duration = default;
+ string type = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("duration"u8))
+ {
+ duration = property.Value.GetTimeSpan("P");
+ continue;
+ }
+ if (property.NameEquals("type"u8))
+ {
+ type = property.Value.GetString();
+ continue;
+ }
+ }
+ return new DelayPause(type, duration);
+ }
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/DelayPause.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/DelayPause.cs
new file mode 100644
index 000000000000..8ef91df72388
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/DelayPause.cs
@@ -0,0 +1,35 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+
+namespace Azure.ResourceManager.Cognitivesearch.Models
+{
+ /// When the pause strategy is set to 'Delay', the index will enter a paused state after not being used for a fixed amount of time.
+ public partial class DelayPause : Pause
+ {
+ /// Initializes a new instance of DelayPause.
+ /// The interval after which an index is paused if not in use.
+ public DelayPause(TimeSpan duration)
+ {
+ Duration = duration;
+ PauseType = "Delay";
+ }
+
+ /// Initializes a new instance of DelayPause.
+ /// Discriminator property for Pause.
+ /// The interval after which an index is paused if not in use.
+ internal DelayPause(string pauseType, TimeSpan duration) : base(pauseType)
+ {
+ Duration = duration;
+ PauseType = pauseType ?? "Delay";
+ }
+
+ /// The interval after which an index is paused if not in use.
+ public TimeSpan Duration { get; set; }
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/IndexData.Serialization.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/IndexData.Serialization.cs
new file mode 100644
index 000000000000..d4348b9545ba
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/IndexData.Serialization.cs
@@ -0,0 +1,159 @@
+// 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;
+using Azure.ResourceManager.Cognitivesearch.Models;
+using Azure.ResourceManager.Models;
+
+namespace Azure.ResourceManager.Cognitivesearch
+{
+ public partial class IndexData : IUtf8JsonSerializable
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
+ {
+ writer.WriteStartObject();
+ if (Optional.IsCollectionDefined(Tags))
+ {
+ writer.WritePropertyName("tags"u8);
+ writer.WriteStartObject();
+ foreach (var item in Tags)
+ {
+ writer.WritePropertyName(item.Key);
+ writer.WriteStringValue(item.Value);
+ }
+ writer.WriteEndObject();
+ }
+ writer.WritePropertyName("location"u8);
+ writer.WriteStringValue(Location);
+ writer.WritePropertyName("properties"u8);
+ writer.WriteStartObject();
+ if (Optional.IsDefined(QueryCapacity))
+ {
+ writer.WritePropertyName("queryCapacity"u8);
+ writer.WriteObjectValue(QueryCapacity);
+ }
+ if (Optional.IsDefined(IndexingCapacity))
+ {
+ writer.WritePropertyName("indexingCapacity"u8);
+ writer.WriteObjectValue(IndexingCapacity);
+ }
+ writer.WriteEndObject();
+ writer.WriteEndObject();
+ }
+
+ internal static IndexData DeserializeIndexData(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ Optional> tags = default;
+ AzureLocation location = default;
+ ResourceIdentifier id = default;
+ string name = default;
+ ResourceType type = default;
+ Optional systemData = default;
+ Optional provisioningState = default;
+ Optional endpoint = default;
+ Optional queryCapacity = default;
+ Optional indexingCapacity = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("tags"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ Dictionary dictionary = new Dictionary();
+ foreach (var property0 in property.Value.EnumerateObject())
+ {
+ dictionary.Add(property0.Name, property0.Value.GetString());
+ }
+ tags = dictionary;
+ continue;
+ }
+ if (property.NameEquals("location"u8))
+ {
+ location = new AzureLocation(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("id"u8))
+ {
+ id = new ResourceIdentifier(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("name"u8))
+ {
+ name = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("type"u8))
+ {
+ type = new ResourceType(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("systemData"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ systemData = JsonSerializer.Deserialize(property.Value.GetRawText());
+ continue;
+ }
+ if (property.NameEquals("properties"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ property.ThrowNonNullablePropertyIsNull();
+ continue;
+ }
+ foreach (var property0 in property.Value.EnumerateObject())
+ {
+ if (property0.NameEquals("provisioningState"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ provisioningState = new ProvisioningState(property0.Value.GetString());
+ continue;
+ }
+ if (property0.NameEquals("endpoint"u8))
+ {
+ endpoint = property0.Value.GetString();
+ continue;
+ }
+ if (property0.NameEquals("queryCapacity"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ queryCapacity = Capacity.DeserializeCapacity(property0.Value);
+ continue;
+ }
+ if (property0.NameEquals("indexingCapacity"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ indexingCapacity = Capacity.DeserializeCapacity(property0.Value);
+ continue;
+ }
+ }
+ continue;
+ }
+ }
+ return new IndexData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(provisioningState), endpoint.Value, queryCapacity.Value, indexingCapacity.Value);
+ }
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/IndexListResult.Serialization.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/IndexListResult.Serialization.cs
new file mode 100644
index 000000000000..950ee2b0837a
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/IndexListResult.Serialization.cs
@@ -0,0 +1,51 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+using Azure.ResourceManager.Cognitivesearch;
+
+namespace Azure.ResourceManager.Cognitivesearch.Models
+{
+ internal partial class IndexListResult
+ {
+ internal static IndexListResult DeserializeIndexListResult(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ IReadOnlyList value = default;
+ Optional nextLink = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("value"u8))
+ {
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(IndexData.DeserializeIndexData(item));
+ }
+ value = array;
+ continue;
+ }
+ if (property.NameEquals("nextLink"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ nextLink = new Uri(property.Value.GetString());
+ continue;
+ }
+ }
+ return new IndexListResult(value, nextLink.Value);
+ }
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/IndexListResult.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/IndexListResult.cs
new file mode 100644
index 000000000000..f3dfe42d872d
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/IndexListResult.cs
@@ -0,0 +1,43 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Azure.Core;
+using Azure.ResourceManager.Cognitivesearch;
+
+namespace Azure.ResourceManager.Cognitivesearch.Models
+{
+ /// The response of a Index list operation.
+ internal partial class IndexListResult
+ {
+ /// Initializes a new instance of IndexListResult.
+ /// The Index items on this page.
+ /// is null.
+ internal IndexListResult(IEnumerable value)
+ {
+ Argument.AssertNotNull(value, nameof(value));
+
+ Value = value.ToList();
+ }
+
+ /// Initializes a new instance of IndexListResult.
+ /// The Index items on this page.
+ /// The link to the next page of items.
+ internal IndexListResult(IReadOnlyList value, Uri nextLink)
+ {
+ Value = value;
+ NextLink = nextLink;
+ }
+
+ /// The Index items on this page.
+ public IReadOnlyList Value { get; }
+ /// The link to the next page of items.
+ public Uri NextLink { get; }
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/IndexPatch.Serialization.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/IndexPatch.Serialization.cs
new file mode 100644
index 000000000000..36a5d17930d6
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/IndexPatch.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.Cognitivesearch.Models
+{
+ public partial class IndexPatch : IUtf8JsonSerializable
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
+ {
+ writer.WriteStartObject();
+ if (Optional.IsCollectionDefined(Tags))
+ {
+ writer.WritePropertyName("tags"u8);
+ writer.WriteStartObject();
+ foreach (var item in Tags)
+ {
+ writer.WritePropertyName(item.Key);
+ writer.WriteStringValue(item.Value);
+ }
+ writer.WriteEndObject();
+ }
+ writer.WritePropertyName("properties"u8);
+ writer.WriteStartObject();
+ if (Optional.IsDefined(QueryCapacity))
+ {
+ writer.WritePropertyName("queryCapacity"u8);
+ writer.WriteObjectValue(QueryCapacity);
+ }
+ if (Optional.IsDefined(IndexingCapacity))
+ {
+ writer.WritePropertyName("indexingCapacity"u8);
+ writer.WriteObjectValue(IndexingCapacity);
+ }
+ writer.WriteEndObject();
+ writer.WriteEndObject();
+ }
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/IndexPatch.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/IndexPatch.cs
new file mode 100644
index 000000000000..2d9cf86b27a9
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/IndexPatch.cs
@@ -0,0 +1,29 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Collections.Generic;
+using Azure.Core;
+
+namespace Azure.ResourceManager.Cognitivesearch.Models
+{
+ /// The type used for update operations of the Index.
+ public partial class IndexPatch
+ {
+ /// Initializes a new instance of IndexPatch.
+ public IndexPatch()
+ {
+ Tags = new ChangeTrackingDictionary();
+ }
+
+ /// Resource tags.
+ public IDictionary Tags { get; }
+ /// The capacity allocated to the index for querying.
+ public CapacityUpdate QueryCapacity { get; set; }
+ /// The capacity allocated to the index for indexing documents.
+ public CapacityUpdate IndexingCapacity { get; set; }
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/NonePause.Serialization.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/NonePause.Serialization.cs
new file mode 100644
index 000000000000..8e065acf62b6
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/NonePause.Serialization.cs
@@ -0,0 +1,41 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.ResourceManager.Cognitivesearch.Models
+{
+ public partial class NonePause : IUtf8JsonSerializable
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
+ {
+ writer.WriteStartObject();
+ writer.WritePropertyName("type"u8);
+ writer.WriteStringValue(PauseType);
+ writer.WriteEndObject();
+ }
+
+ internal static NonePause DeserializeNonePause(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string type = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("type"u8))
+ {
+ type = property.Value.GetString();
+ continue;
+ }
+ }
+ return new NonePause(type);
+ }
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/NonePause.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/NonePause.cs
new file mode 100644
index 000000000000..6cbeee28399b
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/NonePause.cs
@@ -0,0 +1,26 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+namespace Azure.ResourceManager.Cognitivesearch.Models
+{
+ /// When the pause strategy is set to 'None', the index will remain always active.
+ public partial class NonePause : Pause
+ {
+ /// Initializes a new instance of NonePause.
+ public NonePause()
+ {
+ PauseType = "None";
+ }
+
+ /// Initializes a new instance of NonePause.
+ /// Discriminator property for Pause.
+ internal NonePause(string pauseType) : base(pauseType)
+ {
+ PauseType = pauseType ?? "None";
+ }
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/Pause.Serialization.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/Pause.Serialization.cs
new file mode 100644
index 000000000000..6825dc5ec180
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/Pause.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.Cognitivesearch.Models
+{
+ public partial class Pause : IUtf8JsonSerializable
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
+ {
+ writer.WriteStartObject();
+ writer.WritePropertyName("type"u8);
+ writer.WriteStringValue(PauseType);
+ writer.WriteEndObject();
+ }
+
+ internal static Pause DeserializePause(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ if (element.TryGetProperty("type", out JsonElement discriminator))
+ {
+ switch (discriminator.GetString())
+ {
+ case "Delay": return DelayPause.DeserializeDelayPause(element);
+ case "None": return NonePause.DeserializeNonePause(element);
+ }
+ }
+ return UnknownPause.DeserializeUnknownPause(element);
+ }
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/Pause.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/Pause.cs
new file mode 100644
index 000000000000..42e698a033c0
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/Pause.cs
@@ -0,0 +1,32 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+namespace Azure.ResourceManager.Cognitivesearch.Models
+{
+ ///
+ /// Pausing strategy for the index
+ /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
+ /// The available derived classes include and .
+ ///
+ public abstract partial class Pause
+ {
+ /// Initializes a new instance of Pause.
+ protected Pause()
+ {
+ }
+
+ /// Initializes a new instance of Pause.
+ /// Discriminator property for Pause.
+ internal Pause(string pauseType)
+ {
+ PauseType = pauseType;
+ }
+
+ /// Discriminator property for Pause.
+ internal string PauseType { get; set; }
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/ProvisioningState.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/ProvisioningState.cs
new file mode 100644
index 000000000000..abff7397cbfd
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/ProvisioningState.cs
@@ -0,0 +1,63 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ComponentModel;
+
+namespace Azure.ResourceManager.Cognitivesearch.Models
+{
+ /// The ProvisioningState.
+ public readonly partial struct ProvisioningState : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public ProvisioningState(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string SucceededValue = "Succeeded";
+ private const string FailedValue = "Failed";
+ private const string CanceledValue = "Canceled";
+ private const string ProvisioningValue = "Provisioning";
+ private const string DeletingValue = "Deleting";
+ private const string AcceptedValue = "Accepted";
+
+ /// Succeeded.
+ public static ProvisioningState Succeeded { get; } = new ProvisioningState(SucceededValue);
+ /// Failed.
+ public static ProvisioningState Failed { get; } = new ProvisioningState(FailedValue);
+ /// Canceled.
+ public static ProvisioningState Canceled { get; } = new ProvisioningState(CanceledValue);
+ /// Provisioning.
+ public static ProvisioningState Provisioning { get; } = new ProvisioningState(ProvisioningValue);
+ /// Deleting.
+ public static ProvisioningState Deleting { get; } = new ProvisioningState(DeletingValue);
+ /// Accepted.
+ public static ProvisioningState Accepted { get; } = new ProvisioningState(AcceptedValue);
+ /// Determines if two values are the same.
+ public static bool operator ==(ProvisioningState left, ProvisioningState right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(ProvisioningState left, ProvisioningState right) => !left.Equals(right);
+ /// Converts a string to a .
+ public static implicit operator ProvisioningState(string value) => new ProvisioningState(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is ProvisioningState other && Equals(other);
+ ///
+ public bool Equals(ProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override int GetHashCode() => _value?.GetHashCode() ?? 0;
+ ///
+ public override string ToString() => _value;
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/UnknownPause.Serialization.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/UnknownPause.Serialization.cs
new file mode 100644
index 000000000000..005f3c460626
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/UnknownPause.Serialization.cs
@@ -0,0 +1,41 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.ResourceManager.Cognitivesearch.Models
+{
+ internal partial class UnknownPause : IUtf8JsonSerializable
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
+ {
+ writer.WriteStartObject();
+ writer.WritePropertyName("type"u8);
+ writer.WriteStringValue(PauseType);
+ writer.WriteEndObject();
+ }
+
+ internal static UnknownPause DeserializeUnknownPause(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string type = "Unknown";
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("type"u8))
+ {
+ type = property.Value.GetString();
+ continue;
+ }
+ }
+ return new UnknownPause(type);
+ }
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/UnknownPause.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/UnknownPause.cs
new file mode 100644
index 000000000000..9f43e5587fa3
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/Models/UnknownPause.cs
@@ -0,0 +1,20 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+namespace Azure.ResourceManager.Cognitivesearch.Models
+{
+ /// The UnknownPause.
+ internal partial class UnknownPause : Pause
+ {
+ /// Initializes a new instance of UnknownPause.
+ /// Discriminator property for Pause.
+ internal UnknownPause(string pauseType) : base(pauseType)
+ {
+ PauseType = pauseType ?? "Unknown";
+ }
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/ProviderConstants.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/ProviderConstants.cs
new file mode 100644
index 000000000000..334713da0029
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/ProviderConstants.cs
@@ -0,0 +1,16 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using Azure.Core.Pipeline;
+
+namespace Azure.ResourceManager.Cognitivesearch
+{
+ internal static class ProviderConstants
+ {
+ public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly);
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/RestOperations/IndexRestOperations.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/RestOperations/IndexRestOperations.cs
new file mode 100644
index 000000000000..ac6beb94324d
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Generated/RestOperations/IndexRestOperations.cs
@@ -0,0 +1,630 @@
+// 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.Cognitivesearch.Models;
+
+namespace Azure.ResourceManager.Cognitivesearch
+{
+ internal partial class IndexRestOperations
+ {
+ private readonly TelemetryDetails _userAgent;
+ private readonly HttpPipeline _pipeline;
+ private readonly Uri _endpoint;
+ private readonly string _apiVersion;
+
+ /// Initializes a new instance of IndexRestOperations.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The application id to use for user agent.
+ /// server parameter.
+ /// Api Version.
+ /// or is null.
+ public IndexRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default)
+ {
+ _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline));
+ _endpoint = endpoint ?? new Uri("https://management.azure.com");
+ _apiVersion = apiVersion ?? "2023-05-01-preview";
+ _userAgent = new TelemetryDetails(GetType().Assembly, applicationId);
+ }
+
+ internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId)
+ {
+ 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.CognitiveSearch/indexes", false);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ _userAgent.Apply(message);
+ return message;
+ }
+
+ /// List Index resources by subscription ID.
+ /// The ID of the target subscription.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
+
+ using var message = CreateListBySubscriptionRequest(subscriptionId);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ IndexListResult value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = IndexListResult.DeserializeIndexListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw new RequestFailedException(message.Response);
+ }
+ }
+
+ /// List Index resources by subscription ID.
+ /// The ID of the target subscription.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
+
+ using var message = CreateListBySubscriptionRequest(subscriptionId);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ IndexListResult value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = IndexListResult.DeserializeIndexListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw new RequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, 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.CognitiveSearch/indexes", false);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ _userAgent.Apply(message);
+ return message;
+ }
+
+ /// List Index resources by resource group.
+ /// The ID of the target subscription.
+ /// The name of the resource group. The name is case insensitive.
+ /// The cancellation token to use.
+ /// or is null.
+ /// or is an empty string, and was expected to be non-empty.
+ public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
+ Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName));
+
+ using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ IndexListResult value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = IndexListResult.DeserializeIndexListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw new RequestFailedException(message.Response);
+ }
+ }
+
+ /// List Index resources by resource group.
+ /// The ID of the target subscription.
+ /// The name of the resource group. The name is case insensitive.
+ /// The cancellation token to use.
+ /// or is null.
+ /// or is an empty string, and was expected to be non-empty.
+ public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
+ Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName));
+
+ using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ IndexListResult value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = IndexListResult.DeserializeIndexListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw new RequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string name)
+ {
+ 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.CognitiveSearch/indexes/", false);
+ uri.AppendPath(name, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ _userAgent.Apply(message);
+ return message;
+ }
+
+ /// Get a Index.
+ /// The ID of the target subscription.
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the index resource.
+ /// The cancellation token to use.
+ /// , or is null.
+ /// , or is an empty string, and was expected to be non-empty.
+ public async Task> GetAsync(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
+ Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName));
+ Argument.AssertNotNullOrEmpty(name, nameof(name));
+
+ using var message = CreateGetRequest(subscriptionId, resourceGroupName, name);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ IndexData value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = IndexData.DeserializeIndexData(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ case 404:
+ return Response.FromValue((IndexData)null, message.Response);
+ default:
+ throw new RequestFailedException(message.Response);
+ }
+ }
+
+ /// Get a Index.
+ /// The ID of the target subscription.
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the index resource.
+ /// The cancellation token to use.
+ /// , or is null.
+ /// , or is an empty string, and was expected to be non-empty.
+ public Response Get(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
+ Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName));
+ Argument.AssertNotNullOrEmpty(name, nameof(name));
+
+ using var message = CreateGetRequest(subscriptionId, resourceGroupName, name);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ IndexData value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = IndexData.DeserializeIndexData(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ case 404:
+ return Response.FromValue((IndexData)null, message.Response);
+ default:
+ throw new RequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string name, IndexData data)
+ {
+ 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.CognitiveSearch/indexes/", false);
+ uri.AppendPath(name, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ request.Headers.Add("Content-Type", "application/json");
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(data);
+ request.Content = content;
+ _userAgent.Apply(message);
+ return message;
+ }
+
+ /// Create a Index.
+ /// The ID of the target subscription.
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the index resource.
+ /// Resource create parameters.
+ /// The cancellation token to use.
+ /// , , or is null.
+ /// , or is an empty string, and was expected to be non-empty.
+ public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string name, IndexData data, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
+ Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName));
+ Argument.AssertNotNullOrEmpty(name, nameof(name));
+ Argument.AssertNotNull(data, nameof(data));
+
+ using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, name, data);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 201:
+ return message.Response;
+ default:
+ throw new RequestFailedException(message.Response);
+ }
+ }
+
+ /// Create a Index.
+ /// The ID of the target subscription.
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the index resource.
+ /// Resource create parameters.
+ /// The cancellation token to use.
+ /// , , or is null.
+ /// , or is an empty string, and was expected to be non-empty.
+ public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string name, IndexData data, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
+ Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName));
+ Argument.AssertNotNullOrEmpty(name, nameof(name));
+ Argument.AssertNotNull(data, nameof(data));
+
+ using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, name, data);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 201:
+ return message.Response;
+ default:
+ throw new RequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string name, IndexPatch patch)
+ {
+ 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.CognitiveSearch/indexes/", false);
+ uri.AppendPath(name, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ request.Headers.Add("Content-Type", "application/json");
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(patch);
+ request.Content = content;
+ _userAgent.Apply(message);
+ return message;
+ }
+
+ /// Update a Index.
+ /// The ID of the target subscription.
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the index resource.
+ /// The resource properties to be updated.
+ /// The cancellation token to use.
+ /// , , or is null.
+ /// , or is an empty string, and was expected to be non-empty.
+ public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string name, IndexPatch patch, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
+ Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName));
+ Argument.AssertNotNullOrEmpty(name, nameof(name));
+ Argument.AssertNotNull(patch, nameof(patch));
+
+ using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, name, patch);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 202:
+ return message.Response;
+ default:
+ throw new RequestFailedException(message.Response);
+ }
+ }
+
+ /// Update a Index.
+ /// The ID of the target subscription.
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the index resource.
+ /// The resource properties to be updated.
+ /// The cancellation token to use.
+ /// , , or is null.
+ /// , or is an empty string, and was expected to be non-empty.
+ public Response Update(string subscriptionId, string resourceGroupName, string name, IndexPatch patch, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
+ Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName));
+ Argument.AssertNotNullOrEmpty(name, nameof(name));
+ Argument.AssertNotNull(patch, nameof(patch));
+
+ using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, name, patch);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 202:
+ return message.Response;
+ default:
+ throw new RequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string name)
+ {
+ 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.CognitiveSearch/indexes/", false);
+ uri.AppendPath(name, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ _userAgent.Apply(message);
+ return message;
+ }
+
+ /// Delete a Index.
+ /// The ID of the target subscription.
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the index resource.
+ /// The cancellation token to use.
+ /// , or is null.
+ /// , or is an empty string, and was expected to be non-empty.
+ public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
+ Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName));
+ Argument.AssertNotNullOrEmpty(name, nameof(name));
+
+ using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, name);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 202:
+ case 204:
+ return message.Response;
+ default:
+ throw new RequestFailedException(message.Response);
+ }
+ }
+
+ /// Delete a Index.
+ /// The ID of the target subscription.
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the index resource.
+ /// The cancellation token to use.
+ /// , or is null.
+ /// , or is an empty string, and was expected to be non-empty.
+ public Response Delete(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
+ Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName));
+ Argument.AssertNotNullOrEmpty(name, nameof(name));
+
+ using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, name);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 202:
+ case 204:
+ return message.Response;
+ default:
+ throw new RequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId)
+ {
+ 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;
+ request.Headers.Add("Accept", "application/json");
+ _userAgent.Apply(message);
+ return message;
+ }
+
+ /// List Index resources by subscription ID.
+ /// The URL to the next page of results.
+ /// The ID of the target subscription.
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(nextLink, nameof(nextLink));
+ Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
+
+ using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ IndexListResult value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = IndexListResult.DeserializeIndexListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw new RequestFailedException(message.Response);
+ }
+ }
+
+ /// List Index resources by subscription ID.
+ /// The URL to the next page of results.
+ /// The ID of the target subscription.
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(nextLink, nameof(nextLink));
+ Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
+
+ using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ IndexListResult value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = IndexListResult.DeserializeIndexListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw new RequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, 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;
+ request.Headers.Add("Accept", "application/json");
+ _userAgent.Apply(message);
+ return message;
+ }
+
+ /// List Index resources by resource group.
+ /// The URL to the next page of results.
+ /// The ID of the target subscription.
+ /// The name of the resource group. The name is case insensitive.
+ /// The cancellation token to use.
+ /// , or is null.
+ /// or is an empty string, and was expected to be non-empty.
+ public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(nextLink, nameof(nextLink));
+ Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
+ Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName));
+
+ using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ IndexListResult value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = IndexListResult.DeserializeIndexListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw new RequestFailedException(message.Response);
+ }
+ }
+
+ /// List Index resources by resource group.
+ /// The URL to the next page of results.
+ /// The ID of the target subscription.
+ /// The name of the resource group. The name is case insensitive.
+ /// The cancellation token to use.
+ /// , or is null.
+ /// or is an empty string, and was expected to be non-empty.
+ public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(nextLink, nameof(nextLink));
+ Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
+ Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName));
+
+ using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ IndexListResult value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = IndexListResult.DeserializeIndexListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw new RequestFailedException(message.Response);
+ }
+ }
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Properties/AssemblyInfo.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000000..172451e64257
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/Properties/AssemblyInfo.cs
@@ -0,0 +1,9 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using System.Runtime.CompilerServices;
+
+[assembly: Azure.Core.AzureResourceProviderNamespace("cognitivesearch")]
+
+[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
+[assembly: InternalsVisibleTo("Azure.ResourceManager.Cognitivesearch.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")]
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/autorest.md b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/autorest.md
new file mode 100644
index 000000000000..a04afd521f77
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/src/autorest.md
@@ -0,0 +1,49 @@
+# Generated code configuration
+
+Run `dotnet build /t:GenerateCode` to generate code.
+
+``` yaml
+azure-arm: true
+csharp: true
+library-name: cognitivesearch
+namespace: Azure.ResourceManager.cognitivesearch
+require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/cognitivesearch/resource-manager/readme.md
+output-folder: $(this-folder)/Generated
+clear-output-folder: true
+skip-csproj: true
+modelerfour:
+ flatten-payloads: false
+
+
+
+format-by-name-rules:
+ 'tenantId': 'uuid'
+ 'ETag': 'etag'
+ 'location': 'azure-location'
+ '*Uri': 'Uri'
+ '*Uris': 'Uri'
+
+rename-rules:
+ CPU: Cpu
+ CPUs: Cpus
+ Os: OS
+ Ip: IP
+ Ips: IPs|ips
+ ID: Id
+ IDs: Ids
+ VM: Vm
+ VMs: Vms
+ Vmos: VmOS
+ VMScaleSet: VmScaleSet
+ DNS: Dns
+ VPN: Vpn
+ NAT: Nat
+ WAN: Wan
+ Ipv4: IPv4|ipv4
+ Ipv6: IPv6|ipv6
+ Ipsec: IPsec|ipsec
+ SSO: Sso
+ URI: Uri
+ Etag: ETag|etag
+
+```
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/tests/Azure.ResourceManager.Cognitivesearch.Tests.csproj b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/tests/Azure.ResourceManager.Cognitivesearch.Tests.csproj
new file mode 100644
index 000000000000..dc080e97dc05
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/tests/Azure.ResourceManager.Cognitivesearch.Tests.csproj
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/tests/cognitivesearchManagementTestBase.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/tests/cognitivesearchManagementTestBase.cs
new file mode 100644
index 000000000000..4b0086ca160d
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/tests/cognitivesearchManagementTestBase.cs
@@ -0,0 +1,43 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using Azure.Core;
+using Azure.Core.TestFramework;
+using Azure.ResourceManager.Resources;
+using Azure.ResourceManager.TestFramework;
+using NUnit.Framework;
+using System.Threading.Tasks;
+
+namespace Azure.ResourceManager.Cognitivesearch.Tests
+{
+ public class cognitivesearchManagementTestBase : ManagementRecordedTestBase
+ {
+ protected ArmClient Client { get; private set; }
+ protected SubscriptionResource DefaultSubscription { get; private set; }
+
+ protected cognitivesearchManagementTestBase(bool isAsync, RecordedTestMode mode)
+ : base(isAsync, mode)
+ {
+ }
+
+ protected cognitivesearchManagementTestBase(bool isAsync)
+ : base(isAsync)
+ {
+ }
+
+ [SetUp]
+ public async Task CreateCommonClient()
+ {
+ Client = GetArmClient();
+ DefaultSubscription = await Client.GetDefaultSubscriptionAsync().ConfigureAwait(false);
+ }
+
+ protected async Task CreateResourceGroup(SubscriptionResource subscription, string rgNamePrefix, AzureLocation location)
+ {
+ string rgName = Recording.GenerateAssetName(rgNamePrefix);
+ ResourceGroupData input = new ResourceGroupData(location);
+ var lro = await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, input);
+ return lro.Value;
+ }
+ }
+}
diff --git a/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/tests/cognitivesearchManagementTestEnvironment.cs b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/tests/cognitivesearchManagementTestEnvironment.cs
new file mode 100644
index 000000000000..3120161ec5b4
--- /dev/null
+++ b/sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/tests/cognitivesearchManagementTestEnvironment.cs
@@ -0,0 +1,11 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using Azure.Core.TestFramework;
+
+namespace Azure.ResourceManager.Cognitivesearch.Tests
+{
+ public class cognitivesearchManagementTestEnvironment : TestEnvironment
+ {
+ }
+}
\ No newline at end of file
diff --git a/sdk/cognitivesearch/ci.mgmt.yml b/sdk/cognitivesearch/ci.mgmt.yml
new file mode 100644
index 000000000000..0d884c6be976
--- /dev/null
+++ b/sdk/cognitivesearch/ci.mgmt.yml
@@ -0,0 +1,24 @@
+# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file.
+
+trigger: none
+
+pr:
+ branches:
+ include:
+ - main
+ - feature/*
+ - hotfix/*
+ - release/*
+ paths:
+ include:
+ - sdk/cognitivesearch/ci.mgmt.yml
+ - sdk/cognitivesearch/Azure.ResourceManager.Cognitivesearch/
+
+extends:
+ template: /eng/pipelines/templates/stages/archetype-sdk-client.yml
+ parameters:
+ ServiceDirectory: cognitivesearch
+ LimitForPullRequest: true
+ Artifacts:
+ - name: Azure.ResourceManager.Cognitivesearch
+ safeName: AzureResourceManagerCognitivesearch